> I am attempting to set a counter using the XSL:param method.
You can't set counters in XSLT. It's not a procedural programming language.
> The following is my XSL code :-
> <?xml version='1.0'?>
> <!--<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">-->;
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
> <xsl:template match="/banners">
> <xsl:param name="count">0</xsl:param>
> <xsl:value-of disable-output-escaping="yes"
> select="count(bannerlist/banner)" />
Why are you doing disable-output-escaping? This is only to be used when you
deliberately want to output ill-formed XML. Here you are outputting a
number, which will never need to be escaped anyway.
> <HTML>
> <BODY>
> <TABLE>
> <xsl:for-each select="bannerlist/banner">
> <xsl:param name="count" expr="count+1"></xsl:param>
(a) xsl:param can be used only immediately within xsl:stylesheet or
xsl:for-each.
(b) The xsl:param element does not have an expr attribute
(c) If you want to refer to the count variable in an expression, you have to
write it as $count
(d) You can't refer to a variable within the element that declares that
variable
(e) What you actually want is the position() function
> <TR>
> <TD>
> <xsl:value-of disable-output-escaping="yes" select="IMAGE" />
(f) Oh dear, I despair.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- xsl:param error
- Vaibhava - Thu, 15 Nov 2001 11:46:21 -0500 (EST)
- Michael Kay - Thu, 15 Nov 2001 12:20:10 -0500 (EST) <=
- Annalisa Ricci - Thu, 15 Nov 2001 12:24:34 -0500 (EST)
- David Carlisle - Thu, 15 Nov 2001 12:25:00 -0500 (EST)
- <Possible follow-ups>
- Vaibhava - Thu, 15 Nov 2001 12:32:10 -0500 (EST)
|
|