+
+
+
3.17. Changes in DocBook V5.0
+
+
+
In V5.0, DocBook has been rewritten as a native RELAX NG grammar. The goals of this redesign were to produce a schema that:
+
+
+-
+
“feels like” DocBook. Most existing documents should still be valid or it should be possible to transform them in simple, mechanical ways into valid documents.
+
+-
+
enforces as many constraints as possible in the schema. Some additional constraints are expressed with Schematron rules.
+
+-
+
cleans up the content models.
+
+-
+
gives users the flexibility to extend or subset the schema in an easy and straightforward way.
+
+-
+
can be used to generate XML DTD and W3C XML Schema versions of DocBook.
+
+
+
+
Under the ordinary operating rules of DocBook evolution, the only backwards incompatible changes that could be made in DocBook V5.0 were those announced in DocBook V4.0. In light of the fact that this is a complete rewrite, the Technical Committee gave itself the freedom to make "unannounced" backwards-incompatible changes for this one release.
+
+
+
+
3.17.1. Removing Legacy Elements
+
+
+
A number of elements have been removed from DocBook. Many of these have been replaced by simpler, more versatile alternatives. Others have simply been removed because they are not believed to be widely used.
+
+
Table 1. DocBook Element Changes
+
+
+
+
+
+
+
+Element(s) |
+Explanation |
+
+
+
+
+
+ articleinfo , bookinfoinfo , …, * info
+ |
+
+ Replaced by info , see Section 3.17.3, “Uniform Info Elements”.
+ |
+
+
+
+ authorblurb
+ |
+
+ Replaced by personblurb . This more general name better reflects the fact that it is available in elements other than author (e.g., editor ).
+ |
+
+
+
+ collabname , corpauthor , corpcredit , corpname
+ |
+
+ Replaced by orgname and the updated content models of author , editor , and othercredit .
+ |
+
+
+
+ graphic , graphicco , inlinegraphic , mediaobjectco
+ |
+
+ Removed in favor of mediaobject and inlinemediaobject .
+ |
+
+
+
+ isbn , issn , pubsnumber
+ |
+
+ Replaced by biblioid .
+ |
+
+
+
+ lot , lotentry , tocback , tocchap , tocfront , toclevel1 , toclevel2 , toclevel3 , toclevel4 , toclevel5 , tocpart
+ |
+
+ Replaced by simpler tocdiv element.
+ |
+
+
+
+ ulink
+ |
+
+ Replaced by ubiquitous linking, see Section 3.17.9, “Universal Linking”.
+ |
+
+
+
+ sgmltag
+ |
+
+ Replaced by tag .
+ |
+
+
+
+ action , beginpage , highlights , interface , invpartnumber , medialabel , modespec , structfield , structname
+ |
+
+ Removed.
+ |
+
+
+
+
+
+
+
+
+
+
3.17.2. Smaller Content Models
+
+
+
The content models of many inlines have been reduced, sometimes drastically. The parameter entity customization of DocBook V4.x and previous versions resulted in very broad content models for some inlines.
+
Consider, for example, command
in DocBook V4.4:
+
+command ::=
+ (#PCDATA|link|olink|ulink|action|application|classname|methodname|
+ interfacename|exceptionname|ooclass|oointerface|ooexception|
+ command|computeroutput|database|email|envar|errorcode|errorname|
+ errortype|errortext|filename|function|guibutton|guiicon|guilabel|
+ guimenu|guimenuitem|guisubmenu|hardware|interface|keycap|keycode|
+ keycombo|keysym|literal|code|constant|markup|medialabel|
+ menuchoice|mousebutton|option|optional|parameter|prompt|property|
+ replaceable|returnvalue|sgmltag|structfield|structname|symbol|
+ systemitem|uri|token|type|userinput|varname|nonterminal|anchor|
+ remark|subscript|superscript|inlinegraphic|inlinemediaobject|
+ indexterm|beginpage)*
+
+
In DocBook V5.0, command
has a much smaller, more rational content model:
+
+command ::=
+
+ * Zero or more of:
+ o text
+ o alt
+ o anchor
+ o annotation
+ o biblioref
+ o indexterm
+ o inlinemediaobject
+ o link
+ o phrase
+ o remark
+ o replaceable
+ o subscript
+ o superscript
+ o xref
+
+
DocBook V5.0 may be overzealous in its simplification of content models. The Technical Committee expects to adjust these simplifications during user testing. Users are encouraged to report places where formally valid documents can no longer be made valid because content models have been reduced.
+
+
+
+
+
3.17.3. Uniform Info Elements
+
+
+
DocBook V4.x has setinfo
, bookinfo
, chapterinfo
, appendixinfo
, sectioninfo
, etc. DocBook would be smaller and simpler if it had a single info
element in all these places.
+
There’s an historical reason for the large number of unique names: customizers might very well want to adjust the content models of info elements at different levels. For example, a copyright statement might be required at the book level, or an author forbidden at the sub-section level. In DTDs, there’s only one content model allowed per element name, so in order to support independent customization, each info element must have a different name.
+
In RELAX NG, no such limitation exists. We can use patterns to achieve both a single info
element while still allowing customizers to change its content model in different contexts. In light of this functionality, we've replaced all the various flavors of info with a single element name.
+
+
+
+
+
3.17.4. Required Titles
+
+
+
DocBook V5.0 enforces the constraint that titles are required on article
s and other large structures where they are effectively optional in DocBook V4.x. (They are optional only in the sense that DTDs are unable to enforce the constraint that they be present, the documentation has always made it clear that titles were required.)
+
+
+
+
+
3.17.5. Required Version
+
+
+
In DocBook V4.x and earlier, the presence of a document type declaration served as a mechanism for identifying the DocBook version of a document. Although the declaration was not actually required, it was present in the vast majority of DocBook documents.
+
In RELAX NG, no similar declaration exists. Although a document type declaration might still be present, it seems likely that this will not usually be the case.
+
Nevertheless, downstream processors may benefit from some indication of the version of DocBook being used. As a result DocBook V5.0 adds a new version
attribute which must be present on the document element of a DocBook document.
+
Mixing versions is explicitly allowed and the version attribute may be used on other elements as well. This might be the case, for example, in a compound document constructed from multiple documents each with its own version.
+
+
+
+
+
3.17.6. Co-Constraints
+
+
+
DocBook V5.0 enforces attribute co-constraints such as the class
/otherclass
attributes on biblioid
.
+
+
+
+
+
3.17.7. Improved HTML and CALS Table Support
+
+
+
In DocBook V5.0, HTML tables and CALS tables are independently specified. Where the DTD of DocBook V4.x allows for incoherent mixing of the two models, DocBook V5.0 forbids such mixtures.
+
+
+
+
DocBook V5.0 adds a few simple data types. For example, the cols
attribute on tgroup
must be a positive integer.
+
Some of these constraints, such as the requirement that elements like pubdate
include a proper date-time type, may prove controversial. Users are encouraged to report places where formally valid documents can no longer be made valid because data types have been introduced.
+
+
+
+
+
3.17.9. Universal Linking
+
+
+
Starting with DocBook V5.0, the linkend
and xlink:href
attributes are available on almost all elements.
+
The linkend
attribute provides an ID/IDREF link within the document. The xlink:href
attribute provides a URI-based link.
+
The ulink
element has been removed from DocBook as URI-based links can now be achieved directly from the appropriate inline (such as productname
or command
). For instances where no specific semantic inline is needed, link
is still available. Where link
used to be limited to ID/IDREF linking, it now sports an xlink:href
attribute as well.
+
Support for extended links are provided through the extendedlink
, arc
, and locator
elements.
+
+
+
+
+
3.17.10. Improved Accessibility
+
+
+
Accessibility is improved by allowing both inline and block annotations in most context. The alt
element is now allowed in most places for inline annotations, the new element annotation
supports block annotations.
+
+
+
+
+
3.17.11. Simplified Table of Contents Markup
+
+
+
The DocBook V4.x markup for Tables of Contents, or more generally for Lists of Titles, was complex and had not evolved quite in step with the rest of DocBook. In DocBook V5.0, it has all been replaced by a quite simple, recursive toc
/tocdiv
/tocentry
structure.
+
While most Tables of Contents and Lists of Titles are generated automatically and authors never have to produce markup for them by hand, this simplified content model should make it easier for authors to generate them when necessary. One possible application of hand-authored toc
markup is to generate custom hierarchies which can be assembled on-the-fly from a library of topics marked up in DocBook.
+
+
+
+
+
3.17.12. Extra-Grammatical Constraints
+
+
+
Grammar based validation technologies (like RELAX NG) and rule based validation technologies (like Schematron) are naturally complementary. Mixing them allows us to play to the strengths of each without stretching either to enforce constraints that they aren’t readily designed to enforce.
+
For example, DocBook NG requires that the root element of a document have an explicit version attribute. Because there are a great many elements that can be root elements in DocBook, and because they can almost all appear as descendants of a root element as well, it would be tedious to express this constraint in RELAX NG. But it is easy in a rule-based schema language.
+
DocBook V5.0 uses Schematron where appropriate.
+
+
+
+
+
3.17.13. Customization
+
+
+
From the very beginning, one of the goals of DocBook has been that users should be able to produce customizations that are either subsets of extensions of DocBook.
+
Customization is possible in DocBook V4.x, but because of the intricacies of XML DTD syntax and the complex and highly stylized patterns of parameter entitiy usage in DocBook, it's not as easy as we would like it to be.
+
In DocBook V5.0, we hope to take advantage of RELAX NGs more robust design (and it's lack of pernicious determinism rules) to make customization easier.
+
Three schema design patterns get us most of the way there.
+
+
+
+
3.17.13.1. Logical Groupings
+
+
+
DocBook elements, particularly the inlines, can be divided into broad classes: general purpose, technical, error-related, operating-system related, bibliographic, publishing, etc. In DocBook V5.0, these are collected together in named patterns.
+
To add a new inline, endpoint
for example, to the list of technical inlines, one need only extend the appropriate pattern. If an element should appear in several classes, they can all be extended in the same way:
+
+db.technical.inlines |= endpoint
+db.programming.inlines |= endpoint
+db.os.inlines |= endpoint
+
+
Much the same concept was used in DocBook V4.x, where instead of patterns we had parameter entities. However, the constraints of DTD validation severely limit the circumstances under which an element can appear twice in a content model. That meant that adding an element to one parameter entity might make it an error to add it to another. Such constraints do not exist in RELAX NG which greatly simplifies the customization.
+
+
+
+
+
3.17.13.2. Element Definitions
+
+
+
Each element in DocBook V5.0 is defined by its own pattern. To change the content model of an element, only that pattern need be redefined. To remove an element from DocBook, that pattern can be redefined as "notAllowed
".
+
+
+
+
+
3.17.13.3. Attribute Definitions
+
+
+
Each attribute list in DocBook V5.0 is defined by its own pattern. To change the list of attributes available on an element, only that pattern need be redefined. To remove all the attributes, that pattern can be redefined as "empty
".
+
+
+
+
+
There’s an XSLT 1.0 stylesheet for performing conversion from DocBook V4.x to DocBook V5.0. Presented with a valid DocBook V4.x document, it attempts to produce a valid DocBook V5.0 document.
+
It succeeds entirely automatically for the most part, though human intervention is suggested for constructs that might have multiple interpretations (and therefore multiple possible transformations).
+
Users are encouraged to report documents that are not successfully transformed by the stylesheet, especially those which do have valid DocBook V5.0 representations.
+
+