tde:template-insert( $uri as xs:string, $root as node(), [$permissions as item()*], [$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.
tde-admin
role is required in order to insert a template into the
schema database.
Note that, unlike the other tde
functions, 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> <context>/MedlineCitation/Article</context> <rows> <row> <schema-name>Medical</schema-name> <view-name>Publications</view-name> <columns> <column> <name>ID</name> <scalar-type>long</scalar-type> <val>../MedlineID</val> </column> <column> <name>ISSN</name> <scalar-type>string</scalar-type> <val>Journal/ISSN</val> </column> </columns> </row> </rows> </template> return tde:template-insert("Template.xml", $template) (: Inserts the template as the Template.xml file. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.