Loading TOC...


   $path as String,
   [$bindings as Object]
) as Sequence


This is inherited from the Node object.

Evaluate an XPath using the node as context.

$path The XPath to evaluate.
$bindings Namespace bindings to use to interpret the XPath. The key is the prefix and the value is the namespace URI.

Required Privileges


Usage Notes

The path is evaluated in the context of the current node, but it may be any valid XPath. Rooted paths will be confined to the current document, but they will not be confined to the subtree rooted at the current node. For example, the node.xpath("/title") will return the node <title>Here</title> regardless of which child of the following document the xpath method is called on:

     More stuff

To get the subtitle of the subsection element, one would need to use the path ./title from the subsection element node.

Valid XPaths include more than just path expressions: arithmetic expressions, function calls, and so on are valid as well.


var node = fn.head(cts.search("example"));
node.xpath("ex:section/ex:title", {"ex":"http://example.com/ns"})


  • xpath across the DB: new NodeBuilder().addNull().toNode().xpath('fn:collection()/some/path')
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy