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. ________________________________________________________________________
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