|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing if something is not there
Hi Jim, > Thanks for tips! I was about half-way there. You use a few more > variables than I was using. Are there speed advantages to using > variables like $Test rather than using XPaths in template match or > for-each constructs? You can't use variables in template match patterns (supposedly to prevent circular references). I was mainly using variables to help make it clearer what was going on in the code. However, using a variable stops an XSLT processor from evaluating the same expression multiple times. Some XSLT processors detect when the same expression is used several times and caches the result of the expression (e.g. Saxon caches it if you use it three times), but using a variable forces the expression to only be evaluated once. This is especially useful for expensive operations (e.g. for setting the $Test variable) and not so important for cheap operations (e.g. for setting the $TestName variable, although that variable's necessary given the way the current node changes in the template). I usually use a variable if I'm using the same location path more than once, unless it's just accessing children or attributes. > I do have a lot of Tests under each Site. Usually there are about > 500. So the tip to use > > <xsl:key name="TestSites" match="Test" > use="concat(../../SiteName, '::', FullName)" /> > > was VERY helpful. Without the above key, it was taking about 30 > seconds to process my XML file. With the above key, the processing > time was cut to 4 seconds! Excellent :) Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








