• I came accross this page:
    http://starvingartist.stanleysy.com/archives/2004/july/safarithemedrssandatomfeedswithcss/
    It explains how to use a CSS stylesheet and a few images to style an RSS or Atom feed in the browser.
    I had a go at editing my wp-rss2.php file, adding the stylesheet declaration directly below the xml declaration:
    <?xml-stylesheet href="feed.css" type="text/css"?>
    The rest of the file was unchanged, and none of the php code was affected by the edit.
    This broke the feed.
    An RSS validator identified two errors:

    • Feeds should not be served with the “text/html” media type
    • line 1, column 0: XML Parsing error: <unknown>:1:0: no element found

    I’m mystified, as the content type is set explicitly on the page to text/xml, unchanged from the original version.
    Can anyone throw any light on this?
    (I’m running WP 1.2, PHP 4.3.5, IIS, Windows 2003 Server).
    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I would email the guy that you linked to above. He would be the best to answer this question given that it is his hack.

    The css for feeds wasn’t intended for readers… it was intended to mark it up for those who are reading the feed directly through their browsers. Readers are going to expect it to be in a specific format, w/o markup because thier own general gets applied – that way all your feeds in your reader will look & feel the same. The moment the CSS gets included, the doctype changes. It now included markup (display) information and so as a result changes to text/(x)html rather than text/xml. As a result, readers will choke on it.
    TG

    Thread Starter jwelby

    (@jwelby)

    Yes, I hoped that adding a stylesheet link would have no effect on the validity of the feed for aggregators.
    Obviously not.
    Ah well.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using CSS to style my RSS 2.0 feed’ is closed to new replies.