Re: slow xsltproc XInclude processing w/complex docume
Hi Paul, > 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. As you probably know, XSLT holds the files that it loads in memory. You haven't said how much memory your machines have, but it might simply be that holding all those files (and the flattened result document) in memory is causing problems. Another thing is that you're traversing every single node in those documents. Every node visit takes time, because the processor has to work out what to do with the node, so cutting down the node visits would be good. You could try, for example, changing the identity template that you're using at the moment for: <xsl:template match="node()"> <xsl:copy-of select="." /> </xsl:template> <xsl:template match="*[.//xi:include]"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> Overall, though, if speed is an issue, you would be much better off using a SAX Filter to do the transformation: that way you wouldn't be storing the documents in memory, each node would have to be visited only once, and the output can stream out (if that helps). Mind you, you say that the XInclude resolution is only a test, so perhaps you can't do your real transformation using SAX... Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format