This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Hierarchy problem
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 22 Jul 2002 10:54:09 +0100
- Subject: Re: [xsl] Hierarchy problem
- Organization: Jeni Tennison Consulting Ltd
- References: <9B66BBD37D5DD411B8CE00508B69700F024A78B2@pborolocal.rnib.org.uk>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Dave,
David C made a typo when he wrote:
>> just if $y is a child of $x which is what I think you mean by direct
>> descendant.
>>
>> count($x//*|$y) = count($x/*)
>>
>> if $y is a descendent of $x
He meant:
count($x//*|$y) = count($x//*)
^ additional /
In other words, count the number of nodes in the union of the
descendant elements of $x with $y and see if it's the same as the
number of *descendant* elements of $x. As it was, it was testing $x's
*children* against the union.
Try that. I think you'll find that it works (returns true if $y is a
descendant of $x).
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list