<?vsp 
--  
--  $Id: xs_s_2_sample_1.vsp,v 1.2.2.1 2012/03/08 12:55:18 source Exp $
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2012 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  

  declare body varchar;
  if ({?'act'} is not null)
    {
      select xml_persistent(XT_TEXT) into body from XML_TEXT3 where XT_FILE = {?'file'};
      if ({?'act'} = '1')
	{
	  declare ses any;
          ses := string_output ();
          http_value (body, null, ses);
          body := string_output_string (ses);
          ses := string_output ();
          http ('<html><body>');
	  http_value (body, 'pre', ses);
          http (string_output_string (ses));
          http ('</body></html>');
	  return;
	}
      else if ({?'act'} = '2')
	{
	  declare ses any;
          ses := string_output ();
	  http_header ('Content-Type: text/xml\r\n');
	  http_value (body, null, ses);
          http (string_output_string (ses));
	  return;
	}
    }
?>
<html>
<head><link rel="stylesheet" type="text/css" href="../demo.css"></head>
<body>
<table class="tableresult">
<th>#</th><th>file name</th><th colspan=4>Actions</th>
<?vsp
  for select XT_ID, XT_FILE from XML_TEXT3 do {
?>
  <tr><td><?=XT_ID?></td><td><?=XT_FILE?></td>
  <td><a href="xs_s_2_sample_1.vsp?file=<?=XT_FILE?>&act=1">XML source</a></td>
  <td><a href="xs_s_2_sample_1.vsp?file=<?=XT_FILE?>&act=2">RAW XML</a></td>
<?vsp
  }
?>
</table>
</body>
</html>
