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

Re: increment variable with xsl:for-each

Subject: Re: increment variable with xsl:for-each
From: Brian Chrisman <brian.chrisman@xxxxxx>
Date: Fri, 26 Mar 2004 11:06:17 +0100
xsl variable increment
Tuan Luu wrote:

hello I'm looking for a code to increment a variable in xsl:for-each loop

I ended up here:

<xsl:variable name="a">1</xsl:variable>

<xsl:for-each select="name">

You may be looking for:
<xsl:variable name="a" select="count(name)"/>
or possibly:
<xsl:for-each select="name">
   <count><xsl:value-of select="position()"/></count>

The kind of information you are probably looking for when you use $a is probably already provided. If not, use a recursive template as mentioned by several other people here.

<xsl:value of select="{$a+1}"/>
<xsl:value of select="{$a}"/>


thanks for any answer

Current Thread


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.
First Name
Last Name
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.