You may want to generate output for only part of large DocBook document. For example, you might need just one book from a set document, one chapter from a book document, or one refentry page from a reference document. When you are developing a back-of-book index, it helps to periodically generate only the index output so you can check it. The DocBook XSL stylesheets have a parameter that lets you output part of a document.
There are two conditions to use this feature:
If these two conditions are met, then generating output for one element is easy. You process the document as you normally would, but you set the stylesheet parameter
rootid to the
value of the element you want to process. For example, if you have
a book with three chapters:
<book> <chapter id="intro"> ... </chapter> <chapter id="using"> .. </chapter> <chapter id="administering"> ... </chapter> </book>
You can generate an HTML file for the second chapter with a command like the following:
xsltproc \ --stringparam rootid "using" \ --output chap2.html \ html/docbook.xsl myfile.xml
chap2.html output file will contain just the second chapter. Note these features:
The entire document is still parsed, so there will not be signficant savings of processing time.
The content is still processed within the context of the entire document, so it will still be labeled "Chapter 2".
Any cross references to other chapters will be properly formed, but the links will not actually go anywhere because the targets are not included in the output.
|DocBook XSL: The Complete Guide - 4th Edition||PDF version available|
Copyright © 2002-2007 Sagehill Enterprises