RE: Xpath/XSLT 2 Nov 15 drafts: order of reverse axis selection

> 
> Am I correct in thinking that
> 
> ancestor::*
> 
> will select the sequence of ancestor nodes in reverse document order?

No. The intent is definitely that all "path expressions" (in the familiar
sense of the term) will return nodes in document order.

There seems to be an omission in the spec: it says this in the case of path
expressions consisting of two or more steps separated by "/", but it says
nothing about the order of the result of a path expression consisting of a
ForwardsStep or ReverseStep with optional predicates.

As I understand it, the WG agreed that all these path expressions would
return results in document order, but there are omissions in the write-up.

In a previous draft of XPath 2.0, it was wrongly stated that ALL path
expressions returned results in document order. This is obviously wrong,
since a function call like reverse(x) is technically a path expression, but
it can return results in any order it likes.

Michael Kay


> 
> The list of example axis selections in XPath 3.2.1.1 is 
> derived from that in Xpath 1 and never mentions order, but 
> the Xpath 1 expressions were selecting unordered node sets. I 
> think that the Xpath2 examples need to be explict about the 
> order of the result (as I'm having trouble answering the 
> above simple question).
> 
> so for example
> 
> > the descendant axis contains the descendants of the context node
> 
> was adequate for XPath 1 but since the Xpath2  result is an 
> ordered list not a set I think it needs to be explict here 
> that the result is in doc order.
> 
> I _think_ the result of ancestor::* is in reverse order, in 
> which case the note in XSLT section 7 Repetition
> 
>     Note: With XSLT 1.0, the selected nodes were processed in document
>     order. With XSLT 2.0, XPath expressions that would have been valid
>     under XPath 1.0 (such as path expressions and union expressions)
>     will return a sequence of nodes that is already in document order,
>     so backwards compatibility is maintained. 
> 
> is false as
> 
> <xsl:for-each select="ancestor::*">
> 
> will iterate in the opposite order.
> 
> But it could be that that note is true in which case I'm 
> confused and in that case could the Xpath spec be clarified 
> at whichever point I became
> confused:-)
> 
> 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.
> 

Received on Thursday, 21 November 2002 18:32:24 UTC