[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Chapter, Appendix, and Part headings in TOC?
Charlie
This is from my customization - I think it will give you what you
want. See especially the 'DON'T DO THIS on the 3rd. line
Ron
<!-- turn on chapter numbering - 1, 2, 3 ... -->
<xsl:param name="chapter.autolabel" select="1" />
<!-- DON'T DO THIS, rely of the default - else get numbers, not letters -->
<!-- turn on appendix numbering - A, B, C ... -->
<!-- <xsl:param name="appendix.autolabel" select="1" /> -->
<!-- turn on section numbering - .1, .2, .3, ... -->
<xsl:param name="section.autolabel" select="1" />
<!-- include chapter number in section number - e.g. 2.1 -->
<xsl:param name="section.label.includes.component.label" select="1" />
<!-- turn on page numbering in xrefs -->
<xsl:param name="insert.xref.page.number" select="yes" />
<!-- set whitespace and punctuation in xrefs -->
<!--
<xsl:param name="xref.label-title.separator" select="'abcd'" />
<xsl:param name="xref.title-page.separator" select="': '" />
-->
<!-- define named xrefstyles for appendix, chapter, figure, part,
sect1,sect2, sect3 section, table (all same: "page_ref"), and for
formalpara ("fp_page_ref") -->
<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="xref-number-and-title">
<l:template name="appendix" style="page_ref"
text="Appendix %n, “%t”, p.%p,"
/>
<l:template name="chapter" style="page_ref"
text="Chapter %n, “%t”, p.%p,"
/>
<l:template name="figure" style="page_ref"
text="Figure %n, “%t”, p.%p,"
/>
<l:template name="part" style="page_ref"
text="Part %n, “%t”, p.%p,"
/>
<l:template name="sect1" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="sect2" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="sect3" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="sect4" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="sect5" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="section" style="page_ref"
text="Section %n, “%t”, p.%p,"
/>
<l:template name="table" style="page_ref"
text="Table %n, “%t”, p.%p,"
/>
</l:context>
<l:context name="xref">
<l:template name="formalpara" style="fp_page_ref"
text="Paragraph “%t”" />
<l:template name="olink.page.citation" text=" (page %p)"/>
<l:template name="page.citation" text=" [%p]"/>
<l:template name="page" text="(page %p)"/>
<l:template name="docname" text=" in %o"/>
<l:template name="docnamelong" text=" in the document titled %o"/>
<l:template name="pageabbrev" text="(p. %p)"/>
<l:template name="Page" text="Page %p"/>
</l:context>
</l:l10n>
</l:i18n>
>Hmmm...I regenerated my stylesheets and I see that it's outputing
>that. I'm not sure why I wasn't getting it before.
>
>However my TOC that's getting generated is outputing A, B, C, etc for
>my appendicies. However, when I open the appendix it says Appendix 1,
>Appendix 2, etc. What I want is that the TOC matches the contents of
>those pages.
>
>However, what parameter controls that output? What parameter do I
>tweak to supress that or change it it from including Chapter 1,
>Appendix 2, etc? I understand the defaults.
>
>Thanks
>Charlie
>
>On 9/11/06, Bob Stayton <bobs@sagehill.net> wrote:
>>But the generated content (the chapter title itself) already says "Chapter
>>1. You Got What I Need". That is the default output. What would want
>>instead?
>>
>>Bob Stayton
>>Sagehill Enterprises
>>DocBook Consulting
>>bobs@sagehill.net
>>
>>
>>----- Original Message -----
>>From: "Charlie Hubbard" <charlie.hubbard@gmail.com>
>>To: "Ron Catterall" <ron@catterall.net>
>>Cc: <docbook-apps@lists.oasis-open.org>
>>Sent: Sunday, September 10, 2006 1:15 PM
>>Subject: Re: [docbook-apps] Chapter, Appendix, and Part headings in TOC?
>>
>>
>>> Ok thanks for the code. I was able to modify it to support the other
>>> sections I wanted this type of header for. But, this will only affect
>>> the TOC and not the generated contents. Is there no way to do this
>>> through just turning on a XSL parameter rather than having to
>>> customize this? I'm looking at the XSL book as an example of what I'd
>>> like to do:
>>>
>>> http://www.sagehill.net/docbookxsl/
>>>
>>> So the TOC has
>>>
>>> Chapter 1. You Got What I Need
>>> Chatper 2. But you Say He's Just a Friend
>>>
>>> but also when you click Chapter 1 href link you see:
>>>
>>> Chapter 1. You Got What I Need
>>>
>>> Blah blah that adored me....
>>>
>>> in the web page. This seems like you could just turn on a parameter
>>> and get it to do the same thing without creating a customization code.
>>> The rest of the XSL book is pretty much default like layout.
>>>
>>> Charlie
>>>
>>> On 9/10/06, Ron Catterall <ron@catterall.net> wrote:
>>>> Charlie
>>>> Try this, this will set the string 'Appendix' in the TOC to what you
>>>> want.
>>>> Similarly for Chapter - sorry no time just now to spell it out.
>>>> Ron
>>>> <!-- set labels for appendices in the table of contents -->
>>>> <!--
>>>> ==================================================================== -->
>>>> <xsl:template name="toc.line">
>>>> <xsl:variable name="id">
>>>> <xsl:call-template name="object.id"/>
>>>> </xsl:variable>
>>>>
>>>> <xsl:variable name="label">
>>>> <xsl:choose>
>>>> <xsl:when test="self::appendix">
>>>> <xsl:call-template name="gentext">
>>>> <xsl:with-param name="key">appendix</xsl:with-param>
>>>> </xsl:call-template>
>>>> <xsl:text> </xsl:text>
>>>> <xsl:apply-templates select="." mode="label.markup"/>
>>>> </xsl:when>
>>>> <xsl:otherwise>
>>>> <xsl:apply-templates select="." mode="label.markup"/>
>>>> </xsl:otherwise>
>>>> </xsl:choose>
>>>> </xsl:variable>
>>>>
>>>> <fo:block text-align-last="justify"
>>>> text-align="start"
>>>> end-indent="{$toc.indent.width}pt"
>>>> last-line-end-indent="-{$toc.indent.width}pt">
>>>> <fo:inline keep-with-next.within-line="always">
>>>> <fo:basic-link internal-destination="{$id}">
>>>> <xsl:if test="$label != ''">
>>>> <xsl:copy-of select="$label"/>
>>>> <xsl:value-of select="$autotoc.label.separator"/>
>>>> </xsl:if>
>>>> <xsl:apply-templates select="." mode="titleabbrev.markup"/>
>>>> </fo:basic-link>
>>>> </fo:inline>
>>>> <fo:inline keep-together.within-line="always">
>>>> <xsl:text> </xsl:text>
>>>> <fo:leader leader-pattern="dots"
>>>> leader-pattern-width="3pt"
>>>> leader-alignment="reference-area"
>>>> keep-with-next.within-line="always"/>
>>>> <xsl:text> </xsl:text>
>>>> <fo:basic-link internal-destination="{$id}">
>>>> <fo:page-number-citation ref-id="{$id}"/>
>>>> </fo:basic-link>
>>>> </fo:inline>
>>>> </fo:block>
>>>> </xsl:template>
>>>> <!--
>>>> ==================================================================== -->
>>>>
>>>> <!-- turn on chapter numbering - 1, 2, 3 ... -->
>>>> <xsl:param name="chapter.autolabel" select="1" />
>>>>
>>>>
>>>>
>>>>
>>>> >Hi,
>>>> >
>>>> >I've been trying to find the answer to this questions because it seems
>>>> >like an easy one, but I just can't find the parameter that controls
>>>> >it. I'm trying to generate the TOC with entries like
>> >> >
>>>> >Chatper 1. How to get Your Skeletons Their Whitest.
>>>> >Chapter 2. Selling Your Soul In a Buyers' Market.
>>>> >Chatper 3. How to Raise the Dead
>>>> >Appendix A. Pet Cemetary Rules and Regulations
>>>> >
>>>> >Right now all I get by default is:
>>>> >
>>>> >1. How to get Your Skeletons Their Whitest.
>>>> >2. Selling Your Soul In a Buyers' Market.
>>>> >3. How to Raise the Dead
>>>> >A. Pet Cemetary Rules and Regulations
>>>> >
>>>> >What template generates this?
>>>> >
>>>> >Thanks
>>>> >Charlie
>>>> >
>>>> >---------------------------------------------------------------------
>>>> >To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>> >For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>>
>>>>
>>>> --
>>>> Ron Catterall, Phd, DSc email: ron@catterall.net
>>>> Prolongacion de Hidalgo 140
>>>> http://catterall.net/
>>>> San Felipe del Agua tel: +52 951 520
>>>> 1821
>>>> Oaxaca 68020 Mexico fax: +1 530 348
>>>> 8309
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>
>>>
>>>
--
Ron Catterall, Phd, DSc email: ron@catterall.net
Prolongacion de Hidalgo 140 http://catterall.net/
San Felipe del Agua tel: +52 951 520 1821
Oaxaca 68020 Mexico fax: +1 530 348 8309
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]