Processing part of a document

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 id attribute value of the element you want to process. For example, if you have a book with three chapters:

<chapter id="intro">
<chapter id="using">
<chapter id="administering">

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

The chap2.html output file will contain just the second chapter. Note these features: