This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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
behavior:

<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>
</xsl: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>

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

Regards,

Dan

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]