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(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
florian
Sent: 15 May 2003 14:26
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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