Blog Pile

XSLT + RSS: Why Pretty for only some browsers or is some implementations?

I’ve been mildly curious about some of the new attempts at making RSS feeds more human readable at first click- rather than seeing ugly XML code, these “new” feed displays use CSS (Style sheets) and some sort of magical transform method called XSLT — basically it means if you click a link that points to an XML file, it has some nicer formatting applied.

I want to believe.

The problem is that I think a lot of folks doing this are not widely testing, because while it has pretty formatting on a PC with MSIE, or perhaps Mozilla/Firefox on Mac or Windows, it works. I’ve seen less then stellar appearance on Safari, which I had assumed (wrongly) was one of the more standards compliant browsers. Is it a limit of Safari? Am I doomed to switching browsers?

But then I peeked at a feed from a Blogger site, on Safari, and it had the feed + CSS + XSLT cooking. So what have they done right?

For example, here is a new feed shared by Stephen Downes, a transfoemed display of the RSS feed he created for the IT form list, http://www.downes.ca/itforum.xml:

downes-xlst-safari
full image

http://www.downes.ca/itforum.xml viewed in Safari
Ugly, no transform. Unreadable by humans

But it looks okay (I guess) in Mozilla:

downes-xlst-mozilla
full image

http://www.downes.ca/itforum.xml viewed in Mozilla
Better, it has formatting

At this point, I really was chalking it up to a Safari quirk. But then, after Stephen mentioned a new blog from Albert IP, Random Walk in E-Learning, I decided to tack on the magic code to get the feed (Blogger provides Atom feeds, but sadly, stupidly, does not build the links in the standard templates- but the feeds are there, if you just tack on an atom.xml to the URL, or in this case, http://elearningrandomwalk.blogspot.com/atom.xml:

ip-xml-safari
full image

http://elearningrandomwalk.blogspot.com/atom.xml viewed in Safari
Beautiful.

So is it that Blogger has a better transform? Does it have something to do with Atom being the feed format from Blogger? I dunno, this is all new to me, but I am curious to dig deeper.

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

  1. OK, first, repeat after me: nothing works in Safari.

    Sure, this isn’t strictly true, of course. Some things work. But I canot count how many times I’ve heard the phrase “that doesn’t work in Safari.”

    So what’s happening here? Why does the Atom feed work and the OLDaily feed not?

    The OLDaily feed begins with an XML file, like the Atom feed. But the OLDaily feed includes an XSL file, while the Atom feed includes a CSS file.

    The difference between the two is that the XSL used by OLDaily will read the data elements and, depending on what it finds, create some output. While the CSS used by the Atom feed will treat the XML as though it were pseudo-HTML and simply apply formatting to it.

    The method used by the Atom file is described here: http://starvingartist.stanleysy.com/archives/2004/july/safarithemedrssandatomfeedswithcss/

    Exactly the same thing can be done with an RSS feed. Here is an example: http://home.no.net/ldah/kommentarer.xml

    So why did I use XSL rather than CSS?

    Simply, because XSL gives me many more options than CSS. For example, if I wanted to use Javascript with my RSS file, I could only do this in XSL. If I want to display only a subset of the XML content, such as a list of titles only, then XSL would be my ticket.

    Now here’s the kicker: Safari doesn’t support XSL. Not at all (at least, not to my knowledge, though I have searched the web to confirm this). So when Safari encounters an RSS file, it treats it as though it were HTML, resulting in the bad output you experienced.

    So why don’t I simply use the CSS method instead of the XSL method?

    Mostly, because I have long ago given up on supporting Safari’s odd quicks (such as not supporting an entire standard). If you are using Safari, switch. Use Firefox, which (mostly) supports XSL.

    More information: http://interglacial.com/~sburke/stuff/pretty_rss.html

Comments are closed.