[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Counting using variable inside the loop

Subject: Re: Counting using variable inside the loop
From: "Andrew Curry" <andrew.curry@xxxxxxxxxxxx>
Date: Thu, 11 Mar 2004 09:29:05 -0000
xsl row count
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.