<?xml version="1.0" encoding='ISO-8859-1'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:saxon="http://icl.com/saxon"
		extension-element-prefixes="saxon">

<xsl:template match="encuesta">
<xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
<html>
 <head>
  <title>Encuesta, procesada con <code>encuesta3.xsl</code></title>
 </head>
 <body>

 <p><br /></p>

 <center>
  <form>
  <table border="0" width="80%" bgcolor="#000000" cellspacing="0" cellpadding="0">
   <tr>
    <td width="100%">
     <table border="0" width="100%" cellpadding="4">
      <tr>
       <td width="100%" bgcolor="#c0c0c0" align="right">
        <big><big>Encuesta chuli</big></big>
       </td>
      </tr>
      <tr>
       <td width="100%" bgcolor="#ffffff" align="center">
        <xsl:apply-templates/>
        <p><br/></p>
       </td>
      </tr>
     </table>
    </td>
   </tr>
  </table>
  </form>
 </center>

 <p align="center">
  <font size="-1">
   Copyright &#169; 1999-2001 <a href="http://geneura.ugr.es/~jmerelo">JJ Merelo</a>.<br/>
  </font>
 </p>
 </body>
</html>
</xsl:template>

 <xsl:template match="cuestion">
  <p><br/></p>
  <table border="0" width="90%" bgcolor="#000000" cellspacing="0" cellpadding="0">
   <tr>
    <td width="100%">
     <table border="0" width="100%" cellpadding="4">
      <tr>
       <td width="100%" colspan='2' bgcolor="#e0e0e0">
        <big> <xsl:value-of select="pregunta"/></big>
       </td>
      </tr>
      <xsl:choose>
	<xsl:when test='@tipo="multiple"'><xsl:apply-templates /></xsl:when>
	<xsl:when test='@tipo="numero"'>
	   <tr>
     		<td colspan ='2' width="100%" bgcolor="white">
        	<select name='numero'>
		<xsl:for-each select='saxon:range(0,@rango)'>
 			<option><xsl:value-of select='.' /></option>
		</xsl:for-each>
		</select>
     		</td>
   	   </tr>
        </xsl:when>
	<xsl:when test='@tipo="rollete"'>
	   <tr>
     		<td colspan='2' width="100%" bgcolor="white">
        	<input type='text' />
     		</td>
   	   </tr>
        </xsl:when>
       	<xsl:when test='@tipo="bool"'>
	   <tr>
     		<td bgcolor="white">
        	Si
     		</td>
                <td bgcolor="white">
        	<input type='radio' />
     		</td>
   	   </tr>
	    <tr>
     		<td bgcolor="white">
        	No
     		</td>
                <td bgcolor="white">
        	<input type='radio' />
     		</td>
   	   </tr>
        </xsl:when>
      </xsl:choose>
     </table>
    </td>
   </tr>
  </table>
 </xsl:template>

 <xsl:template match='respuesta'>
   <tr>
     <td width="100%" bgcolor="white">
        <xsl:value-of select="."/>
     </td>
     <td width="100%" bgcolor="white">
        <input type='checkbox' />
     </td>
   </tr>
 </xsl:template>

 <xsl:template name='option-range'>
   <xsl:param name='range' />
   <xsl:param name='i'>0</xsl:param>
   <xsl:if test='$range != $i'>
     <option><xsl:value-of select='$i' /></option>
     <xsl:call-template name='option-range'>
	<xsl:with-param name='range' select='$range'/>
	<xsl:with-param name='i' select='$i+1'/>
     </xsl:call-template>
   </xsl:if>
 </xsl:template>
</xsl:stylesheet>
