OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Adding "Chapter" in front of 1., 2., 3., in a TOC


Below is the toc.line template that I used in my book.  You are welcome to
use it.

<xsl:template name="toc.line">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <xsl:variable name="label">
    <xsl:apply-templates select="." mode="label.markup"/>
  </xsl:variable>


  <fo:block text-align-last="justify"
            end-indent="{$toc.indent.width}pt"
            last-line-end-indent="-{$toc.indent.width}pt">
    <xsl:choose>
      <xsl:when test="local-name(.) = 'part'">
        <xsl:attribute name="font-weight">bold</xsl:attribute>
        <xsl:attribute name="font-family">Helvetica</xsl:attribute>
        <xsl:attribute name="font-size">16pt</xsl:attribute>
        <xsl:attribute name="space-before">10pt</xsl:attribute>
        <xsl:attribute name="space-after">10pt</xsl:attribute>
        <xsl:attribute name="text-align-last">left</xsl:attribute>
      </xsl:when>
      <xsl:when test="local-name(.)='chapter'
                    or local-name(.)='appendix'
                    or local-name(.)='glossary'
                    or local-name(.)='index'
                    or local-name(.)='preface'">
        <xsl:attribute name="font-weight">bold</xsl:attribute>
        <xsl:attribute name="font-size">12pt</xsl:attribute>
        <xsl:attribute name="space-before">4pt</xsl:attribute>
        <xsl:attribute name="space-after">2pt</xsl:attribute>
      </xsl:when>
    </xsl:choose>
    <fo:inline keep-with-next.within-line="always">
      <fo:basic-link internal-destination="{$id}">
        <xsl:choose>
   <xsl:when test="local-name(.) = 'part'">
     <xsl:call-template name="gentext">
       <xsl:with-param name="key" select="'Part'"/>
     </xsl:call-template>
     <xsl:text> </xsl:text>
   </xsl:when>
   <xsl:when test="local-name(.) = 'chapter'">
     <xsl:call-template name="gentext">
       <xsl:with-param name="key" select="'Chapter'"/>
     </xsl:call-template>
     <xsl:text> </xsl:text>
   </xsl:when>
   <xsl:when test="local-name(.) = 'appendix'">
     <xsl:call-template name="gentext">
       <xsl:with-param name="key" select="'Appendix'"/>
     </xsl:call-template>
     <xsl:text> </xsl:text>
   </xsl:when>
 </xsl:choose>
        <xsl:if test="$label != ''">
          <xsl:copy-of select="$label"/>
          <xsl:value-of select="$autotoc.label.separator"/>
        </xsl:if>
        <xsl:apply-templates select="." mode="title.markup"/>
      </fo:basic-link>
    </fo:inline>
    <xsl:if test="local-name(.) != 'part'">
      <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>
    </xsl:if>
  </fo:block>
</xsl:template>


Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Immell, Tara" <Immell@SelkirkFinancial.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, May 11, 2004 4:16 PM
Subject: [docbook-apps] Adding "Chapter" in front of 1., 2., 3., in a TOC


> Hi all,
>
> I am trying to customize a .pdf TOC to have the word "Chapter" in front of
> numbered chapters. i.e. as on http://www.sagehill.net/docbookxsl/
>
> Chapter 1. Introduction
> How this book is organized
> Online resources
> Chapter 2. Getting Started
> Logging In
> Etc.
> Chapter 3. Etc.
>
> I think I need to write a gentext template within the toc.line template
> which I'll copy into my customization layer; but as I've only ever used
> parameters before in my customization layer, I thought I'd ask if anyone
has
> already done this and has a sample before I start.
>
> Thanks, Tara
>
> To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
>
>
>




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]