Beispiele häufig benötigter Muster
(Auszug aus "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" von Thomas Schraitle)
Einige wichtige Muster für Elemente sind:
- db._any
Irgendein Element aus irgendeinem Namensraum (außer von DocBook und XHTML)
- db._text
Enthält Text und die Muster db.ubiq.inlines, db._phrase und db.replaceable.
- db._title
Enthält Titel wie title, titleabbrev und subtitle, die alle optional sind.
- db._title.req
Wie bei db._title, jedoch ist ein title erforderlich.
- db._title.only
Es sind nur zwei optionale Titel, title und titleabbrev verfügbar
- db._title.onlyreq
Wie bei db._title.only, jedoch ist title erforderlich.
- db.all.blocks
Enthält alle Block-Elemente aus verschiedenen Kategorien: db.nopara.blocks, db.para.blocks, db.extension.blocks und db.annotation.
- db.all.inlines
Enthält alle Inline-Elemente aus verschiedenen Kategorien: db.ubiq.inlines, db.general.inlines, db.domain.inlines und db.extension.inlines.
Einige wichtige Muster für Attribute sind:
- db.effectivity.attributes
Enthält Verweise auf die Attribute audience, condition, conformance, os, revision, security, userlevel, vendor und wordsize
- db.href.attributes
Enthält alle Attribute von XLink
- db.common.attributes
Enthält db.effectivity.attribute und die Attribute annotations, dir, remap, revisionflag, version, xml:base, xml:id (optional), xml:lang und xreflabel.
- db.common.idreq.attributes
Wie db.common.attributes, jedoch muss das Attribut xml:id angegeben werden.
Am Beispiel von book werden die einzelnen Bestandteile nochmals erklärt.
Beispiel: Aufbau von 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>
Zeile 2 RNC und RNG: Verweis auf die Attributdeklaration von status.
Zeile 3 RNC und Zeile 5 RNG: Attributdeklaration von role.
Zeile 4 RNC und Zeile 8 RNG: Attributliste eines Buches.
Zeile 10 RNC und Zeile 23 RNG: Inhaltsmodell von info innerhalb eines Buches.
Zeile 12 RNC und Zeile 28 RNG: Dokumentation zum Element.
Zeile 13 RNC und Zeile 29 RNG: Schematronmuster. Wird in Schematron genauer erklärt.
Zeile 14 RNC und Zeile 27 RNG: Elementdeklaration von book mit dem Inhaltsmodell.
Zeile 17 RNC und Zeile 32 RNG: Verweise auf weitere Bestandteile eines Buches.
<< zurück | vor >> |
Copyright © 2009 Millin Verlag
Für Ihren privaten Gebrauch dürfen Sie die Online-Version ausdrucken.
Ansonsten unterliegt dieses Kapitel aus dem Buch "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" denselben Bestimmungen, wie die gebundene Ausgabe: Das Werk einschließlich aller seiner Teile ist urheberrechtlich geschützt. Alle Rechte vorbehalten einschließlich der Vervielfältigung, Übersetzung, Mikroverfilmung sowie Einspeicherung und Verarbeitung in elektronischen Systemen.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de