<xslTutorial creator="nicmila@idoox.com">
<index keywords='xsl:param xsl:with-param mod'/>

<description>Parameters for a template can be passed with xsl:with-param element. If the template contains a xsl:param element with the same name as name attribute of xsl:with-param, this value is used.  <stylesheet id='id2'/> shows a typical example. If you want to pass a variable, you have to define this variable with xsl:param element. Look at <stylesheet id='id3'/> for wrong approach.</description>

<xmlSource id="id1">
<number>1</number>
<number>3</number>
<number>4</number>
<number>17</number>
<number>8</number>
</xmlSource>

<attValues>
<value match=''></value>
</attValues>

<xslStylesheet id="id2">

<xsl:template match="/">
<TABLE>
<xsl:for-each select="//number">

<TR><TH>
<xsl:choose>
<xsl:when test='text() mod 2'>
<xsl:apply-templates select=".">
<xsl:with-param name="type">odd</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</TH></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="number">
<xsl:param name="type">even</xsl:param>

<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select='$type'/>
<xsl:text>)</xsl:text>
</xsl:template>
</xslStylesheet>

<xslStylesheet id="id3">

<xsl:template match="/">
<TABLE>
<xsl:for-each select="//number">
<TR><TH>
<xsl:choose>
<xsl:when test='text() mod 2'>
<xsl:apply-templates select=".">
<xsl:with-param name="type">odd</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</TH></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="number">
<xsl:variable name="type">even</xsl:variable>

<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select='$type'/>
<xsl:text>)</xsl:text>
</xsl:template>
</xslStylesheet>

</xslTutorial>