RE: [xsl] Tunnelled params and variables

Subject: RE: [xsl] Tunnelled params and variables
From: "Angela Williams" <Angela.Williams@xxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Jul 2007 10:08:24 -0500
Tunnel="yes" allows params to be passed transparently from one template
to another, regardless of the number of template matches in between.

Set tunnel="yes" on the with-param when calling or applying templates,
set tunnel="yes" in the receiving stylesheet.

<a>1</a>
<b>
  <c>something</c>
</b>

<xsl:template match="a">
  <xsl:variable name="c" select="a+1"/>

  <xsl:apply-templates>
     <xsl:with-param name="count" select="$c" tunnel="yes"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="b">
  ... Something ...
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="c">
  <xsl:param name="count" tunnel="yes"/>

  <xsl:value-of select="$count"/>
</xsl:template>





Thanks!
Angela

-----Original Message-----
From: Justin Johansson [mailto:procode@xxxxxxxxxx]
Sent: Friday, July 27, 2007 10:24 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Tunnelled params and variables

What are the use cases for having tunnel="yes" on xsl:params and
variables?

It must be in the spec for some good reason, though I hestisate using
the feature fearing that the use thereof may lead to a poor programming
practice.

I well remember the list's attitude to local functions had these been
allowed in XSLT.

Thanks for the insight,
Justin Johansson

*** A horse with no name is called Lambda ***

Current Thread