XML technologies / DocBook / Customizing DocBook / Extending DocBook 5 / Extending DocBook with the CDList schema
(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)
To integrate the CDList schema into DocBook 5, proceed as follows:
Where should the CDList elements appear?
First decide where the CDList elements should appear. The elementcd:cd-collectionis a candidate and fits well alongside tables, equations and similar structures. The definition pattern for this purpose isdb.formal.blocks. For more definition patterns, see the table Naming conventions for DocBook 5.Creating the customization file
Create your customization file and insert the following line:
<grammar xmlns="http://relaxng.org/ns/structure/1.0"><!-- Ihre Anpassungen --></grammar>namespace cd = "http://www.example.org/ns/cd"
default namespace db = "http://docbook.org/ns/docbook"
namespace html = "http://www.w3.org/1999/xhtml"
# Ihre AnpassungenIntegrating the CDList schema
UseexternalRef/externalto reference your CD schema:
<define name="dbx.cdlist">
<externalRef href="cd-list.rng"/>
</define>dbx.cdlist =
# Lädt die Datei "cd-list.rnc" in das Muster dbx.cdlist
external "cd.rnc"Loading the DocBook schema
Integrate DocBook 5 and override the definition patterndb.formal.blocks:
<include href="docbook.rng">
<define name="db.formal.blocks" combine="choice">
<ref name="dbx.cdlist"/>
</define>
<define name="db._any">
<element>
<anyName>
<except>
<nsName ns="http://docbook.org/ns/docbook"/>
<nsName ns="http://www.w3.org/1999/xhtml"/>
<nsName ns="http://www.example.org/ns/cd"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="db._any"/>
</choice>
</zeroOrMore>
</element>
</define>
</include>include "docbook.rnc" {
db.formal.blocks |= dbx.cdlist
db._any =
element * - (db:* | html:* | cd:*) {
(attribute * { text }
| text
| db._any)*
}
}Using the customization file
Use the customization file instead of the original DocBook file (see Validating with a DocBook 5 customization file).
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