Roots: Starting Your DocBook Document

There’s one final detail of the physical and logical structures of DocBook that we’ve left out: where can your document begin? In other words, what are the valid document elements of DocBook documents? Naturally, you can start at set and book, but can you also start at chapter? What about para or personname?

If you come to DocBook from the DTD days, this question may seem odd. A DTD doesn’t provide any facility to impose constraints on where a document can begin. If the element occurs in the DTD, you can start with it.

RELAX NG does give us the ability to impose such constraints. In fact, it requires that we do. Of course, we could make the constraint vacuous by listing every possible element as a potential document element.

But, on reflection, that’s not necessarily the best choice. It’s valuable to have metadata associated with documents, so only elements with an info element can be root elements, but not every element with an info element is currently included. In DocBook V5.0 the following elements are available: acknowledgements, appendix, article, bibliography, book, chapter, colophon, dedication, glossary, index, para, part, preface, refentry, reference, refsect1, refsect2, refsect3, refsection, sect1, sect2, sect3, sect4, sect5, section, set, setindex, and toc.

With the next point release of DocBook, V5.1, the technical committee may take the position that any element that can contain an info wrapper can be a document element. This would ...

Get DocBook 5: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.