RE: [xsl] Selecting and printing certain nodes

Subject: RE: [xsl] Selecting and printing certain nodes
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Fri, 20 Feb 2004 19:04:49 +0100
> -----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


Current Thread