W3C home > Mailing lists > Public > www-xpath-comments@w3.org > October to December 2004

RE: following/preceding-sibling shorthands in XPath 2.0

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 17 Nov 2004 14:14:39 -0000
To: "'Laurens Holst'" <lholst@students.cs.uu.nl>, <www-xpath-comments@w3.org>
Message-ID: <S-UTL01-DCPOPSTnaNd0001d935@dcpop.smtp.stsn.com>

> 
> 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
Received on Wednesday, 17 November 2004 14:14:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:55 GMT