This is the mail archive of the
mailing list for the DocBook project.
Re: Help with chapter headings in conversion to HTML
- To: djdees at mm dot com, docbook at lists dot oasis-open dot org
- Subject: Re: DOCBOOK: Help with chapter headings in conversion to HTML
- From: Bob Stayton <bobs at caldera dot com>
- Date: Fri, 21 Sep 2001 14:25:54 -0700 (PDT)
- List-Id: <docbook.lists.oasis-open.org>
> From: Derek Dees <firstname.lastname@example.org>
> I've spent some time digging, but have gotten lost. What I'm trying to do
> is get the style sheet to quit printing Chapter, the number and the chapter
> title at the start of each chapter in the document.
> For example:
> What I'm getting:
> Chapter 1. Title here
> What I want:
> 1. Title here
> I found in html/component.xsl where that is defined, but then get lost
> following the <xsl:apply-templates select="$node"
> mode="object.title.markup"/> to see what is doing the work.
No doubt it is difficult to trace the series of steps in
which titles like this are handled. The complexity is due
to the remarkable flexibility that Norm programmed into the
stylesheets for handling localization and customization.
Fortuantely, he made applying customizations easy.
Generated text like titles and cross references
come from text templates defined for each language,
in files like common/en.xml. The stylesheets are
set up to accept local substitutes for particular
templates. This driver file does what you
want (assuming this is just for English):
<xsl:param name="local.l10n.xml" select="document('')"/>
<template name="chapter" text="%n. %t"/>
The <context> element indicates that you want a
new template for handling the title. The <template>
element (this is not an <xsl:template> BTW) indicates
the text to use for the specified element name.
In the text templates, '%n' resolves to the
number, and '%t' resolves to the title.
There is also a '%s' for subtitle.
I'm writing up stuff like this for inclusion in a
new version of the chapter in Norm's book on
processing DocBook with XSL stylesheets.
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
To subscribe or unsubscribe from this elist use the subscription