XSLT using Ruby

January 31st, 2008

Short Story

libxsl-ruby is a nightmare to install. If you can indeed get it to install at all. I couldnt get the bloody thing to install at all on my 10.5 OSX box; and thats with ALL the required libs installed. I get the impression that its not very well maintained anymore and the project following has dropped off.

I turned to ruby-xslt – based on REXML, so yes, its slower. If your looking for speed then persist with the libxsl ruby path, but otherwise, save yourself a lot of time and just use this. Its vastly simpler!

Long(er) Story

Libxsl sucks. Strong statment I know. I would say im a fairly techincal chap, and ive just spent, nay, wasted, the last 3 – 4 hours trying to work out why libxsl-ruby wont install. Thats a bit of a bugger indeed. Who knows what the problem is, but ultimately its less portable due to reliance of the Gnome XML parsing libs. Granted there very fast, but thats no help at all if you cant even install them.

REXML vs Libxml is a non-contest. We all know libxml is significantly faster – if you need that speed then i strongly advise you to continue with libxml; it will pay dividends in the end. If however your not going to need very fast parsing, then really, save yourself a lot of wasted time and use REXML.

REXML is bundled with the ruby distribution, so its also a lot more portable that libxml2. Anyway, if your even still reading, stop now, and bosh this into your terminal:

sudo gem install ruby-xslt

Job done.

5 Responses to “XSLT using Ruby”

  1. Tom Bagby Says:

    Unless you are using a completely different ruby-xslt than I am, ruby-xslt is based on libxml/libxslt not REXML. It is easy to install on OSX, it probably just worked magically if you had gotten those libs installed while you were mucking around with libxsl-ruby.

    I am still having a headache working around the portability issue of getting it working on Windows machines, so I wouldn’t go around claiming it’s all that portable.

  2. Tim Perrett Says:

    Hey Tom,

    Hmmm, i had a look at the src for ruby-xslt and it appears it supports both libxml and REXML. Good catch!

    Tim

  3. Tom Bagby Says:

    I re-stumbled back to this blog post while looking for information regarding ruby-xslt memory leaks (of which there are several).

    ruby-xslt accepts REXML documents as an alternative input format only. All the processing is done by libxslt. I have been digging around in it’s guts for a while now as I sadly based a real product on this and have been fixing bugs in the C wrapper.

  4. Andy Orahood Says:

    I’ve been horribly confused trying to install an xslt package because of the two different libraries and the fact that ubuntu provides ruby-xslt in a package named libxslt-ruby, not to be confused with the gem libxsl-ruby (which of course I did confuse it). So I was trying to use the API for libxsl-ruby with the ruby-xslt library and failing miserably! I think I’ve got it straightened out now and have removed the libxslt-ruby ubuntu package and installed the libxsl-ruby gem. Whew. I thought I was going crazy for a while.

  5. Tim Perrett Says:

    Hey Andy,

    Good god that is confusing!! Thanks for your comment, perhaps others will come across this before enduring the pain you obviously have :)

    Cheers, Tim

Sorry, comments are closed for this article.