Hi Hans-Peter,
I guess for the moment you could also use XQuery Update to achieve this behaviour with replace() - perhaps Lukas has a quick snippet for you?
Unfortunately the replace expression in XQuery Update does not operate on document nodes [1].
Using delete/insert as a workaround won't help as well, as document nodes are to be replaced by their child elements during the update process [2]. As a result, you will loose the document information.
Sorry that I can't help you with this ...
Regards, Lukas
[1] http://www.w3.org/TR/xquery-update-10/#id-replacing-node
[2] http://www.w3.org/TR/xquery-update-10/#id-insert (section 1.) "If the insertion sequence contains a document node, the document node is replaced in the insertion sequence by its children."