Translating XBEL to OPML with XSL

I've been playing with Dave Winer's OPML Editor, and it's starting to grow on me. (Here's a link to my OPML blog.)

One of the coolest things about the OPML Editor is the Map A Domain feature, through which the community server that Dave set up (running on the Frontier kernel) can translate an OPML file to a tree based web site. For an example, see my mapped domain: opml.yabfog.com.

But this is just a prelude to the exciting part: I wrote an XSL stylesheet that translates an XBEL bookmark file (such as that produced by the Firefox web browser*) into OPML. I initially tried to do this (and succeeded) with PHP, but that was a royal pain (and trouble-prone because I was treating the XML as a text format). I had seen Joshua Allen's solution for applying XSL Transformations to OPML, but it worked in the wrong direction. So I taught myself how to use XSL.

I am really pleased with the results.

This XSL stylesheet transforms XBEL to OPML.

And this XSL stylesheet transforms XBEL to XHTML.

Here is the resulting OPML output.

* I've been using it for so long I forgot it was an extension! The Bookmarks Synchronizer is a must have extension for Firefox, especially if you want to keep your bookmarks in sync among multiple computers. Basically, it uploads/downloads your bookmarks to/from an FTP server in XBEL format. In my case, the FTP server is my webhost, so I wanted a way to not only keep my bookmarks in sync but also make them available over the Web no matter where I am or on whose computer (or on which operating system, for that matter) I am working.