Customizing Document Templates
Oxygen XML Developer allows you to customize certain aspects of predefined or custom document templates. For example, you can customize the icons or specify a prefix/suffix that will be used for the proposed file name in the New document wizard.
Customizing the Icons for a Document Template
- Create a new properties file or edit an existing one.
- If you create a new properties file, use the same name as the template file except
with a .properties extension (for example,
MyTemplate.properties). This properties file will specify the
paths to the icons that will be used in the new file wizard. You can find some
examples in the templates directory of the Oxygen XML Developer installation directory to help you get started. When defining the icons, the properties file should look like this:
type=general smallIcon=../icons/Article_16.png bigIcon=../icons/Article_48.png
Important: For DITA files, thetypeproperty needs to be set to dita. Otherwise, the template will not appear in the dialog box for creating new DITA topics. For all other types of files, set it to general. The icons specified in this properties file will only be used for the new file wizards and not in any other part of the interface.Note: If you created a new template and chose to use a custom directory for the new template (in step 2 of the new template procedure), make sure the path to the icons is relative to that directory. - If you edit an existing template, simply define the icon paths as specified above.
- If you create a new properties file, use the same name as the template file except
with a .properties extension (for example,
MyTemplate.properties). This properties file will specify the
paths to the icons that will be used in the new file wizard. You can find some
examples in the templates directory of the Oxygen XML Developer installation directory to help you get started.
- Save the properties file in the same directory as the document template.
- Open the new file wizard () and you should see your custom icons next to the document template in the appropriate folder.
Add a Prefix or Suffix to File Names for a Document Template
- The new document dialog box that appears when you
click the
New button on the toolbar (or ). The prefix or suffix is added to the name of the file in the
Save as field. - The new document dialog box that appears when you select from the contextual menu in the Project view. The prefix or suffix is added to the name of the file in the File name field.
- Create a new properties file or edit an existing one.
- If you create a new properties file, use the same name as the template file except
with a .properties extension (for example,
MyTemplate.properties). This properties file will specify the
prefix/suffix that will be used to propose the file name in the new file wizards.When defining the prefix/suffix, the properties file should look something like this:
type=general filenamePrefix=prod_ filenameSuffix=_test
Important: For DITA files, thetypeproperty needs to be set to dita. For all other types of files, set it to general. - If you edit an existing template, simply define the prefix/suffix as specified above.
- If you create a new properties file, use the same name as the template file except
with a .properties extension (for example,
MyTemplate.properties). This properties file will specify the
prefix/suffix that will be used to propose the file name in the new file wizards.
- Save the properties file in the same directory as the document template.
- Open the new document wizard (using the methods described above) and when you select the appropriate template, you should see your prefix or suffix in the file name that is proposed in that dialog box.
Configure the Displayed Names for Document Templates
- Create a new properties file or edit an existing one. If you create a new properties file, use the same name as the template file except with a .properties extension (for example, MyTemplate.properties).
- Add a
displayNameproperty in the properties file:displayName=myTemplateNameTip: The names for framework-specific document templates (such as DITA Topic or DocBook Article as you would see in the Framework templates section in the New file wizard) can be translated via the internationalization support. In this case, the properties file should contain something like:displayName=${i18n(tag)}where tag refers to an entry in the translation.xml file for that specific framework (for example, OXYGEN_INSTALL_DIR/frameworks/dita/i18n/translation.xml for DITA).
- Save the properties file in the same directory as the document template.
- Open the new file wizard () and you should see the new name for the template.
Adding Placeholders or Hints in a Document Template
Document templates sometimes contain empty elements and it may not be clear to the Author what should be inserted. You can define placeholders in document templates that provide hints for Authors to help them understand what type of content should be added in any particular empty element within the document. The placeholder text is specified using a processing instruction and the placeholders are removed when the Author inserts content in the corresponding element.
- Edit the document template.
- Add placeholders in the form of processing instructions within the elements where you
want hints to be displayed when an Author creates a document from the template. For
example:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"> <topic id="pi"> <title><?oxy-placeholder content="Please give a title"?></title> <shortdesc><?oxy-placeholder content="Writing short descriptions induces the writer to clarify the main thesis of the topic. We recommended a 50 word limit."?></shortdesc> <body> <p><?oxy-placeholder content="A paragraph element should be a self-contained unit dealing with one idea or point."?></p> </body> </topic>
- Save the template file.
- Use the New document wizard to create a new document using your customized template and you should see the hints in the opened document.