brandnewbox.co.uk

Home of Andrew Weaver, a uk-based web developer specialised in building high-quality websites

Making RSS pretty using XSL and CSS

Wednesday, August 24th, 2005

Andrew Weaver

Category:

In Ben Hammersley’s Making Your RSS Feed Look Pretty in a Browser he discusses using CSS to improve the display of RSS feeds in web browsers.

This article discusses using the alternative method of using XSL.

 

Adding the stylesheet to the RSS feed

The first step in the process transforms the RSS feed to HTML. This procedure only occurs when the feed is viewed in a web browser so RSS feed readers will ignore it.

Within the RSS file was add the line:

<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="http://www.example.com/rss.xsl"?>

below the xml declaration at the very start of the file. (This assumes the XSL stylesheet is called rss.xsl and hosted at http://www.example.com/).

Here is an example XSL file.

Using CSS to style the transformed RSS feed

The XSL stylesheet in the example above references a CSS stylesheet that can further transform the look of the resulting HTML.

Here is an example CSS file.

The result

Rss feed transformed by XSL and CSS

An example RSS feed transformed by XSL and CSS

Comments

There are no comments yet.

Commenting is not available in this weblog entry.

© brandnewbox.co.uk 2004-2010