XML technologies / DocBook / Generating FO (PDF) / Customizing title pages / Customizing title pages for novels

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Novels using book and organized into chapter need four title-page customizations: three for the book (half-title, main title and imprint) and one for each chapter.

Example: Title pages of a novel

<xsl:template name="book.titlepage.before.recto">
    <xsl:message>Schmutztitel</xsl:message>
    <fo:block text-align="right" break-after="odd-page">
        <xsl:apply-templates select="d:info/d:author" mode="book.titlepage.before.recto"/>
        <xsl:text> - </xsl:text>
        <xsl:apply-templates select="(d:info/d:title | d:title)[1]" mode="book.titlepage.before.recto"/>
    </fo:block>
</xsl:template>
<xsl:template name="book.titlepage.recto">
    <xsl:message>Haupttitel</xsl:message>
    <fo:block text-align="center">
        <fo:block font-size="12pt">
            <xsl:apply-templates mode="book.titlepage.before.recto" select="d:info/d:author[1]"/>
        </fo:block>
        <fo:block>
            <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="(d:info/d:title|d:title)[1]"/>
        </fo:block>
        <fo:block font-size="12pt" space-before=".5em">Roman</fo:block>
        <fo:block-container top="16.5cm" bottom="2cm" absolute-position="absolute">
            <fo:block >
                <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="(d:info/d:publisher/d:publishername | d:info/d:publishername)[1]"/>
            </fo:block>
        </fo:block-container>
    </fo:block>
</xsl:template>
<xsl:template name="book.titlepage.verso">
    <xsl:message>Impressum</xsl:message>
    <!-- ... -->
</xsl:template>

Line 1: Generates the half-title preceding the main title. The template right-aligns author and title. Using break-after with the value odd-page inserts a blank page so that the following title starts on an odd-numbered page.
Line 9: Generates the main title page with author, title and publisher. The publisher is placed using fo:block-container at an absolute position, independent of title length and line breaks.
Line 26: Generates the imprint, containing author, title and legal notices in smaller type.

Transforming with these settings gives unsatisfactory results: book and chapter titles are too large. Use the following modes to adjust them:

Example: Customizing titles in a novel

<xsl:template match="d:title" mode="book.titlepage.recto.auto.mode">
    <fo:block font-size="{$body.font.master * 1.73}pt" space-before="1em">
        <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>
<xsl:template match="d:title" mode="book.titlepage.verso.auto.mode">
    <fo:block font-size="{$body.font.master * 1.44}pt">
        <xsl:call-template name="book.verso.title"/>
    </fo:block>
</xsl:template>
<xsl:template match="d:title" mode="chapter.titlepage.recto.auto.mode">
    <fo:block xsl:use-attribute-sets="chapter.titlepage.recto.style" font-size="{$body.font.master * 1.2}pt" font-family="{$body.font.family}" font-weight="normal" text-align="center" space-after="10em">
        <xsl:apply-templates/>
    </fo:block>
</xsl:template>

Line 1: Formats the book title for the main title page.
Line 8: Formats the book title for the imprint.
Line 13: Formats a chapter title for a right-hand title page.

  

back to top