docbook-apps

  • 1.  Changing toc parameter values by chapter

    Posted 05-24-2023 13:45
    It appears to me that the parameters that control the placement and content
    of tocs apply at a document level. What I am wondering is if it is possible
    to to set different values for 'generate.toc', 'toc.section.depth',
    'toc.max.dept' etc for different chapters/appendices?

    In my document (being output as chunked html) most chapters/appendices only
    need a table of contents at the top of the chapter with
    toc.section.depth=2, toc.max.depth=2. There are some chapters with
    considerable detail that would benefit from also having a table of contents
    inserted at the top sect3 with toc.max.depth=1. And there is one appendix
    that only needs one toc at the top with a max depth of 1.

    Is there an easy way to obtain this variety? Or am I heading down the path
    to madness?

    Thanks,

    Tom



  • 2.  Re: [docbook-apps] Changing toc parameter values by chapter

    Posted 05-24-2023 13:53
    > Is there an easy way to obtain this variety? Or am I heading down the
    > path to madness?

    The xslTNG stylesheets will put a ToC anywhere that you put an empty
    <toc/> element. There’s also an m:toc mode that would allow you to
    control which elements get a ToC more programmatically:

    https://xsltng.docbook.org/guide/2.1.3/m_toc.html

    Be seeing you,
    norm

    --
    Norm Tovey-Walsh <ndw@nwalsh.com>
    https://norm.tovey-walsh.com/

    > The bitterness of poor quality remains long after the sweetness of
    > meeting the schedule has been forgotten.



  • 3.  Re: [docbook-apps] Changing toc parameter values by chapter

    Posted 05-24-2023 18:18
    If you are using the XSLT 1 stylesheets, then placing an empty <toc>
    element where you want a TOC, and setting the 'process.empty.source.toc'
    stylesheet param to 1 will generate a TOC for that element.  It applies
    to hierarchy elements like chapter and section, but not arbitrary elements.

    https://docbook.sourceforge.net/release/xsl/current/doc/fo/process.empty.source.toc.html

    Changing the behavior of each TOC would require customization of the
    templates in the DocBook toc.xsl stylesheet module that match on the toc
    element, such as:

    <xsl:template match="chapter/toc | appendix/toc | preface/toc |
    article/toc">

    so they respond to a processing instruction or attribute setting in the
    way you want.  I would not classify that as an "easy" way, though.

    Bob

    On 5/24/2023 6:45 AM, Tom Moore wrote:
    > It appears to me that the parameters that control the placement and
    > content of tocs apply at a document level. What I am wondering is if
    > it is possible to to set different values for 'generate.toc',
    > 'toc.section.depth', 'toc.max.dept' etc for different chapters/appendices?
    >
    > In my document (being output as chunked html) most chapters/appendices
    > only need a table of contents at the top of the chapter with
    > toc.section.depth=2, toc.max.depth=2. There are some chapters with
    > considerable detail that would benefit from also having a table of
    > contents inserted at the top sect3 with toc.max.depth=1.  And there is
    > one appendix that only needs one toc at the top with a max depth of 1.
    >
    > Is there an easy way to obtain this variety?  Or am I heading down the
    > path to madness?
    >
    > Thanks,
    >
    > Tom
    >
    >