Hello there,
Please go through the document of how to use subtemplate
There are two entries that you must make to call a subtemplate from a main template.
To implement the subtemplate in a main template, you must make two entries in the main template:
First, import the subtemplate file to the main template. The import syntax tells the BI Publisher engine where to find the Sub Template in the catalog.
Second, enter a call command to render the contents of the subtemplate at the position desired.
Importing the Subtemplate to the Main Template
Enter the import command anywhere in the main template prior to the call template command.
If you do not require a locale, enter the following:
<?import:xdoxsl:///path to subtemplate.xsb?>
where
path to subtemplate.xsb is the path to the subtemplate .xsb object in the catalog.
For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?>
Note:
If the subtemplate resides in a personal folder under My Folders, the command to import the subtemplate is:
<?import:xdoxsl:///~username/path to subtemplate.xsb?>
where username is your user name.
For example, if user myuser uploads a subtemplate called Template1 to a folder called Subtemplates under My Folders, the correct import statement is:
<?import:xdoxsl:///~myuser/Subtemplates/Template1.xsb?>
Calling the Subtemplate to Render Its Contents
You can also enter a call command to render the contents of the subtemplate at the position that you desire.
To call the subtemplate to render its contents:
The following figure illustrates the entries required in a main template:
Importing a Localized Subtemplate
To designate the locale of the imported subtemplate, append the locale to the import statement as shown here.
<?import:xdoxsl:///{path to subtemplate.xsb}?loc={locale_name}?>
where
path to subtemplate.xsb is the path to the subtemplate .xsb object in the catalog
and
locale_name is the language-territory combination which comprises the locale. The locale designation is optional.
For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?loc=en-US?>
Note that you can also use ${_XDOLOCALE} to import a localized subtemplate based on the runtime user locale. For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?loc=${_XDOLOCALE}?>
Example
In this example, your company address is a fixed string that is displayed in all your templates. Rather than reproduce the string in all the templates, you can place it in one subtemplate and reference it from all the others.
To place the string in a subtemplate and reference it:
At runtime the contents of the MyAddress subtemplate are fetched and rendered in the layout of the main template.
Thanks for reading.
Thanks for reading.
No comments:
Post a Comment