OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Creating a new admonition (db5)


Hi Brett,

On Mittwoch, 18. Juli 2007, Brett Leber wrote:
>
> I'd like to create a new admonition element, "DataShop Tip", 
> [...]
>
> 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?

As far as I can tell, it works for me. :)


> I'll also need to create an XSLT
> template for this new element, so any advice for that step would be
> appreciated as well.

You have to write a customization layer[1]. It's a very similar method 
that you applied for your DocBook schema.

Use the stylesheets from [2] with the name "docbook-xsl-ns-snapshot.zip". 
Roughly speaking, it's "optimized" for DocBook 5. ;) 

Your customization layer looks like this:

-------------------------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
    xmlns:d="http://docbook.org/ns/docbook";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<!-- Or replace it with .../html/chunk.xsl -->
<xsl:import href="docbook-xsl-ns-snapshot/html/docbook.xsl"/> 

<xsl:template match="d:datashoptip">
  <!-- Insert your own changes -->
</xsl:template>

<xsl:template match="d:datashoptip/d:title"/>

</xsl:stylesheet>
-------------------------------------------------------------------

For details see html/admon.xsl. I think it should be easy, as you need 
just to copy some contents from the db:note|db:caution... template.


Hope that helps,
Tom

[1] http://www.sagehill.net/docbookxsl/CustomMethods.html
[2] http://docbook.sourceforge.net/snapshots/

-- 
Thomas Schraitle


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]