You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew Cave <aj...@ualberta.ca> on 2007/06/22 23:00:20 UTC

XIncludeTransformer lacks base URI fixup support?

I think the Cocoon XIncludeTransformer might be missing some important 
functionality. Namely, I don't think it inserts xml:base attributes 
according to the specification (see 
http://www.w3.org/TR/2004/REC-xinclude-20041220/#base ).

For example, given these source documents:

-------------------foo.xml----------------------
<?xml version="1.0" encoding="UTF-8"?>
<doc xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="Content/bar.xml"/>
</doc>
---------------Content/bar.xml------------------
<?xml version="1.0" encoding="UTF-8"?>
<included>
    Text
</included>

And the pipeline fragment:

<map:match pattern="foo.xml">
    <map:generate src="foo.xml"/>
    <map:transform type="xinclude"/>
    <map:serialize type="xml"/>
</map:match>

I would expect the serialized output to be:

<?xml version="1.0" encoding="UTF-8"?>
<doc xmlns:xi="http://www.w3.org/2001/XInclude">
    <included xml:base="Content/bar.xml">
        Text
    </included>
</doc>

However, in reality, the xml:base attribute is not present. Trying this 
with the command line XML parser, xmllint, yields the expected result. A 
quick scan of the XIncludeTransformer source turned up nothing that 
looked like it was meant to take care of this base URI fixup. Maybe 
there's something I'm missing? Can anyone else confirm this issue?

The reason I'd like to see this functionality is that my included 
documents, located in subdirectories, will often have relative file URIs 
pointing to images, and those paths break when included into a document 
in a different directory. I'd like to be able to use the xml:base 
attributes to resolve those URIs. Is there perhaps another mechanism to 
deal with this issue?

Thanks for any insight,
Andrew Cave


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org