xsl-list
[Top] [All Lists]

Re: getting the counter for a for-each statement

2003-12-12 05:53:33
Hello Jaime,

Below is an excerpt from "Inside XSLT" (auth. Steven Holzner, pub. 
New Riders, ISBN 0-7357-1136-4) which may give you some ideas:


"You use <xsl:number>to assign a number in a sequence to a node in 
the result document. For example, you can number paragraphs in a 
contract or stanzas in a poem. You can even number parts of a 
document down to multiple levels, such as "Paragraph 3.2.5.1." and so 
on.

Here are the <xsl:number> element's attributes:

level (optional) - Determines how sequence numbers are assigned. Set 
to "single", "multiple", or "any". The default is "single".  

count (optional) - Determines which nodes are to be counted. Set to a 
pattern.  

from (optional) - Determines the point at which counting starts. Set 
to a pattern.  

value (optional) - A number to be formatted.  

format (optional) - Determines the output format. Set to an attribute 
value template that returns a format string.  

lang (optional) - Determines the language whose conventions to use 
for numbering. Set to a language code that you can use with the 
xml:lang attribute.  

letter-value (optional) - Enables you to distinguish between 
different numbering schemes. Set to "alphabetical" or "traditional".  

grouping-separator (optional) - A character used to separate groups 
of digits, such as a comma. Set to an attribute value template that 
returns a single character.  

grouping-size (optional) - Number of digits in each group?determines 
where the grouping separator should be used. Set to an attribute 
value template that returns a number."


Hope this helps.

Cheers,

Erik


On 11 Dec 2003 at 13:13, Jaime A Stuardo Bahamondes wrote:

Hi all..

I have this for-each:

<xsl:for-each select="ROW[count(. | key('tipos_calculo',
DET_TIPO_CAL_ID)[1]) = 1]">
  <xsl:value-of select="count" />
</xsl:for-each>


I neet to get the index of each iteration. For example, suppose that
for-each loops 3 times, so, the output would be:

1
2
3

Any help?
Thanks

Jaime

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>