Is it possible to pass a variable from one parent template to its child element ?
<xsl:template match="structure">
<xsl:variable name="var"><xsl:value-of select="@path" /></xsl:variable>
<xsl:apply-templates select="folders">
<xsl:with-param name="var1" select="'{var}'"/>
</xsl:apply-templates>
</xsl:template>
this template will match:
<xsl:template match="folder">
<xsl:param name="var1"/>
<xsl:value-of select="$var1"/>
</xsl:template>
You see I wanna use var as var1 in the matched template.
How can I make this work?
edit: the structure is like this:
<structure path="C:\xampplite\htdocs\xampp">
<folders>
<folder name="img">
<date>01/28/10 21:59:00</date>
<size>37.4 KB</size>
</folder>
</folders>
</structure>
edit2:
<xsl:template match="folder">
<xsl:variable name="var1"><xsl:value-of select="../../@path"/></xsl:variable>
<xsl:variable name="var2"><xsl:value-of select="@name" /></xsl:variable>
<xsl:variable name="var3"><xsl:value-of select="$var1"/>\<xsl:copy-of select="$var2"/> </xsl:variable>
<th colspan="2" align="left" bgcolor="#FF5500"><a onclick="foo('{$var3}')"><xsl:value-of select="$var3"/></a></th>
in the jscript function the string is without its backslashes. anyone knows why?
C:xampplitehtdocsxamppimg