<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="howMany">
20
</xsl:variable>
<xsl:variable name="posts" select="$currentPage/descendant-or-self::node [@nodeTypeAlias='umbracoBlogComment']"/>
<xsl:variable name="total" select="count($posts)"/>
<xsl:variable name="pubDate">
<xsl:for-each select="$currentPage/descendant::node [@nodeTypeAlias='umbracoBlogComment']">
<xsl:sort select="@createDate" data-type="text" order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="@createDate"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<rss version="2.0">
<channel>
<title>
Darren Ferguson - Blog comments
</title>
<link>
http://www.darren-ferguson.com/?altTemplate=CommentRSS </link>
<pubDate>
<xsl:value-of select="$pubDate"/>
</pubDate>
<generator>
umbraco 3.0.5
</generator>
<language>
en
</language>
<xsl:apply-templates select="$currentPage/descendant-or-self::node [@nodeTypeAlias='umbracoBlogComment']">
<xsl:sort select="@createDate" order="descending"/>
</xsl:apply-templates>
</channel>
</rss>
</xsl:template>
<xsl:template match="node">
<xsl:if test="position() <= $howMany">
<item>
<title>
<xsl:value-of select="@nodeName"/>
</title>
<link>
http://www.darren-ferguson.com/<xsl:value-of select="@id"/>.aspx
</link>
<pubDate>
<xsl:value-of select="@createDate"/>
</pubDate>
<dc:creator>
<xsl:value-of select="./data [@alias='name']"/>
</dc:creator>
<guid>
http://www.darren-ferguson.com/<xsl:value-of select="@id"/>.aspx
</guid>
<content:encoded>
<xsl:value-of select="concat('<![CDATA[ ', ./data [@alias='comment'],']]>')" disable-output-escaping="yes"/>
</content:encoded>
</item>
</xsl:if>
</xsl:template>
</xsl:stylesheet>