xsl-list
[Top] [All Lists]

Re: XSL performance with key from external xml doc.

2003-02-27 03:43:23
Hi,

I can't see anything obviously wrong with this although 1.a looks a little 
odd. If the variable 'lookUpDoc' is in a named template its not clear how you 
can be using it elsewhere, i.e. it will be out of scope when in 1.b. One 
other area of concern maybe the time saved by using key() against the cost of 
computing the key. If the indexed data is large and you don't access the key 
lots you may not be getting much benefit by using it. The key() function 
itself normally takes very little time but many processors will create the 
key index on first use which is probably what your profiler is picking up.

If you can package this into a complete example I would happy to look at this 
some more. I work for a company that specialises in high performance XML 
solutions so we have some good tools for analysing these types of problems.

Kev.

On Wednesday 26 February 2003 21:30, Bhandari, Ashish wrote:
1. The way I have done is:
      a. I call a named template in the main xsl sheet which loads the
document into the
         lookupData variable.
              <xsl:variable name = "lookUpDoc" select =
"document('schemes.xml')"/>
      b. I have another named template which executes the foreach loop to
get the key info
         from schemes.xml.
              <xsl:for-each select = "$lookUpDoc">
                         <xsl:variable name = "tagValue" select
="key($schemeName,$normalizedTag)"/>
              </xsl:for-each>
         This named template is called in the main template many times.

2. This is how the xsl:key instruction is.
      <xsl:key name = "averagingMethodScheme" match =
"averagingMethodScheme/tag" use = "@id"/>
      <xsl:key name = "businessCenterScheme" match =
"businessCenterScheme/tag" use = "@id"/>
      NOTE: This xsl:key instruction just resides the xml which has the
named templated
      defined. Does it have to be part of 1(a).

3. Schemes.xsl looks likes this except that It has much more data.

<LookUpData>
      <averagingMethodScheme>
              <tag id = "Unweighted">Unweighted</tag>
              <tag id = "Weighted">Weighted</tag>
      </averagingMethodScheme>

Cut ..



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list