Why I like RELAX NG
There are a lot of reasons why I really enjoy working with RELAX NG. Here’s one of them; how to customize DocBook to rip out all computer related structures, but add a few (like better bibliographic metadata) very useful for social science and humanities scholars:
# customization for scholarly writing
namespace db = "http://docbook.org/docbook-ng"
namespace mods = "http://www.loc.gov/mods/v3"
default namespace = "http://docbook.org/docbook-ng"
include "mods-3-0.rnc" { extensionSchema = db._any }
include "docbook-ng.rnc" {
db.any = element * - (db:|mods:) { db.any.attribute, (text, db._any) }
# remove all the main software/technology related definitions db.domain.inlines = notAllowed db.product.inlines = notAllowed db.technical.blocks = notAllowed db.verbatim.blocks = notAllowed db.synopsis.blocks = notAllowed # add a new element to quote db.quote = element quote { db.quote.attlist, (db.all.inlines | hb.nonquote)* } # add mods to bibliography element db.bibliography = element bibliography { db.bibliography.attlist, db.bibliography.info, db.all.blocks*, (db.bibliodiv+ | (ModsSchema | db.biblioentry | db.bibliomixed)+) } }
# nonquote pattern allows for semantic rendering of split quotes like: # "The world," the guy said, "is flat." hb.nonquote = element nq { empty }
Thanks to Norm Walsh for solving a stupid problem (I had the wrong namespace declaration), and adding a clever addition (any DocBook namespaced content to the MODS extension element).
Creative Commons License