XInclude 1.1 (Last Call mark II)
Implementation experience, there's nothing like it.
Some time back, we got XInclude 1.1 wrapped up. It was all done but for the implementations.
XInclude 1.1, provides a few small extensions:
-
It allows non-XML fragment identifiers so that, for example, fragments of
text/plain
documents can be included. -
It adds the ability to copy attributes into the included content; this allows authors to add annotations that allow a post-processing step to identify the XInclude boundaries. Identifying the boundaries allows such a step to perform other processing, such as ID/IDREF fixup.
-
Licenses implementations to provide support for additional fragment identifier schemes.
All well and good. The annotation mechanism was simple: any namespace
qualified attributes on the xi:include
element would be copied
to the (top-level) included elementsThis is not a 100%
solution, but it's well over 80%..
As ever, the struggle was between simplicity and expressive
power. “Copy namespace qualified attributes” is simple. Its
consequences: there's no way to annotate with attributes that aren't
in a namespace and it copies the xml:*
attributes,
which has pros and cons. Pro: copying xml:id
is definitely a “works for the simplest
cases” duplicate ID fixup mechanism. Con: copying the xml:lang
attribute is most likely to do the
wrong thing.
And then there's xml:base
. Implementation
experience taught us that copying xml:base
naïvely did the wrong thing. And doing the right thing was…complicated.
Live and learn.
So we're going back to Last Call (with a plan to go stright to PR once we have implementations). Here's what we changed.
-
We don't copy the
xml:*
attributes anymore. We still copy all other namespace qualified attributes. -
There's a new XInclude attribute,
set-xml-id
(n.b. not in a namespace). The value specified is used as the value for thexml:id
attribute on top-level included elements. -
Forced to re-open the can of worms, we accepted the request to provide some mechanism to support annotations not in a namespace. Attributes in the “
http://www.w3.org/2001/XInclude/local-attributes
” namespace will be copied to attributes with no namespace.In other words,
<xi:include xila:class="highlight" href="…"/>
will annotate top-level elements with aclass
attribute (in no namespace, with the value “highlight”).
Share and enjoy. And implement, please.