xsl-list
[Top] [All Lists]

RE: Selecting and printing certain nodes

2004-02-20 11:04:49
-----Original Message-----
From: Andreas L. Delmelle

<snip />
So, make the variable
<xsl:variable name="vdo" select="node()" />


Come to think of it, I'm wondering what difference the intermediate variable
makes:

<xsl:variable name="somevar" select="node()" />

<xsl:for-each select="../element">
  <xsl:apply-templates select="$somevar">
    <xsl:with-param name="p" select="." />
...

Or

<xsl:for-each select="../element">
  <xsl:apply-templates select="../body/node()">
    <xsl:with-param name="p" select="." />


My inclination would be to assume that in the latter the expression
'../body/node()' would be evaluated for each ../element, where in the first
case the corresponding expression from a different context would be
evaluated only once, and the result is then readily available as a literal
for the context of the xsl:for-each. (making the first the better option
only in cases where the node-set is small but the expression to match it is
complex?)

Anyone to confirm/reject this assumption?

TIA

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list