|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Counting using variable inside the loop
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: 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
|
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
|

Cart








