Difficulty: ★★☆ (medium)
Keywords: title page, style title page

Problem

You do not want to overhaul the default title pages, but you want to change small things, like the font size, margins, or other stylistic parameters.

Solution

The difficulty is to find the correct template to customize. Here is a general procedure how to do this:

Procedure 4.1. Finding the Correct Template to Customize for a Title Page
  1. Open the file fo/titlepage.templates.xsl from your DocBook XSL distribution.

  2. Determine the following parameters and write it down or memorize it:

    • The title page which you want to customize (usually something like book, chapter, etc.), refered as DIVISION

    • The element on that title page, referred as ELEMENT

    • The side, be it recto (right) or verso (left), refered as SIDE.

  3. Compose a template in your mind from the previous parameters and replace the placeholders:

    <xsl:template match="ELEMENT" mode="DIVISION.titlepage.SIDE.auto.mode">
  4. Try to find the template from Step 3 in fo/titlepage.templates.xsl.

  5. If you have found the template depicted in Step 3, copy it to your customization layer. If there is no such template, create a new one with the same signature.

  6. Customize the template.

  7. Build your document with your customization layer.

Discussion

To make the general explanations a bit more useful, here is a small example: you want to change the font size for the title of a book's recto title page. Applying Procedure 4.1, “Finding the Correct Template to Customize for a Title Page” leads to the following template:

<xsl:template match="d:title" mode="book.titlepage.recto.auto.mode">

After you have copied it to your customization layer, you can change the font-size (marked bold):

<xsl:template match="d:title" mode="book.titlepage.recto.auto.mode">
  <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
     xsl:use-attribute-sets="book.titlepage.recto.style"
     text-align="center"
     font-size="40pt"
     space-before="18.6624pt"
     font-weight="bold"
     font-family="{$title.fontset}">
    <xsl:call-template name="division.title">
      <xsl:with-param name="node" select="ancestor-or-self::d:book[1]"/>
    </xsl:call-template>
  </fo:block>
</xsl:template>

In the previous example, the font size was changed from the original value of 24.8832pt to 40pt. The other objects are unchanged. Other attributes can be changed as needed.

See Also

Section 4.2, “Designing a Title Page”


Project@GitHubIssue#9