This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
variables and calling templates
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] variables and calling templates
- From: "Chris d'Aquin" <CDAquin at questia dot com>
- Date: Tue, 2 Oct 2001 18:06:57 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
I have a script that looks similar to this:
<xsl:template match="/">
<xsl:for-each select="//*[@foo]">
<xsl:variable name="element">
<xsl:value-of select="name()" />
</xsl:variable>
<xsl:if test="@foo='bar'">
<xsl:call-template="foobar" />
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="foobar">
. . . various statements here that use the $element variable set above .
. .
</xsl:template>
When I run this using XT, it gives me an error message stating "variable
'element' not defined". From what I can tell, the $element isn't being
passed from the top portion of the script to the "foobar" template. What
is the scope of the $element I created, and how can I use the $element in
the "foobar" template?
Thanks in advance,
Chris
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list