I have a DocBook V5.0 document that used to be one .docbook
file containing the entire book. At that point, the generated TOC looked fine. Now, I have chunked the input into 4 different .docbook
files and also want chunked output.
After this change I suddenly have two problems:
- The TOC only contains four entries (one for each .docbook) rather than the full depth it used to
- Quite oddly, the TOC chapter numbers are 1, 2, and 4, then the glossary, which doesn't have a number.
About the latter, if I remove the second chapter, I get 1, 2, and the glossary, so I guess it's nothing about the second chapter's content that causes the misnumbering.
Anyway, my question is, how do I restore a normal-looking TOC while retaining chunked input and output? (The chunking could even be limited to single-file depth, i.e., one file in, one file out--but I want the TOC depth much higher.)
What I did
I made my main file look like this:
<!DOCTYPE book [
<!ENTITY a SYSTEM "a.docbook">
<!ENTITY b SYSTEM "b.docbook">
<!ENTITY c SYSTEM "c.docbook">
<!ENTITY glossary SYSTEM "glossary.docbook">
<!ENTITY larr "←">
<!ENTITY rarr "→">
<!ENTITY mdash "—">
]>
<book xmlns:xl="http://www.w3.org/1999/xlink">
<title>My Title</title>
&a;
&b;
&c;
&glossary;
</book>
My XSL is similar to before with the addition of a handful of chunking control options (but no changes to the original TOC option):
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl"/>
<xsl:output method="html"
encoding="UTF-8"
indent="no"/>
<!--new--><xsl:param name="chunk.quietly" select="1"></xsl:param>
<!--new--><xsl:param name="chunker.output.encoding">UTF-8</xsl:param>
<!--new--><xsl:param name="html.extra.head.links" select="0"></xsl:param>
<xsl:param name="html.stylesheet" select="'main.css'"/>
<xsl:param name="generate.toc">
book toc,title
</xsl:param>
<xsl:param name="glossentry.show.acronym">yes</xsl:param>
<xsl:param name="glossary.sort" select="1"></xsl:param>
<!--new--><xsl:param name="use.id.as.filename" select="1"></xsl:param>
</xsl:stylesheet>
My .docbook
files all look like this:
A ...
Except glossary.doc
which is:
Glossary
Now, I realize it may be a bit strange having a chapter within a chapter. This may even be the cause. However, it validates without warning, and also, if I make the outermost tag in a given file <section>
instead, then the entire file is missing from the TOC.