Skip Headers

Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher
Release 11g (11.1.1)
Part Number E13881-01
Go to Table of Contents
Contents
Go to previous page
Previous
Go to next page
Next

Understanding Subtemplates

This chapter covers the following topics:

What is a Subtemplate

A Subtemplate is a piece of formatting functionality that can be defined once and used multiple times within a single layout template or across multiple layout template files. This piece of formatting can be in an RTF file format or an XSL file format. RTF subtemplates are easy to design as you can use Microsoft Word native features. XSL subtemplates can be used for complex layout and data requirements.

Some common uses for subtemplates include:

About RTF Subtemplates

An RTF subtemplate is an RTF file that consists of one or more <?template:?> definitions, each containing a block of formatting or commands.

This RTF file, when uploaded to BI Publisher as a Sub Template object in the Catalog, can be called from within another RTF Template.

About XSL Subtemplates

An XSL subtemplate is an XSL file that contains formatting or processing commands in XSL for the BI Publisher formatting engine to execute. Use an XSL template to include complex calculations or formatting instructions not supported by the RTF standard.

This XSL file, when uploaded to BI Publisher as a Sub Template object in the Catalog, can be called from within an RTF Template.

Supported Locations for Subtemplates

It is recommended that you upload your subtemplates to the BI Publisher catalog. This is the most secure location.

For compatibility with older versions of BI Publisher, it is also possible to call a subtemplate that resides in a file on the local server, or on a different server (that can be accessed by HTTP protocol). Using one of these methods requires specific import syntax and server settings to allow the communication. See Calling a Subtemplate from an External Source for more information.

Designing a Subtemplate

For information on designing an RTF subtemplate, see Designing RTF Subtemplates.

For information on designing an XSL subtemplate, see Designing XSL Subtemplates.

Testing Subtemplates from the Desktop

If you have the BI Publisher Template Builder installed, you can preview the template and subtemplate combination before uploading them to the BI Publisher catalog. To test from your local environment, you must alter the import template syntax to enable the BI Publisher processor to locate the subtemplate file on your local directory. To test, enter the import template syntax as follows:

<?import:file:{local_template_path}?>

For example:

<?import:file:C:///Template_Directory/subtemplate_file.rtf?>

or for an XSL subtemplate file:

<?import:file:C:///Template_Directory/subtemplate_file.xsl?>

You can then select the Preview option in the Template Builder and the BI Publisher processor can locate your subtemplate and render it from your local environment.

Note that before you upload the primary template to the BI Publisher catalog, you must change the import syntax to point to the appropriate location in the catalog.

Creating the Sub Template Object in the Catalog

To upload your subtemplate file:

  1. On the global header click New and then click Sub Template. This launches an untitled Sub Template page.

  2. In the Templates region, click Upload to launch the Upload Template File dialog.

  3. Browse for and select your subtemplate file.

  4. Click Upload.

    Your subtemplate file will display in the Templates region as the locale name you selected (for example: en_US).

  5. Click Save. In the Save As dialog choose the catalog folder in which to save the Sub Template. Enter the Name and click Save. The following figure shows a Sub Template named "My Subtemplate":

    the picture is described in the document text

  6. (RTF Sub Templates only) If you are uploading multiple localized files, select the file that is to be used as the default. For more information on localization of template files, see Adding Translations to Your Sub Template.

    Note: You may upload only one RTF file per locale to a Sub Template definition. If you upload additional template files to this Sub Template, each file will be automatically named as the locale regardless of the name you give the file before upload.

    Important: Translations are not supported for XSL Sub Templates.

Note that the Sub Template object is saved with the extension ".xsb". You will use the Name that you choose here with the .xsb extension when you import the Sub Template object (for example: MySubtemplate.xsb).

Calling a Subtemplate from an External Source

This section describes how to call a subtemplate that resides outside the catalog.

Important: These instructions are provided for backward compatibility only. It is recommended that you place you subtemplates in the catalog.

Note that localization is not supported for subtemplates that are maintained outside the catalog.

Importing a Subtemplate Outside the Catalog over HTTP or FTP

Use a standard protocol, such as http or ftp and enter the import statement as follows:

<?import:http//myhost:8080/subtemplate.rtf?>

Importing Subtemplates Outside the Catalog on the Same Server

If your subtemplate is located on the server, but not in the BI Publisher catalog, enter the following:

<?import:file://{template_path}?>

where

template_path is the path to the subtemplate file on your server

For example:

<?import:file://c:/Folder/mySubtemplate.rtf?>

Required Settings To Run Subtemplates Stored Outside the Catalog

Using subtemplates requires the following FO processing configuration property setting for the report: