XML technologies / DocBook / Generating (X)HTML / Generating linked chunks / Manual control of chunking

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

If some chunks are too short or too long, you can adjust chunking manually. Proceed as follows:

  1. Applying the stylesheet maketoc.xsl
    Apply the stylesheet maketoc.xsl to your DocBook document. This generates an XML file containing DocBook elements, mainly tocentry.

xsltproc --output toc.xml html/maketoc.xsl mydocument.xml 

  1. Editing the generated file
    Edit the generated file toc.xml and remove all tocentry elements that should be written to the same file as their parent. Conversely, add tocentry elements to create separate files. Part of the file toc.xml looks roughly like this:

<?xml version="1.0" encoding="UTF-8"?> 
<toc role="chunk-toc"> 
  <tocentry linkend="docbook-xml"><?dbhtml filename="index.html"?> 
    <tocentry linkend="preface"><?dbhtml filename="pr01.html"?> 
      <tocentry linkend=""><?dbhtml filename="pr01s02.html"?></tocentry> 
  ... 
</toc>

To change filenames, edit only the processing instructions. Keep the attribute linkend unchanged.

  1. Processing your document with chunktoc.xsl
    Process your document with the stylesheet chunktoc.xsl and also set the parameter chunk.toc to the filename from step 1 above:

xsltproc --stringparam chunk.toc toc.xml \ 
    html/chunktoc.xsl mydocument.xml

This command splits the document mydocument.xml according to your settings in toc.xml.

Each element needs an anchor to be written to a separate chunk. Otherwise, it is written to the same file as its parent (see the third tocentry element in step 2 above).

  

back to top