XML technologies / DocBook / Customizing DocBook / DocBook 5 structure / Writing a customization file for DocBook 5

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Writing a DocBook 5 customization file is straightforward: reference the original version and override parts of its definition patterns with your changes. You can choose any filename. The following example shows an empty customization file.

Example: Empty customization file for DocBook RELAX NG

RNG

<?xml version="1.0" encoding="UTF-8"?>
<!-- Evtl. deklarieren weiterer Namensräume in grammer: -->
<grammar xmlns:db="http://docbook.org/ns/docbook" ns="http://docbook.org/ns/docbook" xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="docbook.rng">
    <!-- Ersetzen oder Umdefinieren von DocBook-Mustern --> 
  </include>
  <!-- Neue Muster definieren -->
</grammar>

RNC

default namespace db = "http://docbook.org/ns/docbook"
# Evtl. deklarieren weiterer Namensräume
include "docbook.rnc" { # Ersetzen oder Umdefinieren von DocBook-Mustern }
# Neue Muster definieren

RNG line 3 and RNC line 1: Declare the DocBook namespace.
RNG line 4 and RNC line 3: Load the DocBook schema using include. Use the correct extension (rng or rnc).
RNG line 5 and RNC line 3: Define your customized patterns here. Your definition overrides the imported schema’s definition.
RNG line 7 and RNC line 4: Define new patterns or extend existing ones.

This is a minimal customization file: it neither defines new elements nor overrides patterns. Combining additional RELAX NG schemas with DocBook requires more namespaces and patterns.

  

back to top