<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<xsl:template match="/">&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"&gt;
&lt;rss version="0.91"&gt;
&lt;channel&gt;
&lt;title&gt;Backports.org Changelog&lt;/title&gt;
&lt;link&gt;http://www.backports.org/changelog.html&lt;/link&gt;
&lt;description&gt;Changelog to the Backports.org APT Repository&lt;/description&gt;
&lt;language&gt;en&lt;/language&gt;
<xsl:variable name="maximum" select="number(5)"/>
<xsl:variable name="iteration" select="number(0)" />
<xsl:call-template name="do.changelog">
<xsl:with-param name="maximum" select="$maximum + 1"/>
<xsl:with-param name="iteration" select="$iteration"/>
</xsl:call-template>
&lt;/channel&gt;
&lt;/rss&gt;
</xsl:template>


<xsl:template match='clset'>
	&lt;item&gt;
		&lt;title&gt;<xsl:for-each select='entry'>
				<xsl:if test='child::critical'>CRITICAL:</xsl:if>
				<xsl:apply-templates />; &lt;br /&gt;
			</xsl:for-each>&lt;/title&gt;
		&lt;pubDate&gt;<xsl:value-of select='date'/>&lt;/pubDate&gt;
		&lt;link&gt;http://www.backports.org/changelog.html&lt;/link&gt;
</xsl:template>


<xsl:template name="do.changelog">
	<xsl:param name="maximum"/>
	<xsl:param name="iteration"/>
	<xsl:if test="$iteration &lt; $maximum">
		<xsl:variable name="node" select="/changelog/clset[$iteration]"/>
		<xsl:apply-templates select="$node">
			<xsl:with-param name="maximum"/>
		</xsl:apply-templates>
		<xsl:call-template name="do.changelog">
			<xsl:with-param name="maximum" select="$maximum"/>
			<xsl:with-param name="iteration" select="$iteration + 1"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

</xsl:stylesheet>

