29. template

<template
  name = non empty token
  location = anyURI
  category = one or more category segments separated by '/' : configuration name
  order = int : 100
/>

Add document template named name, contained in file location, to the dialog box displayed by the FileNew dialog box.

Specifying a template element without a location may be used to remove template element having the same name and the same category from this category.

Optional attributes category and order allow to better organize the content of the FileNew dialog box.

category

Specifies the category of the document template. A category consists in one or more segments separated by character '/'. By default, the category of a document template is the name of the configuration in which this template has been specified.

order

Specifies the relative order of the document template within its category. Default value is 100.

Example 1:

<template name="Slides" 
          location="template/slides.xml" />

The above template is specified in the configuration named "Slides", hence its category is by default "Slides" and its order is by default 100.

Example 2:

<template name="Map" location="template/v1.1/dtd/map.ditamap" 
          category="DITA/1.1" order="100" />

<template location="template/v1.1/dtd/template.ditaval" name="DITAVAL"
          category="DITA/1.1" order="1000" />

The first above template is specified in the configuration named "DITA Map" and the second one in the configuration named "DITAVAL". Despite the fact that the two above templates are specified in different configurations, the FileNew dialog box will display them in the same category "DITA/1.1" and template "DITAVAL" will follow template "Map".

Example 3:

<template name="DITAVAL" category="DITA/1.1"/>

Remove template "DITAVAL" from category "DITA/1.1".

Specifying composite document templates

Composite document templates, that is, modular document templates and/or document templates referencing graphics files, must be packaged in a .zip archive. Example: modular_book.zip:

$ unzip -v modular_book.zip
modular_book.xml
chapter1.xml
chapter2.xml
chapter3.xml
appendix.xml
images/
images/xmlmind.gif

The master document, modular_book.xml in the above example:

  1. Must be directly contained in the archive (that is, not in a subdirectory like images/),

  2. Must have the same basename, extension not included, as the archive. The basename, less the extension, is "modular_book" in the above example.