Re: [xsl] assigning <xsl:param> to <xsl:template mode="$">???

Subject: Re: [xsl] assigning <xsl:param> to <xsl:template mode="$">???
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Fri, 20 Apr 2001 18:44:18 -0700 (PDT)
name and mode in <xsl:template name="?" mode="?"> are QNames
name in <xsl:call-template name="?"> is a QName

So you have to supply a fixed name in both cases. If you want
a parameter/variable to determine what processing is done, you
are going to have to have some type of conditional in the body
of the template. I frequently put a variables at the top of
the style sheet that controls debug output for example. However, you
have to repeat the logic in every place you want the alternate

<xsl:variable name="mode" select="'one'"/>
<xsl:template match="?">
  <part of template>
  <xsl:if test="f($mode)"><special processing></xsl:if>
  <more of template>
  <xsl:if test="f($mode)">)"><special processing></xsl:if>
  <more of template>

But this not necessary any worse than repeating the body of a 
template (with perhaps only minor changes) for each mode you 
might want to potentially invoke.

<xsl:template mode="one">
   <a lot of typing repeated in mode two/>
   <a little typing unique to mode one/>

<xsl:template mode="two">
   <a lot of typing repeated in mode one/>
   <a little typing unique to mode two/>



Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

 XSL-List info and archive:

Current Thread