You want to know what root elements are possible and what else is needed to create a DocBook V5 document.
A document type definition (DTD) allows every definied element to become a root element. A DTD cannot express any constraints to limit this set. On the other hand, RELAX NG—the official schema language for DocBook 5 and up—can impose such constraints.
To create a valid DocBook V5 document you need:
A valid DocBook V5 element to begin your document.
An attribute version
containing the used DocBook version.
The DocBook 5 namespace, possibly other namespaces too.
To assemble all the above hints, a valid DocBook 5 document could look like this:
There are many more possible root elements, not only book
.
Using the list from the last section, a valid DocBook V5
element to start with can be:
acknowledgements | dedication | reference | sect3 |
appendix | glossary | refsect1 | sect4 |
article | index | refsect2 | sect5 |
bibliography | para | refsect3 | section |
book | part | refsection | set |
chapter | preface | sect1 | setindex |
colophon | refentry | sect2 | toc |
For the next DocBook release, V5.1, the technical committee plans to include all elements that can contain an info wrapper.
Regarding namespaces, DocBook 5 uses only one namespace (which is
http://docbook.org/ns/docbook
).
However, sometimes it is needed to include other in order to
adhere to the XML specification.
A namespace declaration consists of an (optional) namespace prefix and a namespace URI. The prefix may be selected arbitrarily, however, it is recommended to use the prefixes from Table 1.1, “Common Prefixes and Their Namespaces”. Although they are not a “standard” in its strict sense, over time they have been extensively used.
Prefix | Namespace |
---|---|
d [a], db | http://docbook.org/ns/docbook |
fo | http://www.w3.org/1999/XSL/Format |
h | http://www.w3.org/1999/xhtml |
mml | http://www.w3.org/1998/Math/MathML |
rng | http://relaxng.org/ns/structure/1.0 |
svg | http://www.w3.org/2000/svg |
xi | http://www.w3.org/2001/XInclude |
xlink | http://www.w3.org/1999/xlink |
xsd | http://www.w3.org/2001/XMLSchema |
xsl | http://www.w3.org/1999/XSL/Transform |
[a] In this book the DocBook prefix is omitted and the standard namespace is used. |
Usually it is a good idea to insert all the namespaces used in
the document into the root element. Example 1.2, “Start Tag with Several Namespace Declarations”, shows three namespace
declarations: the DocBook namespace, using no prefix; the XInclude
namespace using the xi
prefix, and the XLink
namespace using the xlink
prefix.
Project@GitHub | Issue#6 |