Loading TOC...

dls:node-expand

dls:node-expand(
   $node as node(),
   $restriction as cts:query?
) as node()

Summary

This function recursively examines the node for XInclude references and expands them, following the rules of the XInclude specification. The result is a node in which all the XInclude references have been resolved, or an error if there were unresolvable references with no fallback specifications. The URIs are mapped according to the specified restrictions.

Parameters
node The node to be expanded.
restriction Restriction that control which documents may be considered for inclusion. An exact URI match is first considered if it matches the specified restrictions, followed by the most recent numbered version of that URI that matches the restrictions.

Required Privileges

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Usage Notes

This function cannot expand root node documents that contain XInclude links to specific versioned documents. You must use xinc:node-expand to expand such documents.

Example

  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  let $node := fn:doc("/foo/bar/baz.xml")

  return dls:node-expand(
               $node, 
               dls:as-of-query(xs:dateTime("2009-04-06T09:39:33.576-07:00")))

  (: Returns the contents of the 'baz.xml' document version that was created 
     before the specified date, along with all of its referenced nodes. :)
    

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