Proposal: XPath grammar simplification

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 UTC