Loading TOC...


   uri as String,
   root as Node,
   [permissions as Object[]],
   [collections as String[]]
) as Object


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.

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. When supplying null as permissions parameter, the inserted template will have the default set of permissions.
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.


var tde = require("/MarkLogic/tde.xqy");
var t1 = xdmp.unquote(`
 <template xmlns="http://marklogic.com/xdmp/tde">

// or with permissions and collections
// tde.templateInfo("t1.xml",t1,[xdmp.permission("role1", "update")],["collectionA"]);

=> {
"uri": "t1.xml", 
"template": "<?xml version=\"1.0" encoding="UTF-8"?>\n<template xmlns="http://marklogic.com/xdmp/tde">

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