tags:

views:

95

answers:

0

Back in the days when all the major browsers displayed RSS feeds as ugly XML, we implemented an XSL stylesheet so that, when a user browsed to the feed, it would do the following:

  • Look pretty
  • Explain what RSS was - it wasn't so widespread back then
  • Provide a text box to copy the feed url in order to paste it into a feed reader ... just in case the user didn't know they had an address bar that did the same thing
  • Provide links to easily subscribe to the feed with Google, Yahoo, or Windows Live
  • Provide a link back to the main list of feeds ... just in case the user didn't know they had a back button
  • Finally, list out the items in the feed as links that can be clicked on

In order to do this, you had to add the XSL declaration to the top of the feed:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/rss/rss.xsl" type="text/xsl"  media="screen"?>

Then the major browsers came out with their current method of providing a built-in display mechanism for displaying feeds, but we wanted to keep our stylesheet because it contained some things that the browsers' implementations lacked (like the Google subscribe) and because we wanted a consistent experience across browsers. This required a little hack where you add an XML commment before the RSS declaration containing enough spaces so that the RSS declaration didn't appear in the first however-many bytes of the document, at which point IE and Firefox would give up and display the feed as XML.

This worked for the past several years, but I just noticed today that we are outputting our feeds with a MIME type of "application/xml" when feedvalidator.org says it should be "application/rss+xml". I made that change to be compliant, and now the stylesheet no longer works in IE or Firefox.

Does anyone know why the stylesheet doesn't work with "application/rss+xml" or what can be done to restore it, while still having a validated feed?