Loading TOC...

MarkLogic 10 Product Documentation
tde:template-info

tde:template-info(
   $uri as xs:string,
   $root as node(),
   [$permissions as element(sec:permission)*],
   [$collections as xs:string*]
) as map:map

Summary

This function returns a map:map (object[]) containing individual template information used for inserting templates with tde:template-batch-insert(). Permissions and collections are optional. If no permissions specified, xdmp:default-permissions() is the default.

Parameters
uri The URI of the template document to be inserted.
root The template document. The template document can be in either JSON or XML format.
$permissions Any permissions to set on the template document.
collections One or more collections in which to insert the template document.

Usage Notes

The tde-admin role is required in order to insert a template into the schema database.

Note that this is a library function that requires that you import the tde.xqy module.

Example

xquery version "1.0-ml";
import module "http://marklogic.com/xdmp/tde" at "/MarkLogic/tde.xqy";
let $t1 :=
<template xmlns="http://marklogic.com/xdmp/tde">
  ...
</template>
return
  tde:template-info("t1.xml", $t1),
  (: or with permissions and collections
    tde:template-info("t1.xml",$t1,(xdmp:permission("role1","update")),("collectionA"))
  :)

=> 
<map:map xmlns:map="http://marklogic.com/xdmp/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <map:entry key="uri"><map:value xsi:type="xs:string">t1.xml</map:value></map:entry>
 <map:entry key="template"><map:value>
   <template xmlns="http://marklogic.com/xdmp/tde">
    ...
   </template></map:value></map:entry>
</map:map>

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