This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
In the "XQuery 1.0: An XML Query Language W3C Candidate Recommendation 3 November 2005" specs I found the following: according the EBNF spec (http://www.w3.org/TR/xquery/#nt-bnf) the following construct is possible for selecting an element "A" using an Xpath expression: .../<A/>/... or .../<A>content</A>... wher it should be .../A/... <A/> or <A>content</A> are a DirElemConstructor [96]. Following the EBNF path upwards I found DirElemConstructor [96]> DirectConstructor [95]> Constructor [94]> PrimaryExpr [84]> FilterExpr [81]> StepExpr [69]> RelativePathExpr [68]. The last one contains on or more '/' which creates this strange construct. regards, wim de vries
Why is that a problem? The meaning of /a/b/<c/> is that for every b under an a, a new c is created. E.g., it is the same as for $i in /a/b return <c/>
ok. But that means selection and return control are in one statement. What would then mean /a/b/<c/>/d/e
(In reply to comment #2) > ok. But that means selection and return control are in one statement. > What would then mean /a/b/<c/>/d/e > it selects nothing as <c/> has no d children but /a/b/<c><d><e/></d></c>/d/e would select one (newly created) e node for each /a/b node selected from the original context. It looks odd, but just think of each step as being a function returning some sequence of nodes, and think of <c>....</c> as being a function that returns a sequence of one new node, and it all works out in the end.
This does not seem to be comment on Formal Semantics proper, but on XQuery 1.0 semantics in general. XQuery 1.0 allows arbitrary expressions on the each side of the '/', the semantics is well defined, although sometimes odd for certain cases. - Jerome
Dear Wim The WG took a look at your questions and thinks that Michael's and David's answers provide you with the correct explanations. Since it does not lead to a change in the specifications, we will mark it as invalid. If you agree with our resolution, please mark the bug as closed. If you disagree, please reopen. Thanks Michael (speaking for the WG)