A template defines structure, layout, and content of the
document.
Review the general template process overview:

Planning the template
- Determine the requirements of the document before you start designing
your template. You can then prioritize the requirements and determine
the amount of information to be extracted.
- Consider which output type you prefer for your final generated
document. The template you design might look different when it is
generated into different output types. If you know which output type
you must create, you can select elements that are supported for that
output type. Or, vice versa, you can select the elements to include
in the template, and pick an output type that best displays those
elements.
- Think about a modular approach to designing templates. You create
templates for small portions of your document and merge them to create
one document. For example, you can have a table of contents template,
front cover template, data template, index template and back cover
template. These templates can be reused in generating different documents.
- Determine the number of templates needed given these requirements.
You can name and describe each template block in the metadata attributes.
The name content displays in the template, and the description content
displays in the template element hint field.
Building the template
- Implement the overall structure of the template using a top-down
approach. Try and incorporate approximately 80% of the requirements
in the first few iterations. Polish the details and add more detailed
requirements one by one. Leave less important details or difficult
ones to implement later. Consider the relevance of requirements that
are difficult to realize, like you would in a cost-benefit analysis.
You can also use scripting to extract information in a form that Rational® Publishing Engine can
efficiently consume. Do not get caught up in details regarding formatting
until the data is correctly generated into the document output.
- A template can be designed to provide specific page layout properties,
such as the page size, orientation, margins, number of columns, and
styles for the types of paragraphs that are most likely to be used
in the specific type of document.
- A template can contain:
- Document structure elements, such as paragraphs, tables, lists,
and a table of contents.
- Document layout blocks, such as master pages, style sheets, headers,
and footers.
- Internal and external user defined styles, such as text or paragraph
formatting. Text formatting includes bold, italic, underline, font
size, and font color. Paragraph formatting includes margins, borders,
indentation, and scripting parameters in the form of Javascript.
- Embedded template content, such as images, static text, and references
to static files and style sheets.
- Data elements, such as attributes, conditions, and dynamic data
elements.
- Data extraction in the form of queries and filters.
- External variables that receive values at run time and internal
variables that are used for calculations. Creating
external variables is preferable to hardcoding data source URLs in
your template. If you hardcode URLs and the server name changes, then
you must update the URLs in every template. With external variables,
you can override the URLs at run time. For templates that are embedded
in other products, use the special variables that are recognized by
those products when they are referencing data.
Testing the template
- Testing is done incrementally during development. Save often and
save with unique names. Verify the output frequently using a small
set of test data. Do not add more elements until what you already
have is working.
- After developing most of the document, perform load testing to
check for performance issues. Use the Preview tool to limit the size
of the data being used. The generated report is still accurate, but
runs more quickly because the default maximum records per query that Rational Publishing Engine retrieves
is 10 records. When testing conditions, it is possible that no record
from the first 10 matches the condition. In this case, use the Run
tool instead of the Preview tool or change the value for the maximum
records per query in the Preferences.
- Test the template in different output formats. You might find
that one output type does not display your template as well as another
output type.
Storing the template
- Save the developed and tested templates on a central file server.
You can use the template library as a storage location.
- Make sure to provide some information in the template metadata
so others know how to reuse the template. Some sample data and sample
document specification information for the project data helps in effectively
reusing these templates.