|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








