[wp-hackers] XSLT: Sample implementation
Owen Winkler
ringmaster at midnightcircus.com
Mon Jan 30 20:51:10 GMT 2006
Matt Read wrote:
> On January 30, 2006 01:14 pm, David House wrote:
>> Right. Now we need an implementation.
>
> Here's a diff for wp-atom.php to do just such that. Sends text/xml if the
> user-agent doesn't accept application/atom+xml.
Why I like this idea:
It shouldn't break things- Clients may care to ask for a specific
mimetype, but in the end, they're likely to accept anything as long as
it's XML-valid. Readers that ask for the non-browser mimetypes will get
them.
It lets us put browser-targetted content into the feeds- Now, since
text/xml is served to browsers, we can put in the XSLT stuff that makes
the feed prettier in some browsers. (I still like my own solution,
which is to not display the feed data at all, instead displaying
two-frame frameset: A top frame with a "this is a feed, use a
feedreader" notice, and the bottom frame with the actual blog home page
in it.)
It should make proponents of feed mimetypes happy - Why? Because it
should promote the use of the correct mimetype for requesting feeds.
Indeed, Matt's other code (as seen in a pastebin) is even better,
because it decides what feed format to present to a client based on the
Accept request header and not the request URI. So if your client likes
Atom best, it would request from http://example.com/feed and get Atom.
A different client could point at the same URI and get RSS 2.0 or RDF,
depending on the q of the Accept. Very nifty.
If interested parties people could comment on why this might suck, that
would be useful. Really, I think this is pretty neat.
Owen
More information about the wp-hackers
mailing list