← Prev in month ← Prev in thread
Next in thread → Next in month →

RE: [docbook] Future DocBook Ruminations - Modular Source Files & XInclude

From
Elliotte Rusty Harold <>
Date
2003-08-21T15:25:59+00:00
ID
p04330101bb6a5194a646@[192.168.254.4]
Thread
RE: [docbook] Future DocBook Ruminations - Modular Source Files & XInclude
At 5:20 PM +0100 8/20/03, Wills, Robert wrote:

>
>  <?oodb-include href="intro.xml"?>
>
>... with ...
>
>  <include xmlns="http://www.w3.org/2001/XInclude" href="intro.xml"/>
>
>... which seems the "correct" approach, the validating editors I have tried
>immediately complain about the unrecognised <include> element.

You need to declare that element (and redefine a couple of entities) 
in the internal DTD subset like this:

<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                       "docbook/docbookx.dtd" [
  <!-- add XIncludes -->
  <!ENTITY % local.para.char.mix " | xinclude:include">
  <!ELEMENT xinclude:include EMPTY>
  <!ATTLIST xinclude:include
     xmlns:xinclude CDATA #FIXED "http://www.w3.org/2001/XInclude"
     href           CDATA #REQUIRED
     parse          (text | xml) "xml"
  >
]>


Depending on exactly where you put the include elements you may need 
to adjust which parameter entity references you override. This 
example works when you never include inline elements, only block 
level elements and higher. And of course you may have to change the 
namespace prefix to suit. But this is essentially how it's done.
-- 

   Elliotte Rusty Harold
   
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
← Prev in month ← Prev in thread
Next in thread → Next in month →