xsl-list
[Top] [All Lists]

RE: Whats Wrong with: <xsl:value-of select="//exec[(_at_)stepid=$temp_step]/dds/dd[logical/@id=$temp_id]" />

2004-11-11 08:46:21


Friends,
To expand on David's post, I find it easier and less liable 
to error to express the variable this way when I want a 
string:  XLST 1.0
  <xsl:variable name="temp_id">SORTOUT</xsl:variable>

The problem here is that you are creating a temporary tree, which has a
root and a single text node child.  Doing a value-of on the tree will
return the string 'SORTOUT', as it returns all the text-nodes for the
tree concatenated together, however, there is comparitively massive cost
in constructing the tree and the holding it in memory.

Using <xsl:variable name="temp_id" select="'SORTOUT'"/> simply binds the
string to the variable, and incurs no tree creation costs or the extra
memory use.

So, although they appear very similar as using value-of on either
technique produces the same result, they are actually quite different.

The rule of thumb is - if it's possible to do all the work in the select
attribute do it there.

cheers
andrew


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--