Next / Previous / Contents / NM Tech homepage

6. Title page customization: XSLT that builds XSLT

Before we move on to the details of our customization layer, let's look at one of the less obvious parts of the process, title page customization.

The term “title page” is a slight misnomer. There is no guarantee that this material will be on a separate page—just that it will be presented first in the document.

Before reading this section, you should read and understand Stayton's chapter 10, “Title page customization”.

Here's what's different about title page customization. Most customization consists of writing XSLT that modifies the stock XSLT-based DocBook-XSL Stylesheets. However, customization of the title page is indirect: you create an XML file that specifies what you want your title page to look like, and then use a special XSL stylesheet that transforms that XML file into the actual XSLT script that plugs into the DocBook-XSL Stylesheets structure and specifies the layout of the title page. That stylesheet lives here:

So, to customize the title page, follow these steps:

  1. Prepare a title page template file. This file is an .xml file that uses namespace to describe the layout of the title page. Start with a copy of the stock version, which is located at html/titlepage.templates.xml in the DocBook-XSL Stylesheets, and modify it to suit.

  2. Use xsltproc to transform this file into an .xsl file that is the actual title page customization file. The script that transforms the XML file to XSLT is at template/titlepage.xsl in the DocBook-XSL Stylesheets.

  3. Include the generated .xsl file as part of the customization layer.

Here's a picture of the dependencies reflected in this project's Makefile.


Note the feedback in this process: the zdp_html.xsl and zdp_fo.xsl files extracted from the document are used to build the HTML and PDF renderings.

If you manage to generate copies of these files that don't work, just fix the problems and then issue the command make code before you type the full make.