W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

Re: Inability of location steps to support multiple axes

From: Oliver Becker <obecker@informatik.hu-berlin.de>
Date: Tue, 9 Sep 2003 18:29:19 +0200 (MEST)
Message-Id: <200309091629.h89GTJta000126@mail.informatik.hu-berlin.de>
To: emerson@harvestman.net, public-qt-comments@w3.org

Emerson wrote: 

> For example, in the current Xpath expresssions the following is
> cumbersome:
> 
> "parent::a/following-sibling::*//text() |
> parent::a/preceding-sibling::*//text()"
> 
> An obvious solution to the problem which I would like to propose is to
> allow Xpath filter expressions to occur as location steps.  This is easy
> to implement and does not deviate from the purpose of the filter
> expression which is to take a function or an expression which returns a
> node-set and filter it by optional predicates, just like a location
> step.
> 
[...]
> So the above example would become:
> 
> "parent::a/(following-sibling::* | preceding-sibling::*)//text()"
> 
> Which in my opinion is logically much more concise...

It could be that I am missing something, but I believe your proposal
is possible in XPath 2.0.
Check out the third item *before* 3.3 Sequence Expression (in reverse
document order ;-) ) for an example.
http://www.w3.org/TR/xpath20/#id-sequence-expressions

The parse tree for that is a little bit lengthy, but basically you can
reduce a StepExpr -> PrimaryExpr -> ParenthesizedExpr -> ...
-> '(' OrExpr ')' -> ... (many steps using always the first non terminal) ... 
-> '(' UnionExpr ')'
-> ... -> '(' PathExpr '|' PathExpr ')'
There you are!

Cheers,
Oliver
(not a WG member)


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
Received on Tuesday, 9 September 2003 12:29:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC