Retrieving a local variable from a different template

webmasterbeta

New Member
Any help on the code below would be greately appreciated. I need help accessing a variable that I set in a different template in the same xslt file. I am not 100% sure if this is even possible. If it is, I would need to know the path syntax to access the variable.

Here's the template and code where the variable is set (with extraneous code removed):


<!--SETTING LOCAL VARIABLE IN A TEMPLATE-->
<xsl:template match="navigation">
<xsl:variable name="myvariable">Hello World</xsl:variable>
</xsl:template>

<!--TRYING TO RETRIEVE VARIABLE IN A DIFFERENT TEMPLATE-->
<xsl:template match="channel">
<td><xsl:copy-of select="$myvariable" /></td>
</xsl:template>

I get the following error:

"Could not find variable with the name of myvariable"

Please help!!!

Thank you,

Sean
 
Back
Top