[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: Appendix in title and TOC
On Mon, May 13, 2002 at 03:52:23PM -0500, Dennis Grace wrote: > I'm working in XML, with the 1.50.0 XSL. > > I've been trying to satisfy a customer who wants the word Appendix to > appear in each appendix title as well as in the TOC of an article. I > managed to get the appendix title the way they wanted by moving the > <xsl:template match="appendix" mode="object.title.template"> > ... > </xsl:template> > > from common/gentext.xsl into my driver file. Anybody have a cleaner way to > do this? Yes, the title in the appendix itself can be altered with a text template customization because appendixes use the 'title-numbered' context in the templates. Put something like this in your customization file: <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:context name="title-numbered"> <l:template name="appendix" text="Appendix %n: %t"/> </l:context> </l:l10n> </l:i18n> This change only applies to the English version, of course. More entries for other languages. > I haven't been able to figure out how to change the TOC, though. Anyone > know how to do this? This is harder. There is little opportunity to customize individual lines in the TOC. The toc lists are generated using the 'subtoc' template in autotoc.xsl. It is used recursively, to get nesting, but it doesn't vary per element type. These lines in subtoc show the problem: <xsl:element name="{$toc.listitem.type}"> <xsl:variable name="label"> <xsl:apply-templates select="." mode="label.markup"/> </xsl:variable> <xsl:copy-of select="$label"/> The first line starts the <dt> element (in html output) and the rest output the appendix number (called a label in the stylesheets). If you want the word Appendix, then it has to be inserted between them. Something like this: <xsl:element name="{$toc.listitem.type}"> <xsl:if test="local-name(.) = 'appendix'"> <xsl:text>Appendix </xsl:text> </xsl:if> <xsl:variable name="label"> <xsl:apply-templates select="." mode="label.markup"/> </xsl:variable> <xsl:copy-of select="$label"/> Unfortunately, to get this in there you have to copy the entire subtoc template to your customization file. If you plan to localize, you should replace the xsl:text element with a call to a gentext template to get the word "Appendix" in the correct language. -- 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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC