RE: following/preceding-sibling shorthands in XPath 2.0

"Michael Kay" <[email protected]> Wed, 17 Nov 2004 14:14:39 -0000
Newsgroups gmane.text.xml.xpath.general
Message-ID <[email protected]>
> 
> What about creating shorthands for following-sibling and 
> preceding-sibling in XPath 2.0?
> 
> following-sibling::chapter[fn:position() = 1] could be
> +chapter[1]
> 
> and
> 
> preceding-sibling::chapter[fn:position() = 1] could be
> -chapter[1]

The unary + and - operators, when applied to a node, cause the node to be
atomized and its numeric value extracted. So this doesn't work.

I think that a lot of people feel that XPath syntax is terse enough already,
and there will be little enthusiasm in the working groups for the
introduction of further abbreviations. You can always create functions
z:next(.) and z:prior(.) if you really need to save keystrokes.

Michael Kay