Norman Walsh

$Id: templates.xml,v 1.1 2001/04/02 13:03:43 nwalsh Exp $

Changing the Article Title Page

Some parts of the DocBook XSL Stylesheets are actually generated using XSL Stylesheets. In particular, the formatting of title pages is generated using a special template system. The same template system will eventually allow you to easily customize bibliography entries and perhaps other parts of the system as well.

FIXME: there needs to be more introductory/explanatory text here!

In order to demonstrate how this system works, let's consider how we can use it to change the format of article title pages.

By default, the stylesheets print the following elements on the article title page, in this order: title, subtitle, corpauthor, authorgroup, author, releaseinfo, copyright, legalnotice, pubdate, revision, revhistory, abstract. Suppose we want to put only the title, author, and edition elements on the title page, in the order that they appear in the articleinfo.

The hard (and wrong!) way to do it would be to edit titlepage.templates.xsl and make the changes by hand.

The easy and right way is to construct a template document that describes the order and sequence of elements that you want:

<t:templates xmlns:t=""

<t:titlepage element="article" wrapper="div" class="titlepage">
  <t:titlepage-content side="recto" order="document">
    <title predicate="[1]"/>

Then process this document with the template/titlepage.xsl stylesheet. This will produce the following somewhat cryptic stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="" version="1.0">

<!-- This stylesheet was created by titlepage.xsl; do not edit it by hand. -->

<xsl:import href="/path/to/html/docbook.xsl"/>

<xsl:template name="article.titlepage.recto"><xsl:apply-templates mode="article.titlepage.recto.mode" select="(articleinfo/title|artheader/title|title)[1]|articleinfo/author|artheader/author|articleinfo/edition|artheader/edition"/>

<xsl:template name="article.titlepage">
  <div class="titlepage">
    <xsl:call-template name="article.titlepage.before.recto"/>
    <xsl:call-template name="article.titlepage.recto"/>
    <xsl:call-template name="article.titlepage.before.verso"/>
    <xsl:call-template name="article.titlepage.verso"/>
    <xsl:call-template name="article.titlepage.separator"/>


Despite its cryptic appearance, it has the desired result. If you want to change how the titlepage elements are formatted (as opposed to which ones are formatted), you have to write your own customization layer that overrides the template for the element in question in the titlepage.mode mode.