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

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29628

--- 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