DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

RSS To Html Conversion

  • submit to reddit
        This file is intended to transform a RSS feed (version 0.9x or 2.0) into html code fragment to be included in a complete page.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    <xsl:output method="html"/>
    <xsl:template match="/">
        <xsl:apply-templates select="/rss/channel"/>
    <xsl:template match="/rss/channel">
        <h3><xsl:value-of select="title"/></h3>
        <p><xsl:value-of select="description"/></p>
            <xsl:apply-templates select="item"/>
    <xsl:template match="/rss/channel/item">
            <a href="{link}" title="{substring(pubDate, 0, 11)}"><xsl:value-of select="title"/></a>
            <p><xsl:value-of select="description" disable-output-escaping="yes" /></p>


Snippets Manager replied on Fri, 2006/03/24 - 2:35pm I just save this as myfile.xml , and then 'link' to it in the head of an rss file? I'm not sure how to implement this. Thanks in advance, and if possible, could you echo reponse to