XML technologies / DocBook / Customizing DocBook / DocBook 5 structure / Examples of commonly needed patterns
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
Important element patterns include:
db._any-
db._text Contains text and the patterns
db.ubiq.inlines,db._phraseanddb.replaceable.-
db._title Contains titles such as
title,titleabbrevandsubtitle, all optional.-
db._title.req Like
db._title, but atitleis required.-
db._title.only Only two optional titles,
titleandtitleabbrevare available-
db._title.onlyreq Like
db._title.only, buttitleis required.-
db.all.blocks Contains all block elements from different categories:
db.nopara.blocks,db.para.blocks,db.extension.blocksanddb.annotation.-
db.all.inlines Contains all inline elements from different categories:
db.ubiq.inlines,db.general.inlines,db.domain.inlinesanddb.extension.inlines.
Important attribute patterns include:
db.effectivity.attributesContains references to the attributes
audience,condition,conformance,os,revision,security,userlevel,vendorandwordsize-
db.href.attributes Contains all attributes of XLink
-
db.common.attributes Contains
db.effectivity.attributeand the attributesannotations,dir,remap,revisionflag,version,xml:base,xml:id(optional),xml:langandxreflabel.-
db.common.idreq.attributes Like
db.common.attributes, but the attributexml:idmust be specified.
The example of book explains the individual components in more detail.
Example: Structure of book in DocBook 5
RNC
div {
db.book.status.attribute = db.status.attribute
db.book.role.attribute = attribute role { text }
db.book.attlist =
db.book.role.attribute?
& db.common.attributes
& db.common.linking.attributes
& db.label.attribute?
& db.book.status.attribute?
db.book.info = db._info.title.req
db.book =
## A book
# Ausgeblendetes Schematronmuster
element book {
db.book.attlist,
db.book.info,
(db.navigation.components | db.components | db.divisions)+
}
}RNG
<div>
<define name="db.book.status.attribute">
<ref name="db.status.attribute"/>
</define>
<define name="db.book.role.attribute">
<attribute name="role"/>
</define>
<define name="db.book.attlist">
<interleave>
<optional>
<ref name="db.book.role.attribute"/>
</optional>
<ref name="db.common.attributes"/>
<ref name="db.common.linking.attributes"/>
<optional>
<ref name="db.label.attribute"/>
</optional>
<optional>
<ref name="db.book.status.attribute"/>
</optional>
</interleave>
</define>
<define name="db.book.info">
<ref name="db._info.title.req"/>
</define>
<define name="db.book">
<element name="book">
<a:documentation>A book</a:documentation>
<!-- Ausgeblendetes Schematronmuster -->
<ref name="db.book.attlist"/>
<ref name="db.book.info"/>
<oneOrMore>
<choice>
<ref name="db.navigation.components"/>
<ref name="db.components"/>
<ref name="db.divisions"/>
</choice>
</oneOrMore>
</element>
</define>
</div>RNC and RNG line 2: Reference to the attribute declaration of status.
RNC line 3 and RNG line 5: Attribute declaration of role.
RNC line 4 and RNG line 8: Attribute list of a book.
RNC line 10 and RNG line 23: Content model of info inside a book.
RNC line 12 and RNG line 28: Element documentation.
RNC line 13 and RNG line 29: Schematron pattern, explained in Schematron in more detail.
RNC line 14 and RNG line 27: Element declaration of book with its content model.
RNC line 17 and RNG line 32: References to other components of a book.
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