This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Basing a module in DocBook XML DTD
- From: "E.L. Willighagen" <egonw at sci dot kun dot nl>
- To: docbook mailing list <docbook at lists dot oasis-open dot org>
- Date: Tue, 06 Aug 2002 11:40:17 +0200
- Subject: DOCBOOK: Basing a module in DocBook XML DTD
- Reply-to: egonw at sci dot kun dot nl
Hi all,
I am trying to make a module based on DocBook XML 4.1.2 and have a working
now, but it is not quite to my liking...
Consider this document:
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//JReferences//DTD DocBook JReferences Module //EN"
"../dtd/jreferences.dtd" []>
<article>
<jref:mode>Number</jref:mode>
<articleinfo>
<title>Test Article</title>
<author><firstname>Egon</firstname><surname>Willighagen</surname></author>
<date> 3 May 2000</date>
</articleinfo>
<section>
<title>Some section</title>
<para>This is a text with a reference
<jref:cite id="Steinbeck99"/>.</para>
<para>And now for some more serious tests, we add a second reference
<jref:cite id="Bachrach99"/>. And again the first reference
<jref:cite id="Steinbeck99"/>.
</para>
</section>
<jref:reflist/>
</article>
To be able to validate this document I made this customized DTD:
<!-- ......................................................................
-->
<!-- DocBook JReferences Module ...........................................
-->
<!-- Copyright (C) 2002 E.L. Willighagen
$Id: jreferences.dtd,v 1.2 2002/08/05 16:06:16 egonw Exp $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!-- ......................................................................
-->
<!-- This is the driver file for the DocBook JReferences Module.
Please use the following formal public identifier to identify it:
"-//JReferences//DTD DocBook JReferences Module //EN"
If your document's top-level element is jref-article, and
you are using DocBook directly, use this DOCTYPE
declaration:
<!DOCTYPE jref-article PUBLIC
"-//JReferences//DTD DocBook JReferences Module //EN"
"http://jreferences.sf.org/jreferences.dtd"
[...]>
Or, if you have a higher-level driver file that customizes DocBook,
use the FPI in the parameter entity declaration:
<!ENTITY % JReferencesDTD PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.0//EN"
"http://jreferences.sf.org/jreferences.dtd">
%JReferencesDTD;
-->
<!ENTITY % jref-colon ':'>
<!ENTITY % jref-prefix 'jref'>
<!ENTITY % NamespaceDecl.attrib "
xmlns%jref-colon;%jref-prefix;
CDATA #FIXED 'http://jreferences.sf.net/'
">
<!ELEMENT jref:cite (#PCDATA)>
<!ATTLIST jref:cite id CDATA #REQUIRED>
<!ELEMENT jref:mode (#PCDATA)>
<!ELEMENT jref:reflist (#PCDATA)>
<!ENTITY % jref-cite '%jref-prefix;%jref-colon;cite' >
<!ENTITY % jref-mode '%jref-prefix;%jref-colon;mode' >
<!ENTITY % jref-reflist '%jref-prefix;%jref-colon;reflist' >
<!ENTITY % local.para.mix "| %jref-cite; ">
<!ENTITY % docbook PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
%docbook;
<!ELEMENT jref:article ((%jref-mode;)?,
(%div.title.content;)?, articleinfo?, tocchap?, lot*,
(%bookcomponent.content; | %jref-reflist;)*,
((%nav.class;) | (%appendix.class;) | ackno)*)>
<!ATTLIST jref:article
%NamespaceDecl.attrib;>
<!-- End of jreferences.dtd ...............................................
-->
<!-- ......................................................................
-->
(I took the MathML V1.0 module as a starting point)
If you carefully look at this DTD you'll see the jref:article document
that overwrites DocBook's article element. This is the part with which
I am not happy... the above document should thus be using
jref:article element instead of article and then it correctly validates...
Redefinition of the article element is a error (according to xmllint) and is
thus not an option. And I could not find a way similar to the customization
of the para element with the local.para.mix entity which is empty in DocBook
XML 4.1.2 DTD...
My problem is thus:
How can I add the jref:mode element as a possible child element to DocBook's
article element?
More information about JReferences can be found at SourceForge:
jreferences.sf.net.
kind regards,
Egon Willighagen