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

Re: Very slow Xsl (just started in xsl)

Subject: Re: Very slow Xsl (just started in xsl)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 5 Jul 2007 14:51:58 +0100
Re:  Very slow Xsl (just started in xsl)
It's hard to debug without a full stylesheet and full (small) input but
in general beware using // which means do a full search of the document
to arbitrary depth. If you are lucky your xslt processor may rewrite
your expressions not to do this, but things are simpler if you don't use
// in the first place.

for example
	     <xsl:for-each select="//data/*">

means search the entire document for data elements.
If you know your data elements are at a certain fixed level then it's
likely to be better to do eg
	     <xsl:for-each select="/a/b/data/*">

		           <xsl:for-each select="//layout/field">
 then _for each child of a data element_ search the entire document
 again looking for layout elements. the set of layout/field elements
 returned will be the same every time, so if you are lucky the processor
 will only do this once, but it would be better to pull this out into a
 global variable, and also again if you know a more specific path to the
 layout element, use it.


<xsl:variable name="poscol">
                 <xsl:for-each select="//layout/field">
                     <xsl:if test="vldidx = $col">
                          <xsl:value-of select="position()"/>
                     </xsl:if>

again this looks very slow, it appears to be looking up a field by its
vldidx child in which case use of  xsl:key would problably speed things
up, but I lost the logic of how you are using postion() here (just
looking at the code without any example) so I won't suggest a
replacement.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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-2011 All Rights Reserved.