This page was generated
July 7, 2010
4:03 PM
XQuery Built-In and Modules Function Reference

Module: Modular Documents - XPointer Functions

This is the XPointer module, which is used with the modular documents CPF application.

To use the XPointer module as part of your own XQuery module, include the following line in your XQuery prolog:

import module namespace xp = "http://marklogic.com/xpointer" at "/MarkLogic/xinclude/xpointer.xqy"

The library namespace prefix xp is not predefined in the server.

Function Summary
xp:dereference This function resolves an XPointer in the context of a particular node.
Function Detail
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>