Stephane Bortzmeyer | 27 Apr 2005 12:02
Picon

Docbook customization


I'm a recent user of nxml-mode and a less recent user of Docbook
customization. I do things like:

<!ELEMENT rfc EMPTY>
<!ATTLIST rfc num CDATA #IMPLIED>

<!ENTITY % local.para.char.mix
        "|rfc">

or like:

<!-- New attributes -->
<!ENTITY % local.common.attrib 
      "osversionequal CDATA #IMPLIED
       osversionmin   CDATA #IMPLIED
       osversionmax   CDATA #IMPLIED">

psgml read them and process them fine. How to do with nxml? Can I
customize the RelaxNG schema? Or should I go on with the DTD and use
trang to translate to a RelaxNG file?

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> To unsubscribe from this group, send an email to:
    emacs-nxml-mode-unsubscribe <at> yahoogroups.com
(Continue reading)

Vincent Lefevre | 27 Apr 2005 12:27

Re: Docbook customization


On 2005-04-27 12:02:32 +0200, Stephane Bortzmeyer wrote:
> Can I customize the RelaxNG schema?

Yes, this is what I do. For instance, to add an attribute:

local.<elementname>.attrib |= attribute <attributename> { ... }

--

-- 
Vincent Lefèvre <vincent <at> vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> To unsubscribe from this group, send an email to:
    emacs-nxml-mode-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Bruce D'Arcus | 27 Apr 2005 13:31

Re: Docbook customization


On Apr 27, 2005, at 6:02 AM, Stephane Bortzmeyer wrote:

> Can I customize the RelaxNG schema? Or should I go on with the DTD and 
> use
> trang to translate to a RelaxNG file?

Yes, you can customize a RNG schema; big time!  Particularly if it's 
designed to be customized.

Here's my own example:

# 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
(Continue reading)

Stephane Bortzmeyer | 27 Apr 2005 13:55
Picon

Re: Docbook customization


On Wed, Apr 27, 2005 at 12:27:26PM +0200,
 Vincent Lefevre <vincent <at> vinc17.org> wrote 
 a message of 28 lines which said:

> Yes, this is what I do. For instance, to add an attribute:

OK, many thanks, it works for me. And I prefer to edit RNC than DTD,
anyway. For the record and the archives, here is the complete
solution. I do not master locatingRules yet, so sorry for the absolute
path:

Local schema:

% cat afnic-docbook.rnc
include "/usr/share/emacs/site-lisp/nxml-mode/schema/docbook.rnc"

local.common.attrib |= attribute osversionequal { text }

rfc = element rfc { attlist.rfc, empty }
attlist.rfc &= attribute num { text }?

local.para.char.mix |= rfc

Docbook conforming document, made with nxml:

% cat mydoc.db
<?xml version="1.0" encoding="utf-8"?>
<article>
  <para osversionequal="1">Very short <rfc num="1"/></para>
(Continue reading)


Gmane