[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

General counting question: finding max


Subject: General counting question: finding max
From: Gert Bultman <g.w.bultman@xxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2000 11:55:21 +0000

Using count() it is easy to count the number of nodes from a certain
part of an xmltree.
I would like to find the length of the longest chain of <x>'s in the
following document:

<a><x/<x/></a>
<a><x/></a>
<a><x/><x/><x/><x/></a>

for-each a do count(x)is the easy part.
I could save all the counted numbers in a long string and then find the
maximum by recursively unpacking the string (as has been demonstrated in
this list). 
However, I have a feeling that there must be an easier way, but I cannot
think of it. 
First task is to only find the length of the longest series, next step
is to remember at which <a> that occurred :-)

Any help?

Gert Bultman
Delft Technical University


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



Current Thread