[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] problems with recurssion
Hi All! I want to build a HTML document from an XML document. The XML
document contains information about a shopping list. I want to build a text
box for each article existing in the shopping list. Because I don´t know
the number of articles in the shopping list, the name of the box for each
article would be nameOfTextBox-0 for the first article, nameOfTextBox-1 for
the second, and so on...
To generate the corresponding indexes of the text boxes I have to use recurssion, due to the lacking of an assignment operator for the variables. The problem is that the following code only creates the text boxes for the first element of the list. The code is the following: ... <xsl:template match="/LISTA"> <xsl:element name="INPUT"> <xsl:attribute name="TYPE">TEXT</xsl:attribute> <xsl:attribute name="NAME">nombreLista</xsl:attribute> <xsl:attribute name="VALUE"><xsl:value-of select="./ID/NOMBRE_LISTA"/> </xsl:attribute> </xsl:element> <xsl:element name="INPUT"> <xsl:attribute name="TYPE">TEXT</xsl:attribute> <xsl:attribute name="NAME">fechaCreacion</xsl:attribute> <xsl:attribute name="VALUE"><xsl:value-of select="./ID/FECHA_CREACION"/> </xsl:attribute> </xsl:element> <xsl:call-template name="articulos"> <xsl:with-param name="numArr" select="0"/> <xsl:with-param name="listaNodos" select="."/> </xsl:call-template> <INPUT TYPE="button" onClick="alert(hidArtDC0.value)"/> </xsl:template>
<xsl:template name="crearArticulos"> <xsl:param name="numArr"/> <xsl:param name="nodoAct"/> <xsl:element name="INPUT"> <xsl:attribute name="TYPE">HIDDEN</xsl:attribute> <xsl:attribute name="NAME">hidArtDC<xsl:value-of select="$numArr"/></xsl:attribute> </xsl:template> ... My XML is... <?xml version = '1.0' encoding='iso-8859-1'?> <?xml-stylesheet href='../XSLT/FormatoListas.xsl' type='text/xsl'?> <LISTA> <ID> <NOMBRE_LISTA>sabado</NOMBRE_LISTA> <FECHA_CREACION>8/11/2001 10:17:16</FECHA_CREACION> </ID> <ARTICULO> <DESCRIPCION_CORTA>desco_corta</DESCRIPCION_CORTA> </ARTICULO> <ARTICULO> <DESCRIPCION_CORTA>desc2_corta</DESCRIPCION_CORTA> </ARTICULO> </LISTA> Thanks in advance, friends! _________________________________________________________________ MSN Photos es la manera más sencilla de compartir e imprimir sus fotos: http://photos.latam.msn.com/Support/WorldWide.aspx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|