Xinclude a document with a different namespace

Questions about XML that are not covered by the other forums should go here.
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Xinclude a document with a different namespace

Post by Zearin »

Okay, I have a Docbook 5 RC5 file that validates. Inside this document I have an XInclude element that references another XML document. This second document, however, has a different namespace and element structure. This document has a custom schema that I wrote.

After some searching I added the xi:fallback element and discovered that the included document is not being properly included. (At least, the fallback element is being output when I transform the Docbook file to HTML.)

What can I do to repair this failed XInclude?
-- Zearin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

If the document specified in the href attribute of the xi:include element is not included then you should check that you have XInclude enabled in Options -> Preferences -> XML -> XML Parser -- XInclude Options. If it is enabled please post some sample files that show the problem.


Regards,
Sorin
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

In Ant.

Post by Zearin »

Yep.

I forgot to mention that I'm performing the transformation using an Ant buildfile. XInclude works fine using Oxygen's built-in Transform feature, but XInclude is not functional when performing the transformation with Ant (which works just fine otherwise).

Using Ant v1.7 (latest from fink).

I discovered the following workaround:

Code: Select all


<xsl:template match="xi:include" xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:apply-templates select="document(@href)/*" />
</xsl:template>
Seems to work for now, but I would like to see if I can get things to work as intended without any workarounds.
-- Zearin
Post Reply