This is the mail archive of the
docbook@lists.oasis-open.org
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 <djdees@mm.com>
>
> 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:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="../docbook-xsl-1.44/html/docbook.xsl"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<i18n xmlns="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l10n language="en">
<context name="title">
<template name="chapter" text="%n. %t"/>
</context>
</l10n>
</i18n>
</xsl:stylesheet>
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.
bobs
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
email: bobs@caldera.com
----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>