RE: [xsl] counter in nested for-eachs

Subject: RE: [xsl] counter in nested for-eachs
From: "Mike Trotman" <mike.trotman@xxxxxxxxxxxxx>
Date: Thu, 15 May 2003 15:39:49 +0100
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: [xsl] counter in nested for-eachs


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?



 XSL-List info and archive:

 XSL-List info and archive:

Current Thread