I have previously sent a mail about this to the www-xpath-comments@w3.org mailinglist, but I was directed here. The original message is below: > 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] > > Neither + or - are legal characters to start an XML element name with, > so I think this syntax is possible. Other usage examples would be +[1] > and -[1] for +*[1] and -*[1]. > > In my company's product we have changed from our own targeting method to > XPath (shorthand notation), and this is one thing we're missing. We use > these selectors so often that we currently defined our own syntax for it > ('~+chapter[1]' and '~-chapter[1]'), but we would prefer to use a > standardized method. I understand from a comment by Michael Kay on the other list that + and - are used as unary operator (should have thought of that), so that's a no go. Instead, I propose the syntax we have temporarily chosen to use in my company: ~+chapter[1] ~-chapter[1] Although I don't really care what the syntax will exactly be, it would be very nice to have a shorthand for this selector available. To quote Alex Kodat from the other list: "...it also strikes me as a bit bizarre that such important axes don't have an abbreviated syntax." ~Grauw -- Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!Received on Wednesday, 17 November 2004 15:49:39 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:02 UTC