xsl-list
[Top] [All Lists]

RE: get immediat preceeding node, if it is a comment

2002-10-04 07:16:31

DC:
All later predicates refer to nodes for which earlier predicates are
true.

That sums it up nicely,

cheers
andrew

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: 04 October 2002 14:25
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] get immediat preceeding node, if it is a comment



It seems that any predicates after the positional predicate refer to
that node, not to the node that the predicates before the positional
predicate refer to... 

yes but that's a special case. You can have any number of [] 
predicates
in a step and after each one the remaining nodes in the current node
list are those nodes for which the predicate was true.  while 
evaluating
the next [] position() and last() and count() all refer to the current
node list (ie the list of nodes that have survivied any previous []
predicates in the step)


preceding-sibling::node()[normalize-space()][1][self::comment()]

this gets 'test1' and 'test3' as we would expect

anything that involves [1] (anywhere) will select a node set 
of at most
one node. Your description in english suggests you used the expression

*/preceding-sibling::node()[normalize-space()][1][self::comment()]

while <root> is your current node.

ie find all children that have the stated condition.

So is it the case that all predicates to the right of the positional
predicate refer to that node? (they change the context node)

Yes but there is nothing special about the positional predicate it is
just shorthand for the boolean test [position()=1].
All later predicates refer to nodes for which earlier predicates are
true.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or 
alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list