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

keys fast for lookups? attribute-value template in xsl

Subject: keys fast for lookups? attribute-value template in xsl:call-template?
From: Mike Lamb <m@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 17:15:28 -0400
xsl look ups
I am trying to output the dealer nearest to a zip code that is part of my
source document. I have another document that maps zip codes to dealer
identifiers, many zips per dealer, one dealer per zip, as follows:
<ZIPS>
    <ZIP zip="14" dealercode="3706"/>
    <ZIP zip="15" dealercode="3706"/>
    .
    .
    .
</ZIPS>

I had thought of using a key over this document to perform the lookup. My
xsl is:

<xsl:key name="ziptodealer" match="ZIP" use="@zip"/>
<xsl:variable name="DEALER">
    <xsl:for-each select="document('Zips.xml')">
        <xsl:value-of select="key('ziptodealer', $ZIP)/@rc"/>
        <!-- variable zip populated above with the value from the source
document -->
    </xsl:for-each>
</xsl:variable>

This works fine, but as performance is really important here I would like
some feedback about whether this is absolutely the fastest way to get this
done.

Second problem is that, after I retrieve the dealercode, I need to run a
dealer specific template. I had tried to do this using xsl:call-templates as
follows:
<xsl:call-template name="DEALER{$DEALERCODE}"/>

with no success.  Looks like the name attribute of xsl:call-template does
not expect an attribute-value template. Any thoughts on how I might get this
done? I am trying to avoid writing the huge switch statement over
dealercode.

Thanks very much.

 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.