Publisherintermediate
Sub-Templates, Style Templates & Reusability
Explain how sub-templates and style templates promote reuse and consistency across many BI Publisher report layouts.
Fifty reports sharing a header means one logo change touching fifty templates — unless the shared parts are defined once.
It's like a company using a shared letterhead template for every department's correspondence instead of each department designing and hand-typing their own header from scratch — update the letterhead once, and every future letter from every department automatically uses the new version.
Key Concepts
1
A sub-template is a reusable RTF fragment.
<?import:xdoxsl:///Custom/common.xsb?>
<?call:companyHeader?>2
The sub-template holds named blocks:
3
<?template:companyHeader?>
... logo, address, registration number ...
<?end template?>4
<?template:legalFooter?>
... disclaimer ...
<?end template?>5
Change the address once and every report that calls it is correct.
6
Sub-templates can hold logic, not just layout. A formatting routine — rendering an amount in words for a
cheque, formatting an address block that varies by country — is defined once and called wherever needed.
7
That is the more valuable use, because logic duplicated across fifty templates diverges in ways a logo
cannot.
8
A style template handles appearance rather than content. Fonts, sizes, colours, table borders and
heading styles, applied across reports so they look like one organisation produced them.
9
sub-template shared content and logic
style template shared appearance10
Applying a style template to an existing report restyles it without touching its layout, which is what makes
a rebrand feasible.
11
Why this is asked. It is a maintainability question, and it separates someone who has built one report
from someone who has maintained a hundred.
12
The scenario is always the same: the legal disclaimer changes. With sub-templates it is one edit. Without,
it is opening every template, and the ones that are missed are the ones that go out.
13
The practical caution. A sub-template is a dependency. Changing it changes every report using it,
including ones nobody has looked at for two years.
14
So a sub-template change needs testing across its consumers, and knowing who those are means keeping track —
which is the small cost that comes with the large saving.
15
What the interviewer is probing.1. "What is the difference between a sub-template and a style template?" Probing: the
distinction. Stalls: "Nothing." Moves up: a sub-template holds reusable content and logic; a
style template holds shared formatting applied across reports.
16
2. "What is the maintenance argument?" Probing: the value. Stalls: "Less typing." *Moves
up:* a letterhead or disclaimer change is made once rather than in two hundred templates, which is
the difference between an hour and a project.
17
3. "How is a sub-template referenced?" Probing: the mechanics. Stalls: "By name." *Moves
up:* imported by its catalog path and called by template name, so it must be deployed before the
parent runs.
18
4. "What is the deployment gotcha?" Probing: the practical angle. Stalls: "None." *Moves
up:* the path is environment-specific, so a migration that moves folders breaks every report
referencing it.