By: Tom Muck
Page 1 of 4
Adding an RSS feed to a web page is a piece of cake with the XSL features of Dreamweaver 8 and CS3. This article will show the new features of XSL transformation using the freely available Community MX RSS feed, or any other of your choice. The tutorial will require PHP, ColdFusion, or another of the available server models in Dreamweaver, as the XSL functionality uses a server-side file to parse and transform the XML news feed.
Community MX has had RSS feeds since our first day over four years ago. We have dozens of feeds for every category of content, as well as feeds for individual authors, feeds for our blogs, and feeds for any search result. You might say we have a feeding frenzy here. For some lists of our feeds, check:
XSL stands for eXtensible Stylesheet Language, and is a way to parse, style, transform, and present an XML file. If you are unfamiliar with XML, there are literally thousands of examples and tutorials on the web to help, but as a basic introduction you can think of it as a way to contain information in a logical structure, using tags to describe that information. For example, to present an address, you might have a structure like this:
<streetaddress>555 MyStreet Way</streetaddress>
<streetaddress>616 Yocomo Ave</streetaddress>
XML is not succinct—it is wordy and verbose. The tags describing the information in many cases take up more space than the information they are describing. Also, when you have multiple items, the tags will be duplicated for each item. The advantage, however, is that this information can be read by most systems and programs, including database systems, word processor files, spreadsheets, and browsers. This last one is where XSL comes into play for our purposes. XML by itself does not offer a way to display this data, other than as a series of tags and attributes exactly as written, but using XSL you can transform the data into something that can be viewed.
RSS is nothing more than a standardized XML format for a particular purpose: to display news items (or any other items of a similar type). It has an <rss> tag, inside of which is a <channel> tag, grouping the main properties of the news feed together in one place, inside which is also individual <item> tags of news items. A typical RSS feed might look like this:
<?xml version="1.0" ?>
<description>Tom Muck's Blog</description>
<title>My news for today</title>
<description><![CDATA[This is a news item]]></description>
<pubDate>Mon, 14 May 2007 12:42:45 GMT</pubDate>
<title>Another news item</title>
<description><![CDATA[This is another news item]]></description>
<pubDate>Tues, 15 May 2007 10:52:05 GMT</pubDate>
XML is a wide-open language that is only limited by your imagination, however RSS is a strict standard of various tags and attributes that describe news items, much as XHTML is a strict standard of XML that has HTML tags in its allowed list of tags. Browsers already know how to display XHTML. Many browsers and programs now know how to display RSS as well by itself. However, if you want to use an RSS feed inside your web page, you must know how to transform the RSS into HTML for display.