
tde.templateInfo( 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.
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.
declareUpdate();
var tde = require("/MarkLogic/tde.xqy");
var t1 = xdmp.unquote(`
<template xmlns="http://marklogic.com/xdmp/tde">
...
</template>`);
tde.templateInfo("t1.xml",t1);
// 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">
...
</template>"
}
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.