XSL-FO Designer for Apache FOP

bcl_716964462.htm

15. The base template

The base template file can be set in in the report properties. The base template is a report like any other and it has to be located in the current workspace since it will be used while generating the output xsl-fo.



The purpose of base template is to reuse report areas, this allows for example having a template file which defined the company data in the page header. This template can be shared by all other reports.
Only the following base template 3 areas will be used while generating the XSL-FO output:

  • The page header of the base template will be used only if the current report does not contain any field in the page header.
  • The same apply to the page footer.
  • The background area of the base template will always be used and merged with the background area of the current report.


The example BaseTemplate.xre shows how to use it to create a common header for all company reports:


The example contains the company data in the page header and the page number in the page footer. This template has been used in the Letter.xre report. If you run the report you will see the page header being added to the PDF from the base template:


Usually base templates will contain only constant data. Even then, you can still test the report by using any XML file. The designer always requires a test XML file to be select in order to run the report, in this case you can select any XML file, then you can view the output of the base template.