XML technologies / DocBook / The DocBook XSL stylesheets / Indirectly customizing a title page

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

In DocBook, a title page presents a title or subtitle element, for example for a book, chapter, or section, with related metadata such as authors and legal notices. DocBook supports many elements that can appear on a title page:

abbrev

abstract

address

affiliation

artpagenums

author

authorblurb

authorgroup

authorinitials

bibliomisc

biblioset

citetitle

collab

confgroup

contractnum

contractsponsor

contrib

copyright

corpauthor

corpname

date

edition

editor

firstname

graphic

honorific

isbn

issn

itermset

indexterm

invpartnumber

issuenum

keywordset

legalnotice

lineage

mediaobject

modespec

orgname

othercredit

othername

pagenums

printhistory

productname

pubdate

publisher

publishername

pubsnumber

releaseinfo

revhistory

seriesvolnums

subjectset

subtitle

surname

title

titleabbrev

volumenum  

Why customize a title page?

There are two ways to customize a title page:

  1. Customize a title page specification file. Its contents depend on the output format. This method is described in the following procedure.

  2. Customize the relevant templates directly, as described in Customizing a title page directly.

A specification file is an XML file with entries for left-hand (verso) and right-hand (recto) pages. This distinction is irrelevant to (X)HTML, so all entries are made on a recto page.

The specification file contains DocBook elements and elements from the namespace "http://nwalsh.com/docbook/xsl/template/1.0". For an overview of all elements, see Titlepage Template Stylesheet Reference. The following example shows the basic structure:

 

Example: Excerpt from an article specification file, (X)HTML output

<t:templates xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0" xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <t:titlepage t:element="article" t:wrapper="div" class="titlepage">
        <t:titlepage-content t:side="recto">
            <title/>
            <subtitle/>
            <corpauthor/>
            <authorgroup/>
            <author/>
            <othercredit/>
            <releaseinfo/>
            <copyright/>
            <legalnotice/>
            <pubdate/>
            <revision/>
            <revhistory/>
            <abstract/>
        </t:titlepage-content>
        <t:titlepage-content t:side="verso"></t:titlepage-content>
        <t:titlepage-separator><hr/></t:titlepage-separator>
        <t:titlepage-before t:side="recto"></t:titlepage-before>
        <t:titlepage-before t:side="verso"></t:titlepage-before>
    </t:titlepage>
    <!-- Weitere t:titlepage-Elemente... -->
</t:templates>

Line 1: Root element with namespace declarations. All processing elements and attributes use t — the namespace prefix.
Line 2: A t:titlepage contains the structure of a title page, here for the element article. t:wrapper: Target element wrapping the title page; for (X)HTML, this is div. The attribute class and its value are inserted into the element specified in t:wrapper. This example creates an element <div class="titlepage">.
Line 3: Contents of an article’s recto title page. The order of DocBook elements matches the output order.
Line 18: Contents of an article’s verso title page. Irrelevant for (X)HTML, so the contents are empty.
Line 19: A t:titlepage-separator separates the title page from the rest of the contents.
Lines 20 and 21: These elements contain material inserted before the recto and verso pages respectively. Their contents are empty for (X)HTML.

Each t:titlepage element has two t:titlepage-content with recto and verso in the attribute t:side, two t:titlepage-before (also with the corresponding attributes), and one t:titlepage-separator. The output order is as follows:

t:titlepage-before   t:side="recto"
t:titlepage-content  t:side="recto"
t:titlepage-before   t:side="verso"
t:titlepage-content  t:side="verso"
t:titlepage-separator

The following procedure creates an article title page for (X)HTML output:

  1. Creating the specification file
    Copy the file html/titlepage.template.xml and remove all entries for t:titlepage that are irrelevant to your customization. However, keep the t:titlepage element with an attribute t:element with the value article (see the example “Excerpt from an article specification file, (X)HTML output”).

  2. Customizing the title page
    Add new DocBook elements inside t:titlepage-content, reorder them, or remove those you do not need. Add only DocBook elements allowed inside articleinfo or info.

  3. Generating the stylesheet
    Apply the stylesheet template/titlepage.xsl to your specification file:

xsltproc --output mytitlepage.xsl \ 
   DB/template/titlepage.xsl \ 
   mytitlepage.spec.xml

Replace the placeholder DB with the DocBook stylesheet installation path. The transformation produces a stylesheet containing exactly the DocBook elements and order specified in your specification file.

  1. Including the stylesheet in a customization file
    Include the stylesheet generated in step 3 in your customization file:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
  <xsl:import href="DBBASISURI/html/docbook.xsl"/> 
  <xsl:include href="mytitlepage.xsl"/> 
  <!-- weitere Einträge --> 
</xsl:stylesheet>

Replace the placeholder DBBASISURI with the corresponding official URI.

  

back to top