Loading TOC...

fn.root

fn.root(
   [$arg as Node?]
) as Node?

Summary

Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.

If $arg is the empty sequence, the empty sequence is returned.

If $arg is a document node, $arg is returned.

If the function is called without an argument, the context item is used as the default argument. If the context item is undefined an error is raised: [err:XPDY0002]. If the context item is not a node an error is raised: [err:XPTY0004].

Parameters
$arg The node whose root node will be returned.

Example

var doc = fn.head(xdmp.unquote('<a><quantity>5.0</quantity></a>')
    );
fn.root(doc);
=>
<?xml version="1.0" encoding="UTF-8"?>
<a><quantity>5.0</quantity></a>

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy