The new XInclude Working Draft:
http://www.w3.org/TR/xinclude-11/
looks good. It attempts to fix some of the problems of XInclude 1.0:
Setting different xml:id attributes on different xi:include elements
including the same element allows to avoid duplicate ID validation
errors in the transcluded document.
And adds a useful feature:
Include a line range found in a text file, rather than the text file in
its entirety.
However, the attribute copying feature as described in the Working Draft
seems too restrictive to be really useful.
Excerpts from the Working Draft:
---
4.3 Attribute Copying when processing XML
...
Any namespace qualified attribute that appears on the xi:include element
will be copied onto every top-level included item that is an element
information item.
If the element information item already has an attribute with the same
qualified name, its value is changed to the value specified on the
xi:include element.
---
[1] "Any namespace qualified attribute" poses a problem as most schemas
use attributes which are not namespace qualified. In practice, this
makes attribute copying as described above useful only for attribute xml:id.
[2] There are still duplicate ID validation errors in cases such as the
following one:
---
<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:eg="http://example.org/namespace/example">
<p>This example includes a “definition” paragraph from some document
twice using attribute copying.</p>
<xi:include href="src.xml" xpointer="element(def)"/>
<xi:include xml:id="def2" href="src.xml" xpointer="element(def)"/>
</document>
---
where src.xml is:
---
<document>
<para>Some paragraph.</para>
<para xml:id="def">Some
<phrase xml:id="ph1">definition</phrase>.</para>
<para>Some other paragraph.</para>
</document>
---
which gives us (duplicate ID error for xml:id="ph1"):
---
<document xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:eg="http://example.org/namespace/example">
<p>This example includes a “definition” paragraph from some document
twice using attribute copying.</p>
<para xml:id="def">Some
<phrase xml:id="ph1">definition</phrase>.</para>
<para xml:id="def2">Some
<phrase xml:id="ph1">definition</phrase>.</para>
</document>
---
I don't know if it is possible to solve problems [1] and [2] while
keeping the XInclude spec 1.1 as simple and as generic as it currently
is. However, I would really like to see these problems solved elegantly
because if this is the case, then may be DocBook 5.1 would not need to
have its own, DocBook specific, transclusion mechanism:
* http://docbook.org/docs/transclusion-requirements/
* http://docbook.org/docs/transclusion/transclusion.html
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-h...@lists.oasis-open.org