I have a param in my template. and i've assigned a value '1' to it. This template is called recursively from within itself.
In your example you are not calling the template, you are pushing the children
I want to keep incrementing the param everytime this template is called. Is it possible to do so in xsl?
<xsl:apply-templates select="test"> <xsl:with-param name="number">1</xsl:with-param>
Careful, you aren't declaring a type of number here, but of type "result tree fragment" which can be coerced into a number but isn't really a number yet.
</xsl:apply-templates>
<xsl:template match="test">
Here you are declaring a template to match elements named "test", you aren't declaring a template named "test".
<xsl:param name="number"> ........
<xsl:apply-templates select="test">
Here you are pushing child elements named "test", you aren't calling a template named "test".
<xsl:with-param name="number" select="$number+1"/> </xsl:apply-templates>
I think your problems will be solved by using "call-template" ... see below.
I hope this helps.
................ Ken
T:\ftemp>type meena.xsl <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/"> <xsl:call-template name="test"/> </xsl:template>
<xsl:template name="test">
<xsl:param name="number" select="1"/>
<xsl:text/>Loop <xsl:value-of select="$number"/>:
<xsl:text/>
<xsl:if test="$number<5">
<xsl:call-template name="test">
<xsl:with-param name="number" select="$number + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template></xsl:stylesheet>
T:\ftemp>xt meena.xsl meena.xsl <?xml version="1.0" encoding="utf-8"?> Loop 1: Loop 2: Loop 3: Loop 4: Loop 5:
T:\ftemp>
-- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002
G. Ken Holman mailto:[EMAIL PROTECTED] Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) ISBN 0-13-065196-6 Definitive XSLT & XPath ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-07-1 Practical Formatting Using XSLFO XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed), articles, training(instructor-live,Internet-live,web/CD,licensed) Next public training: 02-02-11,12,14,15,18,21,03-04,05,06,08,11, - 04-08,09,10,12,05-14,15,06-04,07
