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]

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



Mike Lamb writes:
>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"/>
>...
>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.

General Principle: keys were designed so as to allow developers the
maximum potential for optimization. If anything can be tweaked for good
performance, keys should be it.

Lesser Principle: since "lazy evaluation" is an optimization tactic,
assume that you don't get a payoff until you look up a given value
more than once. If each zip is looked up once, you may not benefit.

Real-world answer: measure performance in your environment unless you
have clear-cut knowledge of how the Lesser Principle applies to you.

>Looks like the name attribute of xsl:call-template does not expect an
>attribute-value template.

That's correct.

>Any thoughts on how I might get this done? I am trying to avoid writing
>the huge switch statement over dealercode.

Look in the FAQ for some tricks. Also, look for commonalities among
dealers (to share templates) or ways to throw more parameters at the
template. Use more keys on dealercode to set parameter values.
.................David Marston


 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]