Loading TOC...


   $uri as xs:string,
   $root as node(),
   [$permissions as element(sec:permission)*],
   [$collections as xs:string*]
) as empty-sequence


This function validates the template, inserts the template as a document into the tde collection of the schema database (if executed on the content database) with the default permissions, and reindexes the database.

Note that, when a template is inserted, only those document fragments affected by the template are re-indexed. For more information, see Validating and Inserting a Template in the Application Developer's Guide.

$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.


xquery version "1.0-ml"; 
import module namespace tde = "http://marklogic.com/xdmp/tde" 
        at "/MarkLogic/tde.xqy";

let $template := 
<template xmlns="http://marklogic.com/xdmp/tde">
  <description>populates patients' data</description>

return tde:template-insert("Template.xml", $template)

(: Inserts the template as the Template.xml file. :)

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