XML technologies / DocBook / Customizing DocBook / Extending DocBook 5 / Extending DocBook with SVG
(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)
SVG (Scalable Vector Graphics) is used to draw vector graphics. In DocBook, SVG is supported through the pattern db._any.svg, which, like db._any.mml, acts as an ‘anchor’. Override it with SVG elements to make the graphic markup elements available within imageobject.
To add these elements to DocBook, proceed as follows:
Downloading the SVG RELAX NG schema
Download the SVG RELAX NG schema.Creating a customization file
Create a customization file (for exampledbsvg.rncordbsvg.rng):Example: Customization file for DocBook with SVG
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<include href="docbook.rng">
<define name="db._any.svg">
<externalRef href="svg11.rng" ns="http://docbook.org/ns/docbook"/>
</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.w3.org/2000/svg"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="db._any"/>
</choice>
</zeroOrMore>
</element>
</define>
</include>
</grammar>default namespace db = "http://docbook.org/ns/docbook"
namespace svg ="http://www.w3.org/2000/svg"
namespace html = "http://www.w3.org/1999/xhtml"
include "docbook.rnc" {
db._any.svg = external "svg11.rnc"
db._any = element * - (db:* | html:* | svg:*) {
(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).
For information about the SVG specification, see W3C: Scalable Vector Graphics (SVG) 1.1.
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