
xp:dereference( $context as node(), $xpointer as xs:string ) as node()*
This function resolves an XPointer in the context of a particular node.
| Parameters | |
|---|---|
| context | The node against which the XPointer evaluates. |
| xpointer | An XPointer. |
xquery version "1.0-ml"
import module namespace xp = "http://marklogic.com/xinclude/xpointer"
at "/MarkLogic/xinclude/xpointer.xqy";
let $node :=
<root xmlns="http://marklogic.com/myns">
<this>
This is text before the referenced element.
<that>The referenced element.</that>
This is text after the referenced element.
</this>
</root>
return
xp:dereference($node,
"xmlns(ns=http://marklogic.com/myns) xpath(//ns:this/ns:that)")
===> <that xmlns="http://marklogic.com/myns">The referenced element.</that>
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.