XSLT Support

April 9th, 2004

I’ve been wanting to develop a “dashboard” style system to information from a bunch of different systems at work. Since we use an awful lot of XML around the place at work the easiest way to do that is most likely to use XSLT to transform the various XML feeds into HTML to be displayed and piece it all together into one page. Systems that don’t speak XML could have a gateway developed for them easily enough.

Anyway, I figured I’d write a few simple perl scripts to piece the various XSTLs together and make it all work, hopefully develop something fairly pluggable so that it’s easy to add new feeds as required.

So I went looking for XSLT processors for perl and wasn’t particularly impressed with anything I found. The XSLT I had been using and that worked with both XAlan and MSXML but barfed with XML::XSLT. The other XSLT libraries I found either failed to compile on OS X or failed to run once installed. Now admittedly that’s mostly going to be my lack of knowledge of C and perl but I was surprised there wasn’t a simple, standard XSLT processor.

So then I tried PHP and while it has XSLT commands that looked promising, they weren’t compiled in to my copy of PHP. It appears to be off by default in PHP because it depends on a bunch of native libraries that may not be present on most systems.

So in the end, I think I’ll write the system in Java simply because it’s actually good at handling XSLT. Why isn’t XSLT straight forward in other languages? It seems that they’re trying to leverage off existing C libraries to save having to write a complete XML parser and XSLT processor natively in the language. Unfortunately, that seems to introduce a number of headaches when actually trying to use the libraries.

I guess Java makes communicating with C libraries more difficult than with languages like perl or PHP and that in combination with it’s dedication to cross-platform support seems to have given it an big advantage in situations like this by not encouraging the reuse of existing code in another language. It certainly makes it a heck of a lot easier for users of the language.

So what am I missing? Is there a simple way to get a fully compliant XSLT processor in an effective scripting language? Is there another scripting language that’s good for piecing together simple systems that does have straight-forward XSLT support? Python? Ruby? Help!

AppleScript is cool

April 9th, 2004

I hate how slow Entourage is when accessing an imap server. Most of it’s problems stem from the fact that it only downloads things from the server when you actually ask for them. While that’s great for saving bandwidth, it means a lot of latency between clicking on a message and actually getting to see it - particularly since Entourage and imapd don’t seem to get on much and occassionally just hang the connection.

So I’ve switched to Mail.app (again). I go through these fazes of choosing different email clients until I get sick of their particular limitations. The greatest problem with Mail.app is that it only checks the email in your inbox and not in any other folders so if you happen to use procmail on the server (as I do) you have to manually click through every mailbox to see if there’s any new messages.

The solution? Applescript. Originally I added the following line to my crontab and was happy:

osascript -e 'tell application "Mail" to sychronize with account "adrian@intencha.com"'

The trouble being that if I quit Mail, cron would start it again every minute. A little more applescript to the rescue:

tell application "Finder"
set appIsRunning to process "Mail" exists
end tell

if (appIsRunning) then
tell application "Mail"
synchronize with account "adrian@intencha.com"
end tell
end if

Now Mail will synchronize every mailbox in the IMAP account every minute (I’ll probably drop that back to every 2 or 3 minutes) but do nothing if Mail isn’t already running. Applescript is cool.

Leo’s Lost It

April 9th, 2004

You know, I can understand Leo being disappointed at my dropping out of his powerbook acquisition scheme but I didn’t expect him to get nasty:

Also, I know need to find a way to stick it to Adrian. There’s but one way: I need the 17″ model now (he got a 15″).

I think someone’s compensating for something. The fact that my first comment to my housemate (who owns a 12″ powerbook) was “this should put an end to your computing supremacy” not withstanding.

Of course I think Leo’s desperation is getting in the way of his logic now:

Anyway, here’s the new scheme: apple should give it to me. C’mon Steve, show you’re serious about open source and supporting young scientific, ahum, talent. Do throw in an XServe while you’re at it. Imagine the, ehm, enormous positive publicity you’ll get from having my popular — really! — weblog hosted on an xserve and updated (wirelessly because I’m sitting out in the sun on our wireless campus) with a fancy powerbook.

Really Leo, that’s stretching it a bit. The powerbook screen is a bit hard to see in full sun - you really should ask for an Apple umbrella too. Oh and a few beautiful women gently fanning you and feeding you grapes would improve productivity no end - obviously increasing the amount of publicity you generate for Apple.