Subject: Re: Help with using position()
From: Vincenzo Menanno <enzo13@xxxxxxx>
Date: Sun, 01 Jan 2012 03:03:14 -0800
|
Perfect thanks Martin.
So I ended up with this.
<xsl:number level="any" count="Calculation"/>
And that looks like it works.
Vince
On Jan 1, 2012, at 2:52 AM, Martin Honnen wrote:
> 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"/>
|