I'm putting together a function which updates a single element in an xml
file, however I'm getting an error I'm not sure how to deal with.
(WARNING, INCOMING EVAL)
define function update($uri as xs:string, $path as xs:string, $value as
item())
{
let $old-node := xdmp:eval(concat('doc("', $uri, '")', $path))
let $new-node := element { tokenize($path, "/")[last()] } { text {
$value } }
return
xdmp:node-replace($new-node, $old-node)
}
When I run something like:
update('/path/to/file.xml', '/path/to/element', 'new value')
$old-node should be doc("/path/to/file.xml")/path/to/element
$new-node should be <element>new value</element>
I get:
XDMP-UPCONSTNODES: Cannot update constructed nodes
What's strange is if I replace the $new-node and $old-node variables
with their assigned values above, that same call gets me:
XDMP-UPEXTNODES: Cannot update external nodes
What am I missing here?
Eric
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general