This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

keys fast for lookups? attribute-value template in xsl:call-template?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]