Bug 4868 - [XPath] abbreviations for / and // syntactically incorrect
: [XPath] abbreviations for / and // syntactically incorrect
Status: RESOLVED FIXED
Product: XPath / XQuery / XSLT
XPath 2.0
: Recommendation
: PC Windows XP
: P4 normal
: ---
Assigned To: Don Chamberlin
: Mailing list for public feedback on specs from XSL and XML Query WGs
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2007-07-19 07:03 UTC by Ryan Gustafson
Modified: 2007-11-16 11:58 UTC (History)
0 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Gustafson 2007-07-19 07:03:26 UTC
In the version found at http://www.w3.org/TR/xpath20/#id-path-expressions

The statements which indicate to sometimes abbreviate / as
fn:root(self::node()) treat as document-node()/ and // as fn:root(self::node())
treat as document-node()/descendant-or-self::node() are not syntactically
correct.

My own parser, as well as the parser at
http://www.w3.org/2006/11/applets/xpathApplet.html refuse to parse such input.

The Formal Semantics http://www.w3.org/TR/xquery-semantics/#id-path-expressions
indicate a parenthesized version of the same construct.

Are the Formal Semantics are correct and XPath needs to be corrected?
Comment 1 Michael Kay 2007-07-19 08:49:59 UTC
Personal response: Yes, I think you're right.

fn:root(self::node()) treat as document-node()/X

does not parse because the expression on the lhs of "/" must be a StepExpr, and
a TreatExpr is not a StepExpr. It needs to be parenthesized.
Comment 2 Don Chamberlin 2007-07-31 17:40:35 UTC
On July 31, 2007, the Query and XSLT working groups agreed to add parentheses
to the expansions of leading-/ and leading-// in path expressions, as suggested
by this bug report. The revised expansions will appear in a future errata
document.
Regards,
Don Chamberlin (for the joint working groups)
Comment 3 Michael Kay 2007-11-16 11:58:04 UTC
The agreed change will be published in Erratum XP.E3 for XPath, XQ.E3 for
XQuery.


  翻译: