RE: [xsl] XSL performance with key from external xml doc.

Subject: RE: [xsl] XSL performance with key from external xml doc.
From: "Bhandari, Ashish" <Ashish.Bhandari@xxxxxx>
Date: Wed, 26 Feb 2003 16:30:55 -0500
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>
	<businessCenterScheme> 
		<tag id = "none">NONE</tag>
		<tag id = "Buenos Aires">ARBA</tag>
		<tag id = "Vienna">ATVI</tag>
		<tag id = "Bangkok">THBA</tag>
		<tag id = "Ankara">TRAN</tag>
		<tag id = "Taipei">TWTA</tag>
		<tag id = "Chicago">USCH</tag>
		<tag id = "LosAngeles">USLA</tag>
		<tag id = "NewYork">USNY</tag>
		<tag id = "Johannesburg">ZAJO</tag>
	</businessCenterScheme>
	<businessDayConventionScheme>
		<tag id = "1">FOLLOWING</tag>
		<tag id = "2">MODFOLLOWING</tag>
		<tag id = "3">PRECEDING</tag>
		<tag id = "4">NONE</tag>
	</businessDayConventionScheme>
	<compoundingMethodScheme>
		<tag id = "2">Flat</tag>
		<tag id = "0">NONE</tag>
		<tag id = "1">Straight</tag>
	</compoundingMethodScheme>
	<currencyScheme>
		<tag id = "ARS">ARS</tag>
		<tag id = "AUD">AUD</tag>
		<tag id = "BRL">BRL</tag>
		<tag id = "CLP">CLP</tag>
		<tag id = "CZK">CZK</tag>
		<tag id = "DKK">DKK</tag>
		<tag id = "EEK">EEK</tag>
		<tag id = "EUR">EUR</tag>
		<tag id = "GRD">GRD</tag>
		<tag id = "USD">USD</tag>
	</currencyScheme>
</lookUpData>

-----Original Message-----
From: Mike Brown [mailto:mike@xxxxxxxx]
Sent: Wednesday, February 26, 2003 4:04 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] XSL performance with key from external xml doc.


Bhandari, Ashish wrote:
> 
> I have been using an XSL profiler ( catchXSL ) and notice that I have a
> significant performance bottle neck
> in looking up keys from an external XML document.
> 
> 	lookUpDoc is initialized as:
> 	    <xsl:variable name = "lookUpDoc" select =
> "document('schemes.xml')"/>
> 	Code Snippet:
>                 <xsl:for-each select = "$lookUpDoc">
>                         <xsl:variable name = "tagValue" select =
> "key($schemeName,$normalizedTag)"/>
>                 </xsl:for-each>
> 
> This lookup is called too often. Is there any faster way to achieve this
?.

I don't see anything wrong with the code above. What do your key definitions

look like (xsl:key instructions), and can you give us an idea of what 
schemes.xml looks like, and how the code snippet above is being called?

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

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

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


Current Thread