XSLT to replace XInclude elements
Posted: Wed Jan 13, 2010 5:26 pm
I’m using oXygen 11.1 (build 2010010613). I have an XSLT that I’m using to transform an XML document. One of the changes I need to make is to replace <xi:include> tags with another element as required by downstream process. I have turned off XInclude processing under “XML | XML Parser” and under XSLT for XSLTProc and MSXML.NET. However, the <xsl:template> that I’ve added doesn’t seem to be executed and the result file still contains the <xi:include> tags. What do I need to do to have my template “match” the <xi:include> tags?
The template I have is:
<xsl:template match=”xi:include”>
…
</xsl:template>
An example file would be:
<?xml version=”1.0” encoding=”UTF-8”?>
<!DOCTYPE book PUBLIC… …>
<book dtd-version=”2” xml:lang=”EN”
xmlns:xlink=”http://www.w3.org/1999/xlink”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<book-meta>...</book-meta>
<body>
<xi:include href=”file.xml”
xmlns:xi=”http://www.w3.org/2001/XInclude”>
<xi:fallback><!--Fallback for “file.xml"-->
</xi:fallback>
</xi:include>
…
…
</body>
</book>
Thanks.
DJ
The template I have is:
<xsl:template match=”xi:include”>
…
</xsl:template>
An example file would be:
<?xml version=”1.0” encoding=”UTF-8”?>
<!DOCTYPE book PUBLIC… …>
<book dtd-version=”2” xml:lang=”EN”
xmlns:xlink=”http://www.w3.org/1999/xlink”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<book-meta>...</book-meta>
<body>
<xi:include href=”file.xml”
xmlns:xi=”http://www.w3.org/2001/XInclude”>
<xi:fallback><!--Fallback for “file.xml"-->
</xi:fallback>
</xi:include>
…
…
</body>
</book>
Thanks.
DJ