Hi all,
My employer is rolling out an XML CMS that has issues resolving xincludes. The workaround that I need to perform is writing a short XSL to preprocess my files and resolve Xincludes manually.
My script worked fine on a couple of test docbook 4 test files that used the id attribute to identify nodes, but as soon as I switched to my docbook 5 files and changed the referenced attribute to xml:id, I began getting the following: error message:
"The URI
http://www.w3.org/XML/1998/namespace does not identify an external Java class"
Now, the namespace quoted, is of course, the default XML namespace. During the process of flailing about, I did try explicitly binding xml to its namespace (xmlns:xml='http://www.w3.org/XML/1998/namespace') but had no effect.
The script as it stands looks like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude" exclude-result-prefixes="db ng exsl" version="1.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xi:include">
<xsl:variable name="id_value1">
<xsl:value-of select="substring-before(@xpointer, ')')"/>
</xsl:variable>
<xsl:variable name="id_value2">
<xsl:value-of select="substring-after($id_value1, '(')"/>
</xsl:variable>
<xsl:for-each select="document(@href,/)">
<xsl:copy-of select="xml:id($id_value2)"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks in advance for any help.
Jeff.