Re: [xsl] xsl:param error

Subject: Re: [xsl] xsl:param error
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Thu, 15 Nov 2001 19:45:49 +0100
Vaibhava <vaibhava@xxxxxxxxxxx> wrote
> I am attempting to set a counter using the XSL:param method.
[...]
> <xsl:for-each select="bannerlist/banner">
>     <xsl:param name="count" expr="count+1"></xsl:param>

Well, xsl:param may not be used there. You can't set counters
this way. You don't need to in your case. XSLT is not JavaScript.

Replace the faulty line by
  <xsl:variable name="count" select="position()"/>
and drop the line with <xsl:param name="count">0</xsl:param>,
you should now see increasing values in the last column in
your generated table.

You can, of course, use position instead of $count directly (be
aware that there are traps if you do so). Get a good XSLT book
and study these topics more extensively.

BTW you are using disable-output-escaping in a dangerous way.
Delete all occurences immediately.

HTH J.Pietschmann

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


Current Thread