Loading TOC...


   $sibling as node(),
   $new as node()
) as empty-sequence()


Adds an immediately following sibling to a node.

$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.



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


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • Is there a way to add an empty attribute (boolean attribute)? The following inserts myattr="" and I just want myattr by itself. xdmp:node-insert-after(fn:doc($blah)/form/@class, attribute myattr {})
    • There is no such thing in XML as an attribute with no value. You can, as you observed, create one whose value is an empty string, but you can't just leave the value off entirely. That's part of the XML standard. See, for example, https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-starttags.