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

RE: counter in nested for-eachs

Subject: RE: counter in nested for-eachs
From: "Mike Trotman" <mike.trotman@xxxxxxxxxxxxx>
Date: Thu, 15 May 2003 15:39:49 +0100
eachs
Good question.

I can't think of a simple general answer to this (but others may).

One solution I have used for something similar is to do two passes.
Pass 1 - construct a result tree variable containing all the nodes you want
to process - suitable nested and named.
Pass 2 - convert to node-set and process the nodes in the variable.
You can then use count on preceding:: axis + count on ancestor:: if you want
to count grouping nodes differently.
Or - if there is no nesting necessary for final list - just process all
nodes and use position().
Or - - if nesting - process all node in list using position() and use
(count(ancestor::*)) to get nesting level and trigger appropriate action.

Anyway - when I hit this sort of problem I usually find constructing a new
XML structure in a variable provides a clean solution.



-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of florian
Sent: 15 May 2003 14:26
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  counter in nested for-eachs


hi!

i have two or three nested for-each elements, is it possible to
have a global counter for all of them?

i would like that with every loop in every for-each a number
is incremented by one..

any way?

thanks!

ciao!
florian


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



 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.