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]
Other format: [Raw text]

Re: Hierarchy problem


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


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