Hello,
I noticed that Cocoon's XIncludeTransformer seems to be missing the base
URI fixup support specified in the W3C's XInclude spec [1] (Careful,
this is distinct from supporting xml:base to resolve relative xi:include
hrefs against).
In short, it says that the base URIs of documents do not change when
passed through an XInclude parser. This means that xml:base attributes
with the value of the current base URI should be added to the top level
included elements. To see an example, the xmllint parser (part of
libxml2) will perform this attribute insertion when you enable XInclude
processing.
I think this feature is important because otherwise, relative URIs (i.e.
links) in an included document will break if the included document is
not located in the same directory. Adding the xml:base attribute to the
result gives later content handlers the ability to resolve relative URIs
against the base. (In particular, I'm thinking of using XPath 2.0's
resolve-uri function).
Any thoughts? Is this a feature we need to see?
I think this is the cleanest and most general solution for resolving
relative URIs in included documents -- not to mention it's required by
the XInclude spec. Pending discussion here, I've created a patch that
adds this support that I can submit to JIRA.
--
Andrew Cave
[1] http://www.w3.org/TR/xinclude/#base - The Base URI Fixup section of
the W3C's XInclude specification