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

Reply via email to