[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: performance issues

Subject: RE: performance issues
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 9 Mar 2005 11:29:29 -0000
RE:  performance issues
> If I have lots of templates all in one file like this, is it 
> likely to 
> cause any performance issues? Or are the templates only 
> loaded as and when they are needed?

The templates are likely to be "loaded" in all cases (how does the system
know when they are needed?) but that's not likely to cause any performance
problems. The potential problem is that the system may have to search more
template rules than necessary each time you do an apply-templates. Whether
this is expensive depends (a) on the strategy used by your XSLT processor,
and (b) on the form of the match patterns. I would expect that if the match
patterns use an element name, and the element name doesn't appear in your
source document, then for most XSLT processors the overhead would be
minimal. But a pattern such as


could slow things down a lot.
> Likewise, if I set up a variable which is effectively a pointer to an 
> external document via the document() function, like so:
> <xsl:variable name = "testDoc" 
> select="document('/www/xml/testDoc.xml')/root/>
> Does this cause the processor to load the contents of the 
> document into 
> memory, or will it not actually do that untill I make a 
> futher attempt to 
> try and acces some information from this document like so:
> <xsl:value-of select="$testDoc/item[@id = $id]/@name"/>

That's very processor-dependent. Many processors will use a lazy evaluation
strategy, but you certainly can't rely on it. Saxon will eliminate a
variable at compile time if there are no references to it(*), and if there
are references then in most situations it will delay evaluating the variable
until the first reference is encountered.

Michael Kay

(*) as people have discovered who try to call extension functions that have

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.