Re: [xsl] Hierarchy problem

Subject: Re: [xsl] Hierarchy problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 22 Jul 2002 10:54:09 +0100
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


Current Thread