[Bug 13970] New: [UPD] fn:put and transform expressions

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13970

           Summary: [UPD] fn:put and transform expressions
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Update Facility
        AssignedTo: jonathan.robie@gmail.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


Are there any special considerations when mixing fn:put with transform
expressions?

Example 1
---------

copy $dummy := <dummy />
modify fn:put(<new-document />, "output.xml")
return local:non-updating-query()

This stores an element in output.xml but also returns the result of executing a
non-updating query.  

It seems a little unfortunate that this 'dummy' is required to mix fn:put with
a non-updating query - although since this is essentially an expression with
side effects, perhaps that's no bad thing.

Example 2
---------

let $original := doc('update.xml')
return
  copy $doc := $original
  modify (insert node <node /> into $doc/nodes, fn:put($doc, "update.xml"))
  return $original

This example reads and writes the same resource.  In XSLT, there is a specific
(recoverable) error which mentions a similar situation with
xsl:result-document.

[ERR XTRE1500] It is a recoverable dynamic error for a stylesheet to write to
an external resource and read from the same resource during a single
transformation, whether or not the same URI is used to access the resource in
both cases. 

Example 3
---------

copy $doc := doc('update.xml')
modify (insert node <node /> into $doc/nodes, fn:put($doc, "update.xml"))
return (count($doc/nodes/node), count(doc('update.xml')/nodes/node))

Because 'doc' is stable the two calls to doc must return the same result, even
though an update has occurred.

Example 4
---------

copy $doc := <a />
modify (fn:put($doc, "update.xml"))
return doc('update.xml')

Does doc('update.xml') see the newly created resource, or the original resource
(if we assume one was available)?

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 30 August 2011 12:53:57 UTC