Re: [xsl] Help with using position()

Subject: Re: [xsl] Help with using position()
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sun, 01 Jan 2012 11:52:15 +0100
Vincenzo Menanno wrote:
A few more questions using the example below.

I have 1 xsl that gets me all the Calculations and using postion() function I am able to get the position number of the calculation.

<xsl:value-of select="position()"/>

All I want is a unique number or sequence number of each calculation. So is position() the most effective way to do this?

position() works as long as your for-each or apply-templates processes only the nodes you are interested in to number.
In the more general case (for instance when you process all child elements but are only interested in numbering "foo" elements) you would use xsl:number (http://www.w3.org/TR/xslt#number) as in
<xsl:number count="foo"/>





--


	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

Current Thread