W3C home > Mailing lists > Public > www-xpath-comments@w3.org > July to September 1999

Proposal: XPath grammar simplification

From: Matthias Hausner <matthias@intertrust.com>
Date: Fri, 20 Aug 1999 15:24:23 -0700
Message-ID: <E91A659210B7D21190FA00105A1567AC64E15A@wasabi.epr.com>
To: www-xpath-comments@w3.org
Cc: Matthias Hausner <matthias@wasabi.epr.com>
I propose a grammar simplification for XPath. The // abbreviation appears in
several productions, as opposed to the abbreviated steps . and .. . This is
because the token // not only stands for a location step, but at the same
time also separates two location steps (through the / tokens in the
corresponding unabbreviated form, /descendant-or-self::node()/ ).
 
I propose to eliminate the // token and instead introduce the token ~ (or
any other character that the W3C might find more appropriate) as an
abbreviation for the location step descendant-or-self::node(). (Note that
there are no / tokens around the location step.)
 
This would make the XPath grammar simpler and more regular. The following
productions would be eliminated:
 
[10]  AbbreviatedAbsoluteLocationPath ::=  '//' RelativeLocationPath 
[11]  AbbreviatedRelativeLocationPath ::=  RelativeLocationPath '//' Step
 
The following productions would be simplified:
 
[19]  PathExpr  ::=  LocationPath  | FilterExpr  | FilterExpr '/'
RelativeLocationPath
[2]  AbsoluteLocationPath  ::=  '/' RelativeLocationPath?  
[3]  RelativeLocationPath  ::=  Step  | RelativeLocationPath '/' Step
 
Similarly, some productions for location paths in the XSL spec would be
simplified.
 
The only addition would be the token ~ for an abbreviated location step.
 
[12] AbbreviatedStep ::= '.' | '..' | '~'
 
I believe that this simple change would make the grammar more elegant.
 
 
Matthias Hausner
 
 
Received on Friday, 20 August 1999 18:25:10 GMT

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