In amongst all the talk of the Atom API (which might one day actually be released and usable) and RSS, and with me working on some XML/XSL things at work, I realised that there’s probably another option entirely with blosxom as far as templates/flavours/themes goes, and it goes a little something like this;
Three Xs, therefore blosxxxom, that’s one for blosxom (Apple’s OSX), one for XML and one for XSL, which are the three technologies we’re dealing with here.
- Install the theme plugin for blosxom and get it working (this plugin makes life much easier!)
- Now create a new theme, with a suitable name (mine’s called ‘blosxxxom’ for the sake of the experiment, and it looks like this; page.blosxxxom. This theme should create a valid XML document from your posts.
- Your XML output should refer to an XSL stylesheet, which will actually take care of doing the formatting, entirely client-side (style.xsl in my example theme file)
- In the XSL file, just use normal XSL processing instructions to handle the output and presentation of the XML document into XHTML!
- Point your browser to blosxom and tell it to use the flavour name that you used to create this theme, and you should be able to see what the output looks like. View the source of the document and you should see the plain XML produced by blosxom 🙂
Now, for a couple notes;
- I made my content_type value in the theme text/xml, but this forced blosxom to encode special characters to be nice for me. I found that it was better to comment this section of the main CGI out so that I could drop the values in, and wrap them in the CDATA tag seen in the XML theme.
- Rather than worry about what’s in the body much, I just wrapped things in a <![CDATA[ tag ]]> to be safe.
- Mozilla doesn’t currently display my output properly – it’s not doing links (or any tags) properly, and it’s just showing them rather than interpreting them as HTML. Anyone got any ideas on this one?
- There’s more to be done, but it’s a fun point to start at, and there’s no reason why you can’t add things like a COMMENTS element to your STORY node, or a KARMA, a META node with a series of elements – it’s pretty free-form if you’re only doing the XML for your own presentation needs!
Hope that’s inspired some people to try some things out that they might not have otherwise tried, and if nothing else, it just demonstrates how flexible blosxom really is! 🙂