Loading TOC...

MarkLogic 10 Product Documentation
xp:dereference

xp:dereference(
   $context as node(),
   $xpointer as xs:string
) as node()*

Summary

This function resolves an XPointer in the context of a particular node.

Parameters
context The node against which the XPointer evaluates.
xpointer An XPointer.

Example

  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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.