xsl-list
[Top] [All Lists]

RE: combining two variables to generate XPATH

2002-12-17 13:34:17
Hi,

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
bix xslt
Sent: Tuesday, December 17, 2002 12:08 PM

What is different about a path with a single variable, and a path with two 
variables?  Why can't I specify a second variable:

<xsl:template name="foo">
  <xsl:param name="node"/>
  <xsl:param name="branch" select="'someBranch'"/>
  <xsl:for-each select="$node/$branch/leaf">
    <xsl:value-of select="@id" />
  </xsl:for-each>
</xsl:template>

You can do something like:

<xsl:template name="foo">
  <xsl:param name="node"/>
  <xsl:param name="branch" select="'someBranch'"/>
  <xsl:for-each select="$node/*[name()=$branch]/leaf">
    <xsl:value-of select="@id" />
  </xsl:for-each>
</xsl:template>

best,
-Rob


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