[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: DTD from extended RNC
I would like to use DocBook for a mathematics book. For that, I need to extend the DocBook 5.1 schema, to incorporate statements like "Definition", "Lemma", "Proposition", "Theorem", and "Corollary". I would like both RELAX NG and DTD versions of the extended schema; the DTD is necessary for the PSGML mode in Emacs. I have made a first attempt at extending the RNC. The resulting schema, which I've called `mono.rnc' is deemed valid by `jing': $ jing -c mono.rnc && echo "VALID" VALID I am also able to convert the RNC to an RNG with trang: $ trang mono.rnc mono.rng && echo "SUCCESS" SUCCESS Now, to use PSGML, I have to convert the RNC to a DTD. However, when I try to do that with `trang', the command aborts with several errors: $ trang mono.rnc mono.dtd /home/raghu/xml/xml/mono.rnc:14:1: error: sorry, combining definitions with combine="choice" is not supported /pkg/docbook/rng/docbookxi.rnc:264:6: error: sorry, ambiguous attribute choice not handled (attribute "type" from namespace "http://www.w3.org/1999/xlink") [...] I have enclosed the schema `mono.rnc' below. I would be grateful if you have any suggestions. I have asked this question in an ongoing thread at comp.text.xml https://groups.google.com/d/msg/comp.text.xml/SYhl-SKcKO0/qpVJIKbCBQAJ but am posting it here, because this is the canonical place for the question. Thanks, Raghu. ---------- mono.rnc ---------- # The namespace for all unqualified names. We use the prefix `db' for # it. default namespace db = "http://docbook.org/ns/docbook" ## Include the DocBook schema which allows XInclude. include "/pkg/docbook/rng/docbookxi.rnc" ## Add a new choice pattern `db.statement.blocks' to the pattern ## `db.formal.blocks'. This makes the `db.statement.blocks' pattern a ## valid option in any context where `db.formal.blocks' appears. db.formal.blocks |= db.statement.blocks ## The `db.statement.blocks' pattern is itself a choice pattern, whose ## values are the patterns that match definitions, theorems, etc. db.statement.blocks = db.corollary | db.definition | db.lemma | db.notation | db.observation | db.proposition | db.theorem ## Here is the definition of the individual values of the ## `db.statement.blocks' choice pattern. div { db.corollary = element corollary { db._statement.content } db.definition = element definition { db._statement.content } db.lemma = element lemma { db._statement.content } db.notation = element notation { db._statement.content } db.observation = element observation { db._statement.content } db.proposition = element proposition { db._statement.content } db.theorem = element theorem { db._statement.content } } ## The content of an individual value of the `db.statement.blocks' ## choice pattern. Adapted from `db.example'. div { db._statement.content = db._statement.attlist , db._statement.info , db.all.blocks + , db.caption ? db._statement.attlist = db._statement.role.attribute ? & db.common.attributes & db.common.linking.attributes & db._statement.label.attribute ? & db._statement.floatstyle.attribute ? & ( db._statement.width.attribute | db._statement.pgwide.attribute ) ? db._statement.info = db._info.title.onlyreq db._statement.role.attribute = attribute role { text } db._statement.label.attribute = db.label.attribute db._statement.floatstyle.attribute = db.floatstyle.attribute db._statement.width.attribute = db.width.characters.attribute db._statement.pgwide.attribute = db.pgwide.attribute } ---------- mono.rnc ends here ----------
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]