Re: Abbreviated Syntax "//"

At 10:07 PM 9/15/2003, Emerson wrote:


>Ive just noticed something that hasn't bothered me in the past due
>mainly to an omission on my part.  In implementing some Xpath 2.0
>features into my now hybrid 1.0 processor I noticed that according to
>both specifications;
>
>http://www.w3.org/TR/xpath20/#abbrev
>
>The abreviated, location path in 1.0 speak, or path expression in 2.0
>language  i.e. "//"
>Is actually interpreted as "    " rather than
>"/descendant-or-self::node()"
>
>I beg to ask, why the trailing slash "/" ?

To make it possible to say both:

    //foo
     =>  /descendant-or-self::node()/foo

and:

    //@foo
     => /descendant-or-self::node()/@foo

>This forces the abreviated syntax to have a following step, when there
>is a perfectly valid reason for wanting to use "//" alone.

I assume that the semantics you want are the same as this:

         //node()

Of course, you might have some other semantics in mind, but I'm pretty sure 
what you want can be expressed in the current language.

>I don't like to deviate, but this is one part of the grammar that I
>don't think I will be enforcing...

Then you might not be completely conformant with the spec. There's no law 
against that, but it leads to interoperability problems, and you might want 
to consider whether you can simply document how your users can express the 
semantics you want to associate with '//'. Especially if you need to be 
able to advertise that you conform to our specs.

Jonathan

Received on Tuesday, 16 September 2003 15:07:21 UTC