xsl-list
[Top] [All Lists]

Re: [xsl] testing preceding sibling always evaluates true

2011-08-10 04:14:08
On 10/08/2011 04:15, Hank Ratzesberger wrote:
Thank you Michael.

I just received the 4th edition (it really is hardbound!)
so I could check if anything had changed, but on p. 602 :

 There are three kinds of expressions in XPath 2.0 whose result
 is guaranteed to be a sequence of nodes in document order...

  o Any axis step (even and axis step like <preceding-sibling::*> that
    uses a reverse axis delivers its results in forwards document order)

But, reading on... p. 618

 In effect, the predicate operator <[]> has a higher precedence (it
 binds more tightly) than the path operator </>

And the following paragraph is also relevant to this discussion: in a FilterExpr, the items in a sequence are considered in their original order when evaluating the predicate; in an AxisStep, the nodes are considered in the order of the relevant axis.

You're right that this is a highly subtle (=obscure and easily missed) feature of the XPath semantics.

This didn't change between XPath 1.0 and 2.0. Many people would have liked to change it, but backwards-compatibility ruled the day.

Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>