This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: XInclude doesn't validate with xmllint


Here's how we do it.

First I'd like to lobby for keeping your local copies of DTDs and
stylesheets as a mirror or cache of the canonical URLs. This makes mapping
URL system identiers to local system identifiers trivial, and also makes
maintenance a no-brainer. BTW, the catalog.dtd that you get from
http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd is
version 1.7, while the one in the spec is version 1.9. So much for entity
resolution over the net ;)

xml/
  catalog.xml # master catalog that delegates 
              # public, uri, and system identifiers 
              # to catalogs below
  docbook.sourceforge.net/
    release/
      xsl/
        catalog.xml
        1.48/
        1.55.0/
  www.magnus.dk/
    docbook/
      xml/
        catalog.xml
        1.0/
        1.1/
        1.3/
      xsl/ # put generally useful xsl 
           # customization here
  www.oasis-open.org/
    committees/
      entity/
        release/
          1.0/
    docbook/
      xml/
        catalog.xml
        configerror.txt
        ebnf/
          1.0/
          1.1CR1/
        htmlforms/
          1.1/
        mathml/
          1.0/
        simple/
          1.0CR3/
          4.1.2.5/
        svg/
          1.0CR1/
        4.1.2/
        4.2/
      xmlcharent/
        catalog.xml
        0.3/
  www.w3.org/
    TR/
      html4/        
      xhtml1/
        catalog.xml
        DTD/
      MathML2/
        catalog.xml
        dtd/

Our DocBook customization adds <xi:include> as a valid element in a number
of places. This was quite messy until DocBook XML 4.2. The general idea is
to add the <xi:include> element to to %local.whatever.class; so that
<xi:include> becomes valid in <whatever> context.

I've left out some additional customization that includes EBNF support; it's
still rather messy if you don't want to use the released wrapper DTDs.
Anyway, here we go:

<!-- 
  Customised DocBook XML DTD

  Invocation:
  "-//MAGNUS//DTD DocBook XML V4.2-Based Variant V1.2//EN"

  $Id: magnus-docbookx.dtd,v 1.6 2002/06/24 09:43:33 pri Exp $
  -->

<!-- XInclude element
  http://www.w3.org/TR/2002/CR-xinclude-20020221/
  -->
<!ELEMENT xi:include
  (xi:fallback)
  >
<!ATTLIST xi:include
  href CDATA #REQUIRED
  parse (xml|text) "xml"
  encoding CDATA #IMPLIED
  xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude";
  >
<!ELEMENT xi:fallback 
  ANY
  >
<!ATTLIST xi:fallback
  xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude";
  >

<!-- include as chapter 
  -->
<!ENTITY % local.chapter.class
  "|xi:include"
  >

<!-- include as section
  -->
<!ENTITY % local.section.class
  "|xi:include"
  >

<!-- include as para content
  -->
<!ENTITY % local.para.char.mix
  "|xi:include"
>


<!ENTITY % DocBookDTD PUBLIC 
  "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";
  >
%DocBookDTD;

---

kind regards
Peter Ring




-----Original Message-----
From: Bob Stayton [mailto:bobs@caldera.com]
Sent: 3. oktober 2002 06:49
To: John Himpel; docbook-apps@lists.oasis-open.org
Subject: Re: DOCBOOK-APPS: XInclude doesn't validate with xmllint


> On Tue, Oct 01, 2002 at 09:35:16PM -0500, John Himpel wrote:
> > 
> > I am trying to validate two xml files using the modular document
> > technique that Bob Stayton shows in www.sagehill.net.

> From: Kevin.Ruscoe@ubsw.com 
> Hi John
> 
> We got XInclude to work as follows:
> 
> 1) All of our DocBook documents which use XInclude (and
> that's almost all of them) start like this:
> 
> =================================================
> <?xml version='1.0'?>
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"docbookx.dtd"
> [
> <!ENTITY % xinclude PUBLIC "-//UBS//CORE//DTD XInclude V1.0//EN"
"xinclude.dtd">
> %xinclude;
> ]
> >
> 
> <article>
>   <articleinfo><title>CDL Step-By-Step Instructions</title></articleinfo>
>   <xi:include href="../panels/panel_home.dbk"/>
> ...
> 
> 
> 4) Finally, here is our XInclude DTD, culled from the spec:
> =================================================
> <!-- public identifier "-//UBS//CORE//DTD XInclude V1.0//EN" -->
> 
> <!ELEMENT xi:include (xi:fallback)>
>     <!ATTLIST xi:include
>             xmlns:xi  CDATA #FIXED "http://www.w3.org/2001/XInclude";;

>             href       CDATA #REQUIRED
>             parse      (xml|text) "xml"
>             encoding   CDATA #IMPLIED
>     >
> <!ELEMENT xi:fallback ANY>
>     <!ATTLIST xi:fallback
>             xmlns:xi   CDATA #FIXED "http://www.w3.org/2001/XInclude";;
>     >

Well, I don't think your article will validate with
just this extension to the DocBook DTD.  It adds the
xi:include element to the collection of elements, but
it doesn't put it into any content models of the DocBook
elements.  In the example, the <xi:include> element
is placed after the <articleinfo> element.  But the <article>
content model doesn't mention <xi:include>, so it
won't validate.  Only after the xi:include is replaced
with its content will it validate.

I started to extend the DocBook DTD to permit xi:include,
but I think it is kind of impossible (except for maybe
Norm 8^).  The xi:include element can replace *any*
element or group of elements, so the content models of
every element would get hopelessly complex.


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]