jholg@gmx.de wrote:
Third, I *think* that, as the result of the xpath expression "/a/b/c/ancestor-or-self::*" is a node-set, the order of nodes in the nodeset is an implementation detail; document order might be a good choice to have consistent results.
Clarifications welcome.
"An axis is either a forward axis or a reverse axis. An axis that only ever contains the context node or nodes that are after the context node in document order is a forward axis. An axis that only ever contains the context node or nodes that are before the context node in document order is a reverse axis." Forward and reverse axes both contain the nodes in document order. "The proximity position of a member of a node-set with respect to an axis is defined to be the position of the node in the node-set ordered in document order if the axis is a forward axis and ordered in reverse document order if the axis is a reverse axis." In a reverse axis the 'proximity position' is defined in reverse order. root.xpath ("/a/b/c/ancestor-or-self::*") returns the nodes in document order and root.xpath ("/a/b/c/ancestor-or-self::*")[0] is the first node in document order. It's a thinko, not a bug. -- Marcello Perathoner webmaster@gutenberg.org