Subject: RE: [xsl] Newbie Key Function issue From: Kurt Geiger <kgeiger@xxxxxxxxxxxxxx> Date: Fri, 6 Jul 2001 11:52:24 -0400 |
I am using MSXML3 (pre sp). I had found and Michael Kay confirmed that I was indexing all Entity Nodes using the expresion "//Entity/EntityId/@value" in the use attribute of the key element. After changing it to EntityId/@value the speed the lookup occurs is acceptable (relative to what it was). Thanks again. Kurt -----Original Message----- From: Thomas B. Passin [mailto:tpassin@xxxxxxxxxxxx] Sent: Friday, July 06, 2001 11:04 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Newbie Key Function issue Chances are that what's slow is the '//Entity' construction, given that you have a lot of Entities. Rework that expression so that a complete path is supplied, rather than "//", and see if that doesn't help. Some processors are slower than others at evaluating '//' - what are you using? Also, I see that you use $EntNode/EntityType repeatedly. Why not make that a variable of its own so it doesn't need to be evaluated each time? Tom P [Kurt Geiger] > I am using a stylsheet to produce a new XML file from a source file and > during the transformation lookup nodes in an external document. The Key > function works well but it is so SLOWWWWWWWW. Can anyone take a look below > and see if there is anyway to refine or filter my lookup in order to speed > this process up?? > Any help would be great. > > I have the following key and reference document in my StyleSheet. > > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:key name="ODCust" match="Entity" use="//Entity/EntityId/@value" /> > <xsl:variable name="CustFile" select="document('ODCust.xml')" /> > <xsl:output omit-xml-declaration="yes" />....... > > > I supply the function with a value and change the context using > <xsl:for-each .....>. > > > <xsl:template name="Entities"> > <xsl:variable name = "keyValue" select="//Entity/EntityId" /> > <xsl:for-each select="$CustFile"> > <xsl:variable name="EntNode" > select="key('ODCust', $keyValue[position()=1])" /> > <xsl:element name="EntityType" > > <xsl:attribute > name="value"><xsl:value-of > select="$EntNode/EntityType/@value"/></xsl:attribute> > <xsl:attribute > name="type"><xsl:value-of > select="$EntNode/EntityType/@type"/></xsl:attribute> > <xsl:attribute > name="id"><xsl:value-of select="$EntNode/EntityType/@id"/></xsl:attribute> > <xsl:attribute > name="label"><xsl:value-of > select="$EntNode/EntityType/@label"/></xsl:attribute> > <xsl:attribute > name="turnaround"><xsl:value-of > select="$EntNode/EntityType/@turnaround"/></xsl:attribute> > <xsl:attribute name="min" > ><xsl:value-of select="$EntNode/EntityType/@min"/></xsl:attribute> > <xsl:attribute name="max" > ><xsl:value-of select="$EntNode/EntityType/@max"/></xsl:attribute> > <xsl:attribute > name="elementid">0098</xsl:attribute> > </xsl:element> > <!---Bunch More Element Declarations Similar > to Above etc... --> > </xsl:for-each> > </xsl:template> > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Newbie Key Function issue, Kurt Geiger | Thread | [xsl] xsl qustion of a beginer, laurence_zhang |
RE: [xsl] Newbie Key Function issue, Kurt Geiger | Date | [xsl] Merging Two Files and Removin, Dendler James A |
Month |