xdmp:node-insert-before( $sibling as node(), $new as node() ) as empty-sequence()
Adds an immediately preceding sibling to a node.
Parameters | |
---|---|
sibling | The sibling node to be preceded by the new node. |
new | The new node to be inserted. |
(: create a document :) xdmp:document-insert("/example.xml", <a><b>bbb</b></a>); (: add a c node before the b node :) xdmp:node-insert-before(fn:doc("/example.xml")/a/b, <c>ccc</c>); (: look at the new document :) fn:doc("/example.xml") => <?xml version="1.0" encoding="UTF-8"?> <a><c>ccc</c><b>bbb</b></a>