Writing, Testing, and Using a Customization Layer

The procedure for writing, testing, and using a customization layer is always about the same. In this section, we’ll go through the process in some detail. The rest of the sections in this chapter describe a range of useful customization layers.

Deciding What to Change

If you’re considering writing a customization layer, there must be something that you want to change. Perhaps you want to add an element or attribute, remove one, or change some other aspect of the schema.

Adding an element, particularly an inline element, is one possibility. For example, if you’re writing about cryptography, you might want to add a cleartext element. The next section describes how to create a customization layer to do this.

Deciding How to Change a Customization Layer

Figuring out what to change may be the hardest part of the process. For the cleartext example, there are several patterns that you could possibly change. The choice will depend on the exact focus of your document. Here are several candidates, all of which look plausible: technical inlines, programming inlines, and domain inlines. Let’s suppose you chose the domain inlines.

As shown in Example 5-1, your customization would import the DocBook schema, extend the domain inlines, and then provide a pattern that matches the new element.

Example 5-1. Adding cleartext with a customization layer

namespace db = "http://docbook.org/ns/docbook" default namespace = "http://docbook.org/ns/docbook" include ...

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.