Configuring New File Templates

Describes how to create a set of document templates that the content authors will use as a starting point for creating books and articles.

Each Document Type Association can point to a directory, usually named templates, that contains the file templates. All files found here are considered templates for the respective document type. The template name is taken from the file name, and the template type is detected from the file extension.

  1. Go to your custom framework directory ([OXYGEN_INSTALL_DIR]\frameworks\[CUSTOM_FRAMEWORK_DIR]) and create a directory named templates.
    The directory tree of the documentation framework should be something like this:
    [OXYGEN_INSTALL_DIR]
        frameworks
            [CUSTOM_FRAMEWORK_DIR]
                schema
                css
                templates
  2. In the templates directory, create two files. A file for the book template and another one for the article template.

    An example for the Book.xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <book xmlns="http://www.oxygenxml.com/sample/documentation" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:abs="http://www.oxygenxml.com/sample/documentation/abstracts">
        <title>Book Template Title</title>
        <section>
            <title>Section Title</title>
            <abs:def/>
            <para>This content is copyrighted:</para>
            <table>
                <header>
                    <td>Company</td>
                    <td>Date</td>
                </header>
                <tr>
                    <td/>
                    <td/>
                </tr>
            </table>
        </section>
        </book>

    An example for the Article.xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <article 
        xmlns="http://www.oxygenxml.com/sample/documentation" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <title></title>
        <section>
            <title></title>
            <para></para>
            <para></para>
        </section>        
    </article>

    You can also use editor variables in the content of the template files and they will be expanded when the files are opened.

    Note

    You should avoid using the ${cfd},${cf},${currentFileURL}, and ${cfdu} editor variables when you save your documents in a data base.

  3. Open the Document Type configuration dialog box for your custom framework and click the Templates tab. In the Templates directory text field, introduce the ${frameworkDir}/templates path. It is recommended that all the file references made from a Document Type Association to be relative to the ${frameworkDir} directory. Binding a Document Type Association to an absolute file (e. g.: C:\some_dir\templates) makes the association difficult to share between users.
  4. To test the templates settings, go to FileNew to display the New document dialog box. You should see the new templates in the folder for your custom framework (in the Framework templates section). The names of the two templates are prefixed with the name of the framework. Selecting one of them should create a new XML file with the content specified in the template file.

Was this helpful?