W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2016

[Bug 29628] 16.2.1 fn:for-each - proposal of more succinct rules

From: <bugzilla@jessica.w3.org>
Date: Wed, 25 May 2016 14:13:03 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29628-523-lJAtsytVax@http.www.w3.org/Bugs/Public/>

--- Comment #6 from Michael Kay <mike@saxonica.com> ---
>I think the semantics of the map operator (!) and the path operator (/) cannot
be defined in terms of an XQuery function, because the operator semantics
involve a resetting of the inner focus.

You're right that this would need some new machinery, but it could be done if
we really wanted to. For example one could use the approach of the XQuery 1.0
formal semantics which rewrites references to ".", position() and last() in
terms of variables. But rewriting "!" as a FLOWR expression is probably a
better way of formalising the spec:

Then A!B ==> 

let $last := count(A)
for $position in 1 to $last
let $dot := A[$position]
return B

But you have to be careful with these variables because of course there can be
nested changes of focus, so it's certainly non-trivial.

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 25 May 2016 14:13:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 25 May 2016 14:13:06 UTC