Subject: Re: [xsl] testing for following siblings From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sat, 18 May 2002 00:01:42 +0100 |
Hi Paul, > Another confusion ... I'm trying to determine when the current node > has no following siblings. One expression that seems to work is: > > not(following-sibling::*) Yes. This gathers together all the following sibling elements of the context node into a node set. The not() function converts that node set to a boolean -- true if there are any nodes in a node set and false if there aren't -- and then negates that boolean. So you get true if you don't manage to find any following sibling elements. > but the following expressions don't "work", and I thought they would > > following-sibling::* = '' This tests whether any following sibling element has a string value of an empty string. It gathers together a node set of the following sibling elements and compares them each to the empty string. If any of them are the empty string, then it returns true. If there aren't any following sibling elements, or if none of them are empty strings, then it returns false. > following-sibling::* = '/..' This tests whether any following sibling element has a string value of '/..' (you put quotes around it, so it's a string). As above, if there aren't any following sibling elements, or if none of them have the string value '/..', then it returns false. Possibly what you were trying to test here was: following-sibling::* = /.. But = doesn't compare node sets as a whole (i.e. it won't say "the node set of following sibling elements is the same as the empty node set"). Instead it compares pairs of nodes from the two node sets -- it's the same as "is there a node in the node set of following siblings with the same value as one of the nodes in the empty node set?". Since there's nothing in the second node set, the answer is always false. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] testing for following sibling, paul morgan | Thread | [xsl] newbie question about using s, dmitri kerievsky |
Re: [xsl] Generating a list of item, Jeni Tennison | Date | [xsl] newbie question about using s, dmitri kerievsky |
Month |