Re:[xsl] About <xsl:param> and <xsl:with-param>

Subject: Re:[xsl] About <xsl:param> and <xsl:with-param>
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 5 Nov 2002 12:40:21 -0000
Hi,
>In the next xsl I want to make that the param "cod" be >incremented in each
time that the <xsl:for-each> cicle >occurs, but it's result is an error
 you can not incriment the
variables in XSLT.
it's not possible in XSLT, because you can't reassign the value of a
variable..
You may use other techniques like recursive templates to solve your
problem.. or If you tell what your requirement is , some one in the list can
definitely help you out.


><xsl:with-param name="cod" select="number($cod+1)"/>
This is a wrong usage of xsl:with-param ..
<xsl:with-param > is used when calling a template by using
either <xsl:call-templates> or <xsl:apply-templates> .

a typical use of <xsl:param> and <xsl:with-param> :

<xsl:template match="/">
    <xsl:call-template name="my-template">
        <xsl:with-param name="param1" select="'param1 value'"/>
        <xsl:with-param name="param2" select="'param2 value'"/>
    </xsl:call-template>
</xsl:template>

<xsl:template name="my-template">
    <xsl:param name="param1"/>
    <xsl:param name="param2"/>
    Param Values : <xsl:value-of select="$param1"/> and <xsl:value-of
select="$param2"/>
</xsl:template>

HTH

Vasu



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


Current Thread