This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4868 - [XPath] abbreviations for / and // syntactically incorrect
Summary: [XPath] abbreviations for / and // syntactically incorrect
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P4 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-19 07:03 UTC by Ryan Gustafson
Modified: 2007-11-16 11:58 UTC (History)
0 users

See Also:


Attachments

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.