Re: Immediacy of preceding-siblings

Subject: Re: Immediacy of preceding-siblings
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 31 Aug 2000 21:44:05 -0600 (MDT)
Matthew Bentley wrote:
> Does "preceding-sibling::*[1]" select the immediately preceding sibling
> or would that be "preceding-sibling::*[last()]" ?

Let's say you have

  <sibling num="1"/>
  <sibling num="2"/>
  <sibling num="3"/>

and the current node is sibling number 3.

 preceding-sibling:: will select siblings 1 and 2, and the whitespace-only
text nodes in between.

 * will reduce that set down to just those that are elements (siblings 1
and 2)

 [1] will reduce that set down to just the one at position 1 in that set.
the position ordering depends on the directionality of the axis. for
preceding axes, reverse document order is used. so sibling 2 is at
position 1, and sibling 1 is at position 2.

 [last()] will instead reduce that set down to just the one at the last
position in the set. this will be sibling 1. actually the function will be
evaluated first, so saying [last()] is the same as [2].

   - Mike
Mike J. Brown, software engineer at         My XML/XSL resources: in Denver, Colorado, USA 

 XSL-List info and archive:

Current Thread