[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: counter in nested for-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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|