This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

General counting question: finding max


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]