NodeProxy diffProxy = (NodeProxy) nv;
DocumentImpl diff = diffProxy.getDocument();
MemTreeBuilder builder = context.getDocumentBuilder();
DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
Patch patch = new Patch(context.getBroker(), diff);
if (isCalledAs("annotate"))
patch.annotate(reader, receiver);
else
patch.patch(reader, receiver);
NodeValue result = (NodeValue) builder.getDocument().getDocumentElement();
return result == null ? Sequence.EMPTY_SEQUENCE : result;
} catch (IOException e) {
throw new XPathException(this, e.getMessage(), e);
} catch (XMLStreamException e) {