xsl-list
[Top] [All Lists]

[xsl] Binding or re-binding tunnel parameters in the middle of a template

2009-12-22 12:22:43
Hello,

I'm writing a transform that makes extensive use of tunnel parameters.
In some cases, I find myself making a series of calls to which the same
tunnel parameter is passed but which is not yet tunneled until the call
itself (often times this is a modified version of the tunnel parameter
that was passed in, but that's not really relevant here; just some
background info):

-----
<xsl:template name="template">
   <xsl:variable name="value" select="..." />

   <xsl:call-template name="tunnelTemplate">
     <xsl:with-param name="tunnelParam" select="$value" tunnel="yes" />
   </xsl:call-template>
   <xsl:call-template name="anotherTunnelTemplate">
     <xsl:with-param name="tunnelParam" select="$value" tunnel="yes" />
   </xsl:call-template>
   <xsl:call-template name="yetAnotherTunnelTemplate">
     <xsl:with-param name="tunnelParam" select="$value" tunnel="yes" />
   </xsl:call-template>
</xsl:template>
-----

Is there any simpler way of reusing that tunnel parameter without having
to type the xsl:with-param over and over again other than wrapping that
whole section in another template and calling that? e.g.:

-----
<xsl:template name="template">
   <xsl:variable name="value" select="..." />

   <xsl:call-template name="subTemplate">
     <xsl:with-param name="tunnelParam" select="$value" tunnel="yes" />
   </xsl:call-template>
</xsl:template>

<xsl:template name="subTemplate">
   <xsl:call-template name="tunnelTemplate" />
   <xsl:call-template name="anotherTunnelTemplate" />
   <xsl:call-template name="yetAnotherTunnelTemplate" />
</xsl:template>
-----

Removing the additional with-params would improve readability, but it
would also be helpful to be able keep all the calls in one template.
That would also mean I would not have to pass in any additional
variables that were defined in "template".

-- Greg


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>