Re: [xsl] Variable or Query for Speed

Subject: Re: [xsl] Variable or Query for Speed
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 5 Feb 2003 09:09:48 GMT

If it's just a single attribute (rather than a great long xpath  it'll
	probably not make any difference, but don't (hardly) ever do

<xsl:variable name="tableName">
	<xsl:value-of select="@name" />

do this

<xsl:variable name="tableName"select="@name" />

which is less typing and a lot more efficient.

in fact using an Xpath and using a variable may not make _any_
difference whatsoever.
Some systems "notice" that you re-use the same xpath over and over again
so effectively make an internal variable and use that,  systems might not
actually save the results of a variable binding and re-evaluate it each
use. So even if you write the code one way your system may optimise it
to use the other....

The answer to any of these "speed" questions is to use a stopwatch on
teh system you are using and just time the two approaches. If you
can't tell the difference, it doesn't matter...


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread