oXygen XML Editor

Xinclude processing

1. XInclude in docbook
2. XInclude produces parser errors?

1.

XInclude in docbook

DaveP



Don't forget Bob Staytons site. DaveP

2.

XInclude produces parser errors?

Daniel Veillard


> When compiling my modular docbook file I get this xmllint error message.
> What am I doing wrong?

Nothing. It's a problem between DocBook DTD and XInclude.

> $ xmllint --xinclude --postvalid IDS5webUGbook.xml > out.xml
> IDS5web/1_Introduction/chapter_all_introduction.xml:3: No declaration for
> attribute base of element chapter .

Since there seems to be some confusion about the exact problem let me explain a bit what's going on:

xmllint --xinclude --postvalid does the following:

1/ parse the document, load the DTD but does not validate while parsing
2/ apply the XInclude processing which will recursively traverse the document(s) and include the new informations gathered from new documents (or text source)
3/ validate the resulting in-memory tree with the DTD from the "main" document.

So now what's this base attribute, where does it come from, and why:

1/ it's actually xml:base , an attribute which allows to set the base for URI-Reference computation done in the subtree of the document.
2/ it is added by XInclude processing to not break references done from included document. Say that main.xml includes subdir/chapter.xml and that subdir/chapter.xml references an image img.png . The rules for references expects the image to be found in subdir/img.png
3/ XInclude has no notion of what in teh included document might be a reference. So to preserve the linking functionality it mandates to add an xml:base="subdir/chapter.xml" at the point where the inclusion occured si that the reference from the resulting document to the image be preserved.

The consequence is:

- there is nothing to prevent this from an authoring point of view except keeping all the included fragment in the same directory as the main document

- the only solution is to get Docbook XML DTD to allow xml:base as a #IMPLIED attributes on the elements which are likely to be top of inserted documents. I though this was agreed upon but didn't checked the progress, Norm or Paul can probably tell us more about this.

At the moment you can safely ignore any [xml:]base attribute error message resulting from postvalid after XInclude processing.