- From: Oliver Becker <obecker@informatik.hu-berlin.de>
- Date: Tue, 9 Sep 2003 18:29:19 +0200 (MEST)
- 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