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.


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

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