Loading TOC...

dls.linkExpand

dls.linkExpand(
   $context as Node,
   $ref as element(xi.include),
   $restriction as cts.query?
) as Sequence

Summary

This function performs a single level expansion of a single XInclude reference. Any XInclude references in the referenced node are not expanded.

Parameters
$context The node that contains the XInclude reference.
$ref The XInclude reference 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

Example

// Returns the first referenced node in the 'BOOK' element in the 
// latest version of the 'baz.xml' document.

const dls = require('/MarkLogic/dls');

let node = cts.doc('/foo/bar/baz.xml');

dls.linkExpand(node, 
               node.xpath('/BOOK/xi:include[1]', {'xi': 'http://www.w3.org/2001/XInclude'}), 
               null);

   

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