Friday 30 September 2011

Feeding

This morning I was trying to work out if the timezone tables in MySQL needed to be filled, and after checking some more websites, it looks like they probably do need filling. I also checked the current timezone in MySQL, which still said 'SYSTEM'. So I checked the system time in a normal terminal by typing 'date', which printed the date and said UTC. So it looks like I should have MySQL working using UTC as the timezone now.

I spent the rest of the day working on my feed. So far I have the feed, but it doesn't validate, a major reason of which is because the urls aren't url encoded (I'm not a fan of ASCII only). I already had making URLs properly encoded according to standards on my 'to do' list, so looks like I'll have to do that next.

I also started work on the XSL to style the feed like the rest of the site. XSL is something I very rarely use, so I've just been doing lots of googling on it (and on xpath). A problem I had was that the feed was displaying without the XSL being applied. Apparently most browsers (well FF and IE at least) apply their own stylesheets to feeds and ignore any stylesheets specified in the feed. According to one of the commentors on the Firefox bug report for this behaviour, this is because in the large majority of cases a stylesheet is only specified to catch users who try to view the feed in a browser that doesn't support feeds:
Personally, I know of quite literally tens of millions of feeds which are styled for one and only one reason: to keep browsers from showing either raw XML or a helper app dialog to puzzled users
The fix is to apply 512 bytes of padding before the feed root node as the browsers only check the first 512 bytes to see if it is a feed.

For my site I am basing the feed on an example of a photo gallery feed in this IBM article An overview of the Atom 1.0 Syndication Format. When I view the feed without a stylesheet in a browser, it doesn't render any of the content (images), just the textual summary. So for a photo gallery, it does seem that using a stylesheet would be the best way to present a feed to users.

No comments: