The Crash Course to DocBook

Chapter 3. Basic notions

3.1. Anatomy of a DocBook Tag

A DocBook tag consists of an element and attributes. For example, <chapter id="introduction"> contains the element chapter and the attribute id. The element modifies the text within the markup, and the element's attributes modify the element. For example, the chapter element says that all text included within the starting and closing tags should be treated as a chapter, while the id attribute labels the chapter so it can be linked to or used as a file name when DocBook is translated to another format.

Most DocBook tags contain a common set of attributes. The common attributes that you will be using most often are lang, which specifies the language of the data inside the tag, and id, which labels the tag.


All (or nearly all) DocBook tags must have a start and an end tag. If you read through the DocBook Reference you will notice that not all DocBook tags are required to have both start and end tags. Omitting the ending tags where they are not required is not usually a good idea because it will work only with SGML DocBook and not with XML DocBook.

Also, make sure to follow the proper case of the tag because XML is picky about the case of tags.

For detailed information about tags and a list of all available tags, see the DocBook Reference and the DocBook Quick Reference. Those guides currently address the version 3.1 of DocBook but they can be applied with little modifications to earlier or latter versions.