[Bug 29959] [xq31] fn:put()

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

--- Comment #12 from Michael Kay <mike@saxonica.com> ---
If we're going to retain fn:put(), I think it should return something, so that
clean semantics at least become possible. I don't think many XQUpdate 1.0
applications are going to run without change so compatibility isn't too much of
a concern; but perhaps we should rename the function just in case (e.g.
fn:new-doc()).

I suggest that the function should return the URI supplied as the argument. It
then becomes available in use cases like

function f:chap($chap as element(chapter)) as element() {
  <a href="{new-doc($chap, $chap/shortName)}">{$chap/title}</a>
}

Because the result here is used to create a node of a document which itself
forms an output of the query, it's not too difficult to manage the side-effect
problem. As with xsl:result-document, we should be explicit that the URI must
not be the same as the URI of any "available document" in the dynamic context
(so you can't write and read a document in the same execution scope) and make
the effect of writing the same URI twice implementation-defined (in XSLT it's a
dynamic error).

Having said all that, I'm not comfortable with adding this. The semantics are
difficult and it's going to take us weeks of discussion to iron out the
glitches. As a WG, we're not good at sweeping our rubbish under the carpet, and
unless we're prepared to compromise our usual high standards this is not going
to be done quickly.

An alternative would simply to be to recommend that implementors should
implement file:write() from the EXPath File module.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 15 November 2016 00:24:52 UTC