Re: Comments on XPointer 1.0 CR

Daniel Veillard <Daniel.Veillard@w3.org>
>
>   the change is a single addition to the production [3] of the XPath
> specification:
> 
>   [3]   RelativeLocationPath ::=   Step |
>                                    RelativeLocationPath '/' Step |
>                                    AbbreviatedRelativeLocationPath
> 
>  Basically this is a single exception for the range-to() function.
> It is not a generic change and not extendable to other functions.
> This is used to express that a range computation must be made for
> each of the nodes in the current nodelist. The Modified XPath
> production becomes:
> 
>   [3xptr] RelativeLocationPath ::=   Step |
>                                    RelativeLocationPath '/' Step |
>                                    AbbreviatedRelativeLocationPath |
>                                    'range-to(' RelativeLocationPath ')'

This BNF does not achieve what you want. Specifically, it does not allow
you to parse the "range-to" examples in section 5.4.1. (Try it!)

(1) The first example
        id("chap1")/range-to(id("chap2"))
    fails to parse because the argument to "range-to" is a FunctionCall,
    which is not a RelativeLocationPath. To allow both, you need the
    argument to be at least (as general as) PathExpr, but you'd be better
    off (being completely general) saying it's an Argument.

(2) The second example
        descendant::REVST/range-to(following::REVEND[1])
    fails to parse because "range-to(...)" falls where a Step is needed,
    not a RelativeLocationPath.  That is, you should make "range-to(...)"
    an alternative for Step (production 4), not RelativeLocationPath.

Moreover, though not needed to parse the examples:

(3) Instead of
        'range-to('
    I think you should say
        'range-to' '('
    (to get the tokenization right).

(4) Might one want to apply predicates to the result of a 'range-to'?

Thus, I suggest:
    [4xptr] Step ::= AxisSpecifier NodeTest Predicate*
                     | AbbreviatedStep
                     | 'range-to' '(' Argument ')' Predicate*

However, there's one niggling technicality. Presumably you want such a use
of "range-to" to have the semantics of an XPath FunctionCall (see XPath
section 3.2), but although it looks like a FunctionCall, it isn't
(according to this BNF). Now you could fudge it and say that "in a Step of
the third form, the 'range-to' '(' Argument ')' portion should be
evaluated as if it were a FunctionCall", but that's kludgey. Instead, you
could say

    [4xptr] Step ::= ...
                     | ...
                     | FunctionCall Predicate*

and then add a VC saying that the only FunctionName currently allowed in
such a context is 'range-to'. Still a little kludgey, but in my opinion
it's the minimal-kludge solution.

-Michael Dyck

Received on Sunday, 17 September 2000 20:25:39 UTC