Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp:node-insert-after

xdmp:node-insert-after(
   $sibling as node(),
   $new as node()
) as empty-sequence()

Summary

Adds an immediately following sibling to a node.

Parameters
sibling The sibling node to be followed by the new node.
new The new node to be inserted.

Usage Notes

Attribute nodes cannot be followed by non-attribute nodes. Non-attribute nodes cannot be followed by attribute nodes. Element nodes cannot have document node children. Document nodes cannot have multiple roots. On-the-fly constructed nodes cannot be updated.

Example

  xdmp:document-insert("/example.xml",
    <a><b>bbb</b></a>);
  xdmp:node-insert-after(doc("/example.xml")/a/b,
    <c>ccc</c>);
  doc("/example.xml")
 =>
  <a><b>bbb</b><c>ccc</c></a>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.