docbook-apps

  • 1.  TOC formatting

    Posted 08-30-2009 09:47
    Hi,

    is there a way to modify the toc templates to e.g. making every major
    one heading bold and have a padding or margin like this

    1. This is a major one heading (BOLD font-weight)
    1.1 ... (NORMAL font-weight)
    1.2 ... (NORMAL font-weight)
    Padding / Margin / Spacing
    2. This is a major two heading (BOLD font-weight)
    2.1 ... (NORMAL font-weight)
    ...

    I already searched the documentation and the xsl source, but haven't
    found a real entry point in the toc.xsl.

    Any ideads or suggestions?

    Cheers,
    Tobias



  • 2.  Re: [docbook-apps] TOC formatting

    Posted 08-30-2009 11:39
    Hi Tobias,

    Sunday 30 August 2009
    >
    > is there a way to modify the toc templates to e.g. making every major
    > one heading bold and have a padding or margin like this
    >
    > 1. This is a major one heading (BOLD font-weight)

    I assume, you mean a title in chapter, appendix, or preface?


    > 1.1 ... (NORMAL font-weight)
    > 1.2 ... (NORMAL font-weight)
    > Padding / Margin / Spacing
    > 2. This is a major two heading (BOLD font-weight)
    > 2.1 ... (NORMAL font-weight)
    > ...
    >
    > I already searched the documentation and the xsl source, but haven't
    > found a real entry point in the toc.xsl.
    >
    > Any ideads or suggestions?

    I think, you can use one of the two methods, depending on how easy it should
    be or how much detail you need:

    1. Customize the attribute set "toc.line.properties".
    2. Customize the named template "toc.line".

    The first one is easier to use. Use the following code to distinguish between
    a chapter and something else. Of course, you can add appendix, glossary, etc.
    too, to cover these headings:

    <xsl:attribute-set name="toc.line.properties">
    <xsl:attribute name="font-weight">
    <xsl:choose>

    <xsl:when test="self::chapter">bold</xsl:when>
    <xsl:otherwise>normal</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    </xsl:attribute-set>

    The second one is a bit more elaborate, but gives you more freedom. Copy the
    "toc.line" template from fo/autotoc.xsl into your customization layer and
    adapt it to your needs. You can use the above xsl:choose to distinguish
    between your different headings and add your spacing/margins/ ...

    More information about the latter method can be found here:

    http://www.sagehill.net/docbookxsl/TOCcontrol.html#TOClook


    Tom



  • 3.  Re: [docbook-apps] TOC formatting

    Posted 08-30-2009 18:12
    Hi Tom,

    I modified the toc.line template. Thanks for your help :)

    Cheers,
    Tobias

    On Sun, Aug 30, 2009 at 1:39 PM, Thomas Schraitle<tom_schr@web.de> wrote:
    > Hi Tobias,
    >
    > Sunday 30 August 2009
    >>
    >> is there a way to modify the toc templates to e.g. making every major
    >> one heading bold and have a padding or margin like this
    >>
    >> 1. This is a major one heading (BOLD font-weight)
    >
    > I assume, you mean a title in chapter, appendix, or preface?
    >
    >
    >> 1.1 ... (NORMAL font-weight)
    >> 1.2 ... (NORMAL font-weight)
    >> Padding / Margin / Spacing
    >> 2. This is a major two heading (BOLD font-weight)
    >> 2.1 ... (NORMAL font-weight)
    >> ...
    >>
    >> I already searched the documentation and the xsl source, but haven't
    >> found a real entry point in the toc.xsl.
    >>
    >> Any ideads or suggestions?
    >
    > I think, you can use one of the two methods, depending on how easy it should
    > be or how much detail you need:
    >
    >  1. Customize the attribute set "toc.line.properties".
    >  2. Customize the named template "toc.line".
    >
    > The first one is easier to use. Use the following code to distinguish between
    > a chapter and something else. Of course, you can add appendix, glossary, etc.
    > too, to cover these headings:
    >
    >  <xsl:attribute-set name="toc.line.properties">
    >   <xsl:attribute name="font-weight">
    >     <xsl:choose>
    >      
    >       <xsl:when test="self::chapter">bold</xsl:when>
    >       <xsl:otherwise>normal</xsl:otherwise>
    >     </xsl:choose>
    >   </xsl:attribute>
    >  </xsl:attribute-set>
    >
    > The second one is a bit more elaborate, but gives you more freedom. Copy the
    > "toc.line" template from fo/autotoc.xsl into your customization layer and
    > adapt it to your needs. You can use the above xsl:choose to distinguish
    > between your different headings and add your spacing/margins/ ...
    >
    > More information about the latter method can be found here:
    >
    > http://www.sagehill.net/docbookxsl/TOCcontrol.html#TOClook
    >
    >
    > Tom
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >