View Single Post
 
Old November 11th, 2009, 11:58 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You can achieve the same with normal parameters by passing the parameter on with each apply-templates and with each template involved. If you have e.g.
Code:
<root foo="bar">
  <child>
     <grandchild/>
  </child>
</root>
then you would need e.g.
Code:
<xsl:template match="root">
  <xsl:apply-templates select="*">
     <xsl:with-param name="p1" select="@foo"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="child">
  <xsl:param name="p1"/>
  ...
  <xsl:apply-templates select="*">
     <xsl:with-param name="p1" select="$p1"/>
  </xsl:apply-templates>
  ...
</xsl:template>

<xsl:template match="grandchild">
  <xsl:param name="p1"/> 
  ...
  <xsl:if test="$p1 = 'bar'">
    ...
  </xsl:if>
</xsl:template>
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog