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

Re: getting the counter for a for-each statement

Subject: Re: getting the counter for a for-each statement
From: yguaba@xxxxxxxxxxxx
Date: Fri, 12 Dec 2003 10:53:33 -0200
xsl for each counter
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


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.