Doing Something Useful with RSS

21 November 2003

RSS is a simple method of providing information about a site for others to use and is typically used by News orientated sites to syndicate their content. A RSS “feed” is essentially a XML file, either hand-cafted or machine-made, that conforms to one of the RSS specifications and is set loose on the world for applications that understand RSS to pick up and provide links back to the original content.

The most common use of RSS is to simply allow people/devices/applications direct access to the XML file containing the RSS information and let them do what they will with it but really interesting things start to happen once you have gone the next step and are using XML for all your content.

RSS and XSL

If you have worked through the XML tutorial on this site you will know what it means to have all your content already contained in XML format and how XSL is used to translate that XML into XHTML for the browsers to present. XML is an extensible markup language which essentially means the tags you use to markup content are not restricted to a particular specification so it is no big deal for the XML if you combine tags for content and tags for RSS into one file (either manually or on the server).

Once the RSS file is available it can be translated into XHTML via the same XSL used to translate the content and this where the power of having the RSS directly feed into the site’s content becomes obvious.

Obvious and Useful.

Example time. The ZYPE web site has a RSS feed set up for anyone to use. There is nothing particularly clever about the XML as it simply adheres to the RSS 2.0 specification and can be added to RSS applications. It contains one channel and the items that make up the latest additions to the ZYPE site. Each item has title, description, link and a publication date (using the Dublin Core Metadata element).

The RSS file however is also used to drive the “Latest Updates” panel on the home page and the News Archive so updating the one file updates three parts of the site with different, if related, purposes.

On the home page the RSS is called in by the XSL that handles the home page (layout-home.xsl) and then parsed using an imported XSL that specifically handles the RSS feed (news.xsl).

For the News Archive the content XML simply has a small placeholder tag that is replaced with the contents of the RSS file by news.xsl. As all the combining of XML happens on the server the RSS file itself is left unscathed and remains available for use externally.

Using External RSS

The next obvious step is to be able to pull in other people’s RSS feeds and present them on your site in your style. As long as the RSS files conform to a common RSS specification and you are using XSL on your site it is possible to combine XML feeds from external sources and present them as true syndicated content.

Note: At the time of writing we are still working on this one but hope to have it solved and in use on projects soon.

Wrapping up

Despite its simplicity RSS is a great format and very useful for providing a seamless way for other to learn about and access your content as it gets updated. As a further bonus it is a XML format which makes it an incredibly useful format that can be styled in whichever way is relevant for the people using it.