including xinclude

Having trouble installing Oxygen? Got a bug to report? Post it all here.
mdamkier
Posts: 10
Joined: Mon Mar 05, 2007 5:25 pm
Location: Hamburg

including xinclude

Post by mdamkier »

Hi all,
Using oXygen 12.1.
I have, what I hope is, a simple problem/question. In the DTD declaration I would like to call my own driver file that adds a couple of things, including xinclude, to the "stock" DTD (DocBook XML 4.5). Like this...
<!DOCTYPE book SYSTEM "DTD/driver.dtd">

Here is my driver file...
<!-- DocBook 4.5 -->
<!ENTITY % docbook4.5 SYSTEM "docbook/xml/4.5/docbookx.dtd">
%docbook4.5;
<!-- DTD extensions -->
<!ENTITY % xinclude SYSTEM "docbook/xml/xinclude.mod">
%xinclude;

This works just fine for processing the document outside of oXygen. But, oXygen does not 'see' the xinclude information and complains that xi:include is an unexpected element.
It does work in oXygen if I declare it like this...
<!DOCTYPE book SYSTEM "DTD/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "DTD/docbook/xml/xinclude.mod">
%xinclude;
]>

Is this an oXygen configuration/preferences thing? Any ideas?
Thanks in advance.
- Michael
-- Michael
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: including xinclude

Post by adrian »

Hello,

In the driver.dtd you should put the XInclude extension before the Docbook DTD:

Code: Select all

<!-- DTD extensions -->
<!ENTITY % xinclude SYSTEM "docbook/xml/xinclude.mod">
%xinclude;
<!-- DocBook 4.5 -->
<!ENTITY % docbook4.5 SYSTEM "docbook/xml/4.5/docbookx.dtd">
%docbook4.5;
This is necessary because the Docbook DTDs use the entities declared in the xinclude.mod, so they have to be declared beforehand.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mdamkier
Posts: 10
Joined: Mon Mar 05, 2007 5:25 pm
Location: Hamburg

Re: including xinclude

Post by mdamkier »

Hi Adrian,
Thank you for your answer! It works now, but that order is counter intuitive (to me, anyway). Does that mean that the stuff one adds between the [] brackets in the DTD declaration is read/processed first, before the specified DTD file?
(Excuse my demonstrating a complete lack of knowledge here. :? )
-- Michael
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: including xinclude

Post by george »

I think a better model is to think of that as the internal subset overwrites entities that are declared/used in the external subset.

Basically the specification does not restricts the order in which a processor reads the DTDs/internal subset, it cares only about the end result.

Best Regards,
George
George Cristian Bina
mdamkier
Posts: 10
Joined: Mon Mar 05, 2007 5:25 pm
Location: Hamburg

Re: including xinclude

Post by mdamkier »

George,
Using the vocabulary external and internal helped. So, if I understand, by putting everything external, that would make the order important.
Many thanks for your help.
-- Michael
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: including xinclude

Post by george »

The first occurrence of an entity wins but the internal subset gets a chance to modify anything from the external DTDs.

Most of the redefine techniques work this way, that is by placing the redefinitions inside the reference to the content to be redefined. See for example the xsd:redefine from XML Schema. Also in Relax NG if you use an include and refer to a schema, all the patterns placed inside that include (as children of the include element) redefine the ones from the included schema.

Best Regards,
George
George Cristian Bina
Post Reply