This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
General counting question: finding max
- To: xsl-list at mulberrytech dot com
- Subject: General counting question: finding max
- From: Gert Bultman <g dot w dot bultman at ITS dot TUDelft dot nl>
- Date: Tue, 15 Aug 2000 11:55:21 +0000
- References: <7784D3376646D311B082000021CF26243F82FC@PIKE>
- Reply-To: xsl-list at mulberrytech dot com
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