Chapter 10. Templates

Table of Contents
10.1. Using templates to create new documents
10.2. Using templates when opening a document
10.3. Creating new templates
10.4. Using multiple templates for the same document type
10.5. Templates for DTDless XML documents

Document templates are files that contain additional information about classes of documents. If you work with a certain DTD, for example the DocBook DTD, and create and edit DocBook documents, there will be a template that is used by epcEdit for your DocBook documents. If you work with a second DTD, for example the TEI DTD, another template will be used by epcEdit for your TEI documents.

Document templates are used by epcEdit for two purposes:

The benefit of this approach is that the required information has to be provided only once: After a template has been defined, it can be used to create any number of new documents for the given document type just by selecting the template from the list of available templates.

A template is not required to open an existing document. If epcEdit can not find a matching template for your document, it will use default style sheet settings for displaying the document. However, if you add style sheet settings for a document that was opened without a template, epcEdit will offer to create a new template for this document class when the document is closed.

10.1. Using templates to create new documents

When a new document is created, you choose a template for the new document from the list of existing templates. Before the new document is created, epcEdit will read the template file and extract the following information:

This information is combined into the prolog for the new document. If the document is a valid XML or SGML document, epcEdit will load the DTD for the document. If the document is a wellformed XML document, epcEdit will initialize an empty DTD that contains only the name of the document element.