Subject: Re: [xsl] Counting using variable inside the loop From: "Andrew Curry" <andrew.curry@xxxxxxxxxxxx> Date: Thu, 11 Mar 2004 09:29:05 -0000 |
If you litrally want to count the number of row elements in xsl do <xsl:variable name="count" select="count(//row)"/> ----- Original Message ----- From: "Arulraj" <p_arulraj@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, March 11, 2004 9:12 AM Subject: [xsl] Counting using variable inside the loop Hello, I want to count number of row element in XML. My XML content look like this <layout> <table> <rowseparator/> <row> <cell> </row> <rowseparator/> <rowseparator/> <row> <cell> </row> </table> </layout> In my XSL file I am traversing this XSL file using for-each select="child::*" I want to find the row position. If I use <xsl:value-of select="position()"/> it returns 2 and 5 But I want to make a count row, when I reach first row I should this is first row. when next row encounter I should say this is second row. I tried with <xsl:variable> <xsl:template name="table_element_traversal"> <xsl:variable name="rowcount">0</xsl:variable> <xsl:if test="row"> <xsl:variable name="rowcount select="$rowcount+1"/> <xsl:value-of select="$rowcount"/> </xsl:if> </xsl:template> I am getting parser error conflicting variable bindings 'rowcount' How to solve this in XSL? Any idea, Thank you Regards, Arul __________________________________ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Counting using variable insid, Arulraj | Thread | Re: [xsl] Counting using variable i, Jeni Tennison |
[xsl] Counting using variable insid, Arulraj | Date | Re: [xsl] Counting using variable i, Jeni Tennison |
Month |