What I thought was a smart Idea.

With the introduction of IE7 and the automatic RSS feed detection and the special search tags that I am now including at the footer of each blog entry, I had a thought: Why not include all the feeds specified into an RSS feed that summates the results of all the tags. This feed would be viewable by your favorite browser or feed reader. It would get the results of each RSS feed and genereate a new RSS feed, and the best bit was that it shouldn't requrie any special server or program; Just the browser/feedreader that the user used.

I quickly thought about this and thought the possiblilties would be endless (well nearly) I could provide a short feed file, that linked to the other blogs/feeds etc, my server resources would be minimal, the feed owners would see extra traffic and hits to their blog (fully credited of course) and the users would get the best of both worlds. All the processing would be done on the client.

I knew that the RSS 2.0 format could be extended with custom schema elements, so I could extend the channel element to include links to extra feeds.

I developed an extension to the RSS 2.0 format, it would extend the Channel element by including a new "Sources" element containing a collection of "Source" elements each of which simply pointed to the RSS feed that it needed to include.

<?xml version="1.0" ?><?xml-stylesheet href="rssFeed.xsl" type="text/xsl" ?><rss version="2.0" xmlns:merge="http://kinlan.co.uk/merge">    <channel>        <title>Kinlan</title>        <link> </link>        <description>Kinlan RSS feed.</description>        <managingEditor>Paul Kinlan</managingEditor>        <webMaster>paul@kinlan.co.uk</webMaster>        <pubDate>Unknown</pubDate>        <merge:Sources>            <Source id="Technorati" href="http://feeds.technorati.com/feed/posts/tag/Styling" />                </merge:Sources>    </channel></rss>

I then developed a simple XSLT that would scan this "plain" RSS feed and pull in the RSS feeds specified by the Source element. I know MSXML does this. There is the ability to import another set of nodes from an external document in MSXML's XSLT engine (it might be standard, I am not too sure).
<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:merge="http://kinlan.co.uk/merge">    <xsl:output method="xml"/>    <xsl:template match="channel">        <xsl:copy-of select="/." />        <xsl:element name="rss" namespace="">            <xsl:apply-templates select="/rss/channel/merge:Sources/Source" />        </xsl:element>    </xsl:template>    <xsl:template match="/rss/channel/merge:Sources/Source">        <!--Import Some More Documents -->        <xsl:copy-of select="document(@href)//item"/>    </xsl:template></xsl:stylesheet>

I tested it locally and it worked! Bonus! This is easy I thought to myself. Here in front of me, I have 3 seperate RSS feeds merged into one simple feed. I thought on, with a little more development I could provide sorting, so that the output is sorted by date and all the feeds are merged in to one list.

Then it hit me! I uploaded the xml and the xslt to my web server, I set it to so that it was pulling in two remote technorati feeds. I typed in the URL and .................... ERROR!

Pants! Why did this happen?

I quickly thought on.

  • IE has security (no jokes please ;))
  • IE has data island security
  • I was essentially pulling in data from a domain other than the one I was in.

I was stopped in my tracks, I couldn't pull in anything that wasn't on my own domain (kinlan.co.uk). I took a little more time to think about what had happened and I realaised several other things that would stop me down the line.

  • It is fine and dandy having data pulled in from different sources by the client that needs them, but there is no guarantee that the engine that pulls them in will have an XSLT Engine, let alone MSXML.

  • If I wanted it all done on the client, I can't use any fancy AJAX stuff either, nor could I use any MSXML objects in the browser for the same reason as the previous point.

Both of the above points meant that if a non Internet Explorer client, perhaps RSS Bandit etc pulled down my feed all it would see is an empty blog with my custom elements.

Oh well, if it worked it would have been cool, because it didn't work I have learnt some interesting stuff! :)

Here are the links to the XML and the XSLT.

Technorati Tags
[feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed]

Feedster Topics
[feed], [feed], [feed], [feed], [feed]

MSN Searches
Internet Expolrer [feed], IE7 [feed], IE7 RSS Feed Discovery [feed], Using XSLT to display RSS [feed]