<?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 ostr varchar;
  ostr := '';
  if ({?'trf'} = 'Transform')
    {
      declare body, ses any;
      declare enc varchar;
      select XT_TEXT into body from XML_TEXT2 where XT_FILE = {?'file'};
      set http_charset={?'enc'};
      http (body);
      http_xslt (concat (TUTORIAL_XSL_DIR () , '/tutorial/xmlxslt/xs_e_1/', {?'sty'}));
      return;
    }
?>
<html>
<head><link rel="stylesheet" type="text/css" href="../demo.css"></head>
<body>
<H3>xsl:output &amp; and parsing XML with encoding example</H3>
<form action="xs_e_1_sample_2.vsp" method="post">
<table class="tableentry">

<tr><td>1. Choose the output encoding</td><td><select name=enc>
  <?vsp
    declare cs any;
    declare i, l integer;
    cs := charsets_list (0);
    i := 0; l := length (cs);
    while (i < l)
      {
	http (sprintf ('<option value="%s">%s</option>', cs[i], cs[i]));
        i := i + 1;
      }
  ?>
</select></td></tr>
<tr><td>2. Choose stylesheet for transformation</td><td><select name=sty>
	<option value="xs_e_1.xsl">output html</option>
	<option value="xs_e_2.xsl">output text</option>
	<option value="xs_e_3.xsl">output xml</option>
</select></td></tr>

<tr><td>3. Choose document to transform</td><td>&nbsp;</td></tr>
<?vsp
  for select XT_FILE from XML_TEXT2 do
     {
?>

<tr><td>&nbsp;</td><td><input type=radio name=file value="<?=XT_FILE?>"><?=XT_FILE?></td></tr>

<?vsp
     }
?>

<tr><td>4. Make transformation</td><td><input type=submit name=trf value="Transform"></td></tr>
</table>

</form>
</body>
</html>
