<?vsp 
--  
--  $Id$
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2018 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 XT_TEXT into body from XML_TEXT2 where XT_FILE = {?'file'};
      if ({?'act'} = '1')
	{
	  declare ses any;
          ses := string_output ();
          http ('<html><body>');
	  http_value (body, 'pre', ses);
          http (string_output_string (ses));
          http ('</body></html>');
	  return;
	}
      else if ({?'act'} = '2')
	{
	  http_header ('Content-Type: text/xml\r\n');
	  http (body);
	  return;
	}
    }
?>
<html>
<head><link rel="stylesheet" type="text/css" href="../demo.css"></head>
<body>
<table class="tableresult" width="85%">
<tr><th>#</th><th>file name</th><th colspan=2>View</th></tr>
<?vsp
  for select XT_ID, XT_FILE from XML_TEXT2 do {
?>
  <tr><td><?=XT_ID?></td><td><?=XT_FILE?></td>
  <td><a href="xs_s_1_sample_1.vsp?file=<?=XT_FILE?>&act=1">XML source</a></td>
  <td><a href="xs_s_1_sample_1.vsp?file=<?=XT_FILE?>&act=2">RAW XML</a></td>
  </tr>
<?vsp
  }
?>
</table>
</body>
</html>
