XSLTs: For RSS 0.9x and 2.0

<?xml version=”1.0″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;
<xsl:output method=”html” indent=”yes”/>
<xsl:param name=”TITLE”/>
<xsl:template match=”rss”>
<html>
<body>
<xsl:for-each select=”channel/image”>
<a href=”{link}”>
<img src=”{url}” width=”{width}” height=”{height}” alt=”{title}” border=”0″/>
</a>
<br/>
</xsl:for-each>
<xsl:for-each select=”channel/item”>
<br/>
<strong>
<xsl:choose>
<xsl:when test=”guid”>
<a href=”{guid}” target=”_blank”>
<xsl:value-of select=”title” disable-output-escaping=”yes”/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”title” disable-output-escaping=”yes”/>
</xsl:otherwise>
</xsl:choose>
</strong>
<xsl:if test=”pubDate”>
<br/>
<font size=”-2″>
<i>
Published On:
<xsl:value-of select=”pubDate”/>
</i>
</font>
</xsl:if>
<br/>
<xsl:value-of select=”description” disable-output-escaping=”yes”/>
<xsl:if test=”link”>
<br/>
<a href=”{link}” target=”_blank”>read more…</a>
</xsl:if>
<br/>
</xsl:for-each>
<p>
<xsl:choose>
<xsl:when test=”channel/link”>
<a href=”{channel/link}” target=”_blank”>
<font size=”-1″>
<xsl:if test=”channel/copyright”>
<xsl:value-of select=”channel/copyright”/>
<br/>
</xsl:if>
<xsl:if test=”channel/description”>
<xsl:value-of select=”channel/description”/>
<br/>
</xsl:if>
</font>
</a>
</xsl:when>
<xsl:otherwise>
<font size=”-1″>
<xsl:if test=”channel/copyright”>
<xsl:value-of select=”channel/copyright”/>
<br/>
</xsl:if>
<xsl:if test=”channel/description”>
<xsl:value-of select=”channel/description”/>
<br/>
</xsl:if>
</font>
</xsl:otherwise>
</xsl:choose>
<xsl:if test=”channel/lastBuildDate”>
<font size=”-1″>
Last Build Date:
<xsl:value-of select=”channel/lastBuildDate”/>
</font>
</xsl:if>
</p>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.