<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<info>
    
    
    
    
    
    
<title>DocBook Tiny</title><biblioid class="uri">http://norman.walsh.name/2005/11/05/dbtiny</biblioid>
<volumenum>8</volumenum>
<issuenum>142</issuenum>
<pubdate>2005-11-05T16:19:31-05:00</pubdate>
<date>$Date: 2005-11-05 16:56:05 -0500 (Sat, 05 Nov 2005) $</date>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2005</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>Want DocBook with just five elements? You got it.</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#DocBook"/>
</info>

<para xml:id="p1">RELAX NG lends itself to more modular schema designs
than DTDs ever did. The DocBook V5.0 grammar is built from modules and
it would be fairly easy to construct a new top-level driver file that
didn't include some modules. For example, if you didn't want
<tag>msgset</tag>, you could just leave out <filename>msgset.rnc</filename>.
</para>

<para xml:id="p2">But an even simpler answer occurred to me the other
day. It's a little bit “brute force”, but that's ok. Construct a
grammar that includes the base grammar, sets the
<literal>start</literal>, and sets to <literal>notAllowed</literal>
all the elements you want to exclude:</para>

<programlisting>include "http://docbook.org/xml/5.0b1/rng/docbook.rnc" {
   start = db.book|db.chapter|db.article

   db.abbrev = notAllowed
   db.abstract = notAllowed
   db.accel = notAllowed
   db.ackno = notAllowed
   …
}</programlisting>

<para xml:id="p3">That's
<link xlink:href="examples/dbtiny.rnc">DocBook with just five elements</link>.
Want to allow <tag>emphasis</tag>? Just delete the line that makes
it not allowed. You can add any other elements the same way until you have
just the DocBook you always wanted.</para>

<para xml:id="p4">Any document that's valid according to your “tiny”
grammar will also be valid according to full DocBook. The only thing
you have to watch out for is constructing a grammar that won't
validate <emphasis>any</emphasis> document at all. For example, if you
allowed <tag>book</tag> but not <tag>title</tag>, you could never
validate a book because a <tag>title</tag> is required.</para>

</essay>

