This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
counting problem
- From: KRokicki at genelogic dot com
- To: XSL-List at lists dot mulberrytech dot com
- Date: Thu, 13 Jun 2002 12:19:34 -0400
- Subject: [xsl] counting problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
I've got a xml structure that consists of A's, R's and S's.
S's can contain any number of R's and R's can contain any number of any of
the 3 elements.
For any given S node in the document I need to count all it's descendant
A's but only those descended from the first R in every S.
So if I have something like this:
<S>
<R>
<A/> *
<A/> *
<S>
<R><A/> * </R>
<R><A/></R>
</S>
</R>
<R>
<A>
<R>
</S>
It should count 3 A's, the ones I marked.
Is there a way to do that in xpath alone?
If not, I've written a template that visits all the nodes I want and
returns each count.. the problem is it concatenates them rather than
adding. Is there a way to add those returned values?
Thanks for any help,
Konrad
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list