This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Change "TableofContents" gentext for Chapter level tocs?
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: "anon croaker" <anon_croaker at yahoo dot co dot uk>,"docbook_apps" <docbook-apps at lists dot oasis-open dot org>
- Date: Tue, 9 Dec 2003 19:14:39 -0800
- Subject: Re: [docbook-apps] Change "TableofContents" gentext for Chapter level tocs?
- References: <20031209180730.82265.qmail@web25109.mail.ukl.yahoo.com>
This can be done with a combination of customizations. But it differs
from FO and HTML outputs.
For FO output, the Table of Contents title is generated from
the titlepage mechanism, from the specs in fo/titlepage.templates.xml.
It currently just calls the gentext template with a fixed key
"TableofContents". So I changed the first part of it to:
<t:titlepage t:element="table.of.contents" t:wrapper="fo:block">
<t:titlepage-content t:side="recto">
<title
t:force="1"
t:named-template="toc.title"
param:node="."
space-before.minimum="1em"
This customized spec file needs to be built into a new
titlepage.templates.xsl that your customization layer includes.
Now it will call a new template named "toc.title" with the
current element as the "node" parameter. The toc.title
template looks like this:
<xsl:template name="toc.title">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="local-name(.) = 'chapter'">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'ChapterTableofContents'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'TableofContents'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
If the current element is a chapter, then the key is
"ChapterTableof Contents". Then I defined that gentext
key in the customization file using this:
<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="en">
<l:gentext key="ChapterTableofContents" text="In this chapter you will
cover:"/>
</l:l10n>
</l:i18n>
You can define other strings for other languages too.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "anon croaker" <anon_croaker@yahoo.co.uk>
To: "docbook_apps" <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, December 09, 2003 10:07 AM
Subject: [docbook-apps] Change "TableofContents" gentext for Chapter level
tocs?
> Hello
>
> I'm trying to setup a customisation layer that will give me a Book level
TOC and a set of Chapter level TOCs. I would like, however, for the TOC
title text to read "In this Chapter you will cover:" when at a chapter level
and to retain the more traditional "Table of Contents" at the Book level.
>
> Long term, I'd probably need to support other languages too but I can
worry about that later.
>
> I've got the <xsl:param name="generate.toc"> stuff sorted and working but
as far as I can see <l:gentext key="TableofContents" text="Table of
Contents"/> is a single entry for all TOCs.
>
> Is it possible to do what I want at a customisation layer level or would I
need to edit the templates themselves. If so, is there any merit in
submitting a change request?
>
> I'd also like the Chapter level TOC to be just a list (bulleted?) rather
than a full-on TOC.
>
> Perhaps I should set:
>
> <xsl:param name="generate.toc">
> book title,toc,figure
> chapter title
> section title
> </xsl:param>
>
>
> And manually maintain my Chapter TOC within my <chapter> XML source?
>
> TIA
>
> croaker
>
>
> ---------------------------------
> BT Yahoo! Broadband - Save £80 when you order online today. Hurry!
Offer ends 21st December 2003. The way the internet was meant to be.
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.