Hi everyone!
First post here.
I've been programming for years but this xslt confuses the heck out of me.
Can someone please tell me how to get this piece of code to work? It's a fragment reading in an rss feed and I'm trying to get it to only show 5 news items. The test for the 'news' works ok but I can't get the loop to work. I get this error
MM_XSLTransform error:
"e:\Domains\wiiuser.co.uk\wwwroot\rssfrag.xsl" is not a valid XSL document.
XSLT compile error at file:///e:/Domains/wiiuser.co.uk/wwwroot/rssfrag.xsl(51,5). See InnerException for details.
The code is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:variable name="n-rows" select="5"/>
<xsl:param name="i" select="0"></xsl:param>
<xsl:template match="/">
<link href="includes/main.css" rel="stylesheet" type="text/css" />
<div id="rssfeed1">
<div id="rssheader">
<p class="newsheader">Wii News Provided by Officialnintendomagazine.co.uk</p>
</div>
<xsl:for-each select="rss/channel/item">
<xsl:if test="category='News'">
<xsl:if test="$i <= $n-rows">
<div id="rssitem">
<xsl:variable name="iChange1" select="substring(pubDate,1,16)"/>
<p class="rssdate"><xsl:value-of select="$iChange1"/></p>
<h2 class="rss">
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</h2>
<p class="bodytext_greyRSS"><xsl:value-of select="description" disable-output-escaping="yes"/></p>
</div>
<xsl:with-param name="i" select="$i + 1"/> [THIS IS THE ERROR LINE 51]
</xsl:if>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
Any help would be appreciated.
Many thanks