Altova Mailing List Archives

Re: [xsl] Optimising multiple document() calls

From: "G. Ken Holman" <gkholman@-------------------->
Date: 7/11/2005 9:20:00 PM
At 2005-07-11 11:43 +0200, Hondros, Constantine wrote:
I am pre-processing batches of about 1000 XML files at a time using Saxon.
Part of the pre-process involves aggregating linked XML documents into the
current document. Naturally, I use the document() function for this:
How would you optimise this? Would a deep-copy with <xsl:copy-of> be faster?
Or am I better off writing my own processor for this aggregating step (easy

Since the XSLT processor is obliged to keep all document() node trees 
around somehow (it doesn't know when you might need a given tree again in 
the transform and any generated identifiers for the nodes need to be 
persistent in the transform), I would recommend a simple SAX process for 
this kind of aggregation.  Not only would it be faster (no building of the 
node tree), it would have a very small footprint (no persistence of any 
input documents).

Some XSLT processors will allow you to pass your output SAX events as input 
to an XSLT transform so in such a case you wouldn't even have the 
aggregated file sitting around to worry about.

I hope this helps.

. . . . . . . . . Ken

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness
Legal business disclaimers:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.