Printing one chapter

By setting the rootid parameter, you can tell the processor to select one chapter of a book for printing. More precisely, you tell the processor to select one element of your document to use as the root element. For printed output, the selected element must be of a type that generates a page-sequence in FO output, so it could be an appendix, reference, or preface. It must also have an id attribute, because that is the value used in the rootid parameter.

When you print a single chapter from a book, it will always be numbered 1. So you cannot assemble a book from individual chapter outputs. But printing a single chapter is useful for checking formatting and page breaking.

If you want a table of contents with the chapter, you need one more parameter. By default, chapters do not have a TOC. But the generate.toc parameter can turn one on for your single chapter.

xsltproc  --output myfile.fo  \
  --stringparam  rootid  mychapterid \
  --stringparam  generate.toc  "chapter  title,toc" \
  fo/docbook.xsl  myfile.xml

The first parameter selects the element whose id attribute is mychapterid. The second parameter turns on the TOC for chapters, and prints the Table of Contents title at the top of the TOC. If you do not want that title on the TOC, you can remove the word title (and the comma) from the parameter value.