← Prev in month ← Prev in thread

Creating a new admonition (db5)

From
Brett Leber <>
Date
2007-07-18T13:29:28+00:00
ID
Thread
Creating a new admonition (db5)
Hello,

I'd like to create a new admonition element, "DataShop Tip", that 
resembles the existing "tip" element except that instead of outputting 
the text "Tip" and the "tip" image, it outputs "DataShop Tip" and an 
image of my own (and it gives the div element a "datashop-tip" class name).

I followed Jirka Kosek's "DocBook specialization made easy" [1], and 
I've come up with the following (don't laugh if this is wildly 
inaccurate--I know nothing about Relax NG and little about DTDs):

default namespace = "http://docbook.org/ns/docbook"
namespace db = "http://docbook.org/ns/docbook"
namespace r  = "http://nwalsh.com/xmlns/schema-remap/"

div {
   db.datashoptip.role.attribute = attribute role { text }
   db.datashoptip.attlist =
     db.datashoptip.role.attribute?
     & db.common.attributes
     & db.common.linking.attributes
   db.datashoptip =
     [ r:remap [ db:tip [ ] ] ]
     element datashoptip { db.datashoptip.attlist, 
db.admonition.contentmodel }
}

# combined pattern
ds.admonition.blocks = db.datashoptip

include "file:///e:/docbook.rnc"
   {
     # datashop admonitions are permitted everywhere that regular 
admonitions are
     db.admonition.blocks |= ds.admonition.blocks
   }


How does this look for the .rnc file? I'll also need to create an XSLT 
template for this new element, so any advice for that step would be 
appreciated as well.

Thanks,

Brett


[1] http://xmlguru.cz/2006/03/easy-docbook-specialization
← Prev in month ← Prev in thread