RE: [xsl] Pass node to template

Subject: RE: [xsl] Pass node to template
From: David Neary <David@xxxxxxxxx>
Date: Tue, 20 May 2003 17:50:49 +0200

De : Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxx]
> Hello,

Hi.

>     <xsl:variable name="EDITPROP" select="EDITPROPS"/>

Here the variable EDITPROP is a reference to the nodeset matching the XPath
expression in the select (EDITPROPS).

>              <xsl:call-template name="MAKE_INPUT_BOX">
>                 <xsl:with-param name="nodEdit"><xsl:value-of
> select="$EDITPROP" /></xsl:with-param>

Here nodEdit is not a nodeset, but a tree fragment. That is, the parameter
is the bit of a tree between the end of the <xsl:variable> and the start of
the </xsl:variable>

>                 </xsl:call-template>
> 
> Here is the beginning part of my template that fails:
> <xsl:template name="MAKE_INPUT_BOX">
>     <xsl:value-of select="$nodEdit/@type"/>

You can't do tree operations on a result fragment. What you want is to
actually pass the nodeset into the template. To do that, change the
with-param to 

<xsl:with-param name="nodEdit" select="$EDITPROP" />

Now, the parameter type in the template is the type of the expression
"$EDITPROP", which presumably is a nodeset.

Cheers,
Dave.


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


Current Thread