XML technologies / DocBook / Customizing DocBook / Considerations before customization
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
Before customizing DocBook to your needs, consider the following points:
Which DocBook version? There is no universal answer; the choice depends on the author’s circumstances and objectives. Some advantages of the newer version are described in Differences between DocBook 4 and 5. If your applications support only DocBook 4, it is better to stay with that version. To customize DocBook or use the newer version’s advantages, DocBook 5 may be the better choice.
Estimating effort The following list describes the effort required for each type of customization. Write your customization so that others can customize it as easily as DocBook itself. The list is ordered by difficulty, starting with the easiest:
- No customization
This is the simplest and most convenient approach. If you still need “new elements” without customizing DocBook, the only option is to use a general DocBook attribute, such as
roleorcondition. This gives the element an additional property that allows XSLT to distinguish it from elements of the same name without that attribute.- Removing elements or attributes
This is the least intrusive customization: you create only a subset of DocBook and remain compatible. No stylesheet changes are required. If your customization is unavailable, you can always switch to the original DocBook schema.
- Adding new elements or attributes
New elements extend DocBook and are therefore incompatible with the original schema. They inevitably require stylesheet customization, whether they are transformed or suppressed.
- Integrating a schema into DocBook
Integrating another schema into DocBook is essentially the same as adding new elements and attributes. The challenge is finding the points in DocBook where the new schema connects.
Fewer elements? Check whether Simplified DocBook is an alternative for you. It contains only a fraction of the full schema.
Restricting attributes For some attributes, it is useful to allow only certain values. For example, if you write in only two languages, you could permit only those languages.
Note: Customizing DocBook is only half the work
Customizing DocBook is only half the work. The DocBook stylesheets do not recognize new elements, so you must write a stylesheet customization file for them or receive an error message. Removing elements requires no stylesheet customization.
What are the advantages and disadvantages of customizing DocBook? Here is a brief overview:
Advantages of customization
DocBook can be adapted to your needs.
Content models can be simplified so that users are not overwhelmed by too many choices.
Customization can provide attributes with a selection of useful values and define defaults.
Customization lets you test scenarios or integrate new ideas that will appear only in future versions.
Disadvantages of customization
After customization, you no longer have original DocBook. This can confuse applications expecting a standard DocBook document.
New elements require stylesheet customization.
A customization is tied to a particular DocBook version. New features and bug fixes are therefore not necessarily adopted automatically; they must first be enabled.
When exchanging documents, always include the customization file. For a document based on the original DocBook schema, the recipient is more likely to already have the schema.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top