[Bug 1225] New: description of / and // (editorial)

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1225

           Summary: description of / and //  (editorial)
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: davidc@nag.co.uk
         QAContact: public-qt-comments@w3.org


http://www.w3.org/TR/xquery/#id-path-expressions

describes / as

A "/" at the beginning of a path expression is an abbreviation for the initial
step fn:root(self::node()) treat as document-node() (this is true even if the
"/" is the entire path expression).

and // as

A "//" at the beginning of a path expression is an abbreviation for the initial
steps fn:root(self::node()) treat as document-node()/descendant-or-self::node()/. 


Note that the expansion of // ends with a trailing / and the expansion of / does
not. It would be more correct (I think) if it did end with a trailing slash
unless the / was the entire expression.

Alternatively (and perhaps better) neither expansion should end with a trailing
slash but the text should stress that the expansion is a complete step and in
particular a predicate is not allowed to follow.

For example

fn:root(self::node())[*]

is legal and selects root nodes that have a top level element.
but

fn:root(self::node())/[*]

is a syntax error.

I believe the intention (and the xquery grammar) is that

/[*]

is an error rather than selecting a root node that has an element child.

One more minor point that I wouldn't have commented on except that I noticed it
while pasting in the description of // above, the expanded example ends the
sentence and it would help if some indication that the following "." is part of
the sentence structure not part of the expression (there is a font change but
that's not easy to see on a ".") just inserting a space would probably be enough.


David

Received on Thursday, 7 April 2005 10:27:22 UTC