Subject: [xsl] keys fast for lookups? attribute-value template in xsl:call-templ ate? From: Mike Lamb <m@xxxxxxxxxxxxxxxxxxxxx> Date: Fri, 3 Aug 2001 17:15:28 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] what is the difference be, Trevor Nash | Thread | [xsl] difficulties with exclude-res, Amy Kaizerman |
Re: [xsl] change a list of attribut, Xiaocun Xu | Date | Re: [xsl]   vs  , Bjoern Hoehrmann |
Month |