Re: Changing toc parameter values by chapter

Bob Stayton <[email protected]> Wed, 24 May 2023 11:18:00 -0700
Newsgroups gmane.text.docbook.apps
Message-ID <[email protected]>
--------------w420bIAZqhmwm0d7k9xwvXBk
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

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
>
>
--------------w420bIAZqhmwm0d7k9xwvXBk
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif">If you
          are using the XSLT 1 stylesheets, then placing an empty
          &lt;toc&gt; 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.  <br>
        </font></font></p>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif"><a class="moz-txt-link-freetext" href="https://docbook.sourceforge.net/release/xsl/current/doc/fo/process.empty.source.toc.html">https://docbook.sourceforge.net/release/xsl/current/doc/fo/process.empty.source.toc.html</a><br>
        </font></font></p>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif">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:<br>
        </font></font></p>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif">&lt;xsl:template
          match="chapter/toc | appendix/toc | preface/toc |
          article/toc"&gt;<br>
        </font></font></p>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif">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.</font></font></p>
    <p><font size="2"><font face="Helvetica, Arial, sans-serif">Bob</font></font><br>
    </p>
    <div class="moz-cite-prefix">On 5/24/2023 6:45 AM, Tom Moore wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANwy9RSZX7idp=8Kj13VVkk_n4yNdJxwjP8HJ6+=L_wUu_50bQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>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?</div>
        <div><br>
        </div>
        <div>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.</div>
        <div><br>
        </div>
        <div>Is there an easy way to obtain this variety?  Or am I
          heading down the path to madness?<br>
        </div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Tom<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
    </blockquote>
  </body>
</html>

--------------w420bIAZqhmwm0d7k9xwvXBk--