On 24/09/2011 16:56, John Cowan wrote:
> Another point is that an axis has to have unambiguous ordering (okay,
> there's the namespace axis, but who cares about that?) It is not
> clear where the self should go on a child-or-self axis: first, last,
> in the middle?
well actually it would have to go first (as it would be a forward axis
so return nodes in document order), but mainly I suspect it's not
provided as it's hard to find a natural use case for it and it's longer
to type that .|node() which would be the equivalent (if used as the
first step (or in any step in xpath 2).
ancestor-or-self:: is used often for finding the nearest in-scope
attribute value (for lang or id of nearest containing section, etc.)
descendant-or-self:: is, as Ken just commented, used for defining //
(although actually that was probably a mistake, it was done that way
intentionally so //p[1] meant the first p in each section, whereas most
people probably expect // to be defined as descendant:: and have //p[1]
mean the first p in the document, but that's all water under the bridge
now:-)
David