to LooselyCoupled.com homepage
 
 Weekly emails: how to advanced search
 Glossary lookup:

 

Loosely Coupled weblog


Friday, February 13, 2004

RSS from Blogger

There are so many ways of getting an RSS feed from a Blogger weblog that I can't understand why people are making such a fuss about Blogger's recent adoption of Atom as its syndication format. Have these people never heard of transformation?

The controversy was reported in all its gory details by CNET News.com this week: Google spurns RSS for rising blog format. Somehow, weblog syndication is a topic that excites strong passions. But people are letting their emotions get the better of them. It really doesn't matter what syndication format is chosen by Blogger (which Google owns), because all of the formats available are written in XML, and the output is published on the open Internet. Therefore the market is perfectly free (if it so chooses) to reject Google/Blogger's choice and substitute an alternative.

The first option is one that I adopted when I first started using Blogger, getting on for two years ago. This was before Blogger offered an RSS feed, which I wanted to put right because I felt it important to publish in RSS as well as HTML. The solution I came up with was Pro2rss, which was based on Julian Bond's RSSify. This takes advantage of the simple fact that Blogger uses templates to publish each blog entry, so it's very easy to put markup into the template that identifies each of the components — the title, link, body, etc. I would do it more elegantly if I were doing it now. At the time I knew nothing about XHTML markup and it was my first venture into PHP (actually my first venture into any kind of programming). But it works, and it demonstrates how easy it is to adapt Blogger to any form of third-party republishing process you like.

Nowadays, there's a much more elegant second option, which uses XSLT to transform either the blog entry or (this is even easier to set up) the Atom feed itself into RSS. Anyone whose web host offers PHP version 4.2.2 or above probably has PHP's XSLT functions enabled using the Sablotron XSLT processor, and it only takes a few lines of code to set this up to read in any XML source and XSL template and spout out a transformed result. If you don't believe me, try it yourself. I've set up a simple demonstrator which, in honor of my earlier effort, I've called Pro2xslt.

If I had a bit more time (a half hour would probably do it) I would set up a stylesheet that would produce RSS output from any Blogger Atom source. Perhaps someone else will oblige instead. If not, perhaps I'll do it tomorrow. It would be fun. It also makes a serious point, which is that, once you have a certain level of standardization in an open network (and open source software to exploit it), anyone's ability to impose their choice on the market is irrevocably constrained.

[UPDATE added Feb 14] Sam Ruby promptly responded last night (thanks, Sam) with a URI for an XSLT template that transforms Atom to RSS, so I've added this as the default option on the form. But unfortunately this makes the Sablotron processor throw an error ("unexpected attribute 'exclude-result-prefixes'"), which I'll have to look into.

[UPDATE added Feb 14, later on] I'm not sure why Sablotron is rejecting the attribute, unless it's an old version. There's no easy way unfortunately of checking the version number when on a shared host. Meanwhile, I've now realized that the stylesheet kindly suggested by Sam Ruby is one that converts to RSS 1.0, which although consistent with Blogger's previous RSS output, is hardly calculated to please those who were complaining about its switch to Atom, so I've removed it as the default value on my form. I've not yet managed to create an alternative stylesheet for the Atom-to-RSS conversion, but I have tested the demonstrator with other transformations and it does work, so if anyone comes up with a stylesheet that does this, please feel free to test it out and let me know the outcome.

[UPDATE added Feb 15] OK, I've now finished a working stylesheet that transforms Atom into RSS 2.0. I've put this in as the default XSL file on the Pro2xslt form (though you're welcome to substitute your own). This is really just to demonstrate that it can be done — it doesn't handle all eventualities, just the basics, and of course it may break if the Atom spec changes some more.

posted by Phil Wainewright 10:10 PM (GMT) | comments | link

Assembling on-demand services to automate business, commerce, and the sharing of knowledge

read an RSS feed from this weblog

current


archives

latest stories RSS source


Headline news RSS source


 
 


Copyright © 2002-2005, Procullux Media Ltd. All Rights Reserved.