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

Re: Newbie Key Function issue

Subject: Re: Newbie Key Function issue
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Fri, 6 Jul 2001 11:04:28 -0400
Re:  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


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-2013 All Rights Reserved.