I've been running some tests on a document that includes nested
Xinclude directives. The document is complex: upwards of 1500 files,
nested to a depth of up to 4 levels. Total size of content is about 4.8MB.
For simple testing, I'm attempting only to produce a "flattened"
document that just resolves the XIincludes. Stylesheet looks like
this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Identity transform, but "flatten" xincludes -->
<xsl:output method="xml" indent="yes"/>
<xsl:preserve-space elements="*"/>
<xsl:template match="xi:include" xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:for-each select="document(@href)">
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
<!-- identity transform -->
<xsl:template match="/ | node() | @* | comment() | processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
My processing command is:
xsltproc --xinclude --novalid xinclude.xsl input.xml > output.xml
This takes about 12 minutes on my 900 MHz G3 iBook (Mac OS X), and about
4 minutes on my 2.8 GHz Pentium 4 Gentoo Linux box.
That seems pretty slow, particular given that the control condition takes
mere seconds (running the flattenedly document through a standard identity
transform with xsltproc).
I don't want to post the input here because it's so big, so this is really
just a preliminary post to ask for advice as to how I might go about
improving the XInclude-d transform: Is this a known issue with
xsltproc/XInclude? Or is there perhaps some flag I should be using that I
am failing to use? Something bad about my stylesheet?