Wednesday, June 16, 2004

XSLT sorting on dates

Roll on XSLT v2 is all I can say. First off, I've not blogged for the last few days due to a sudden and rather large amount of work, which was not Java or XML related, so I didn't have that much to post about. However today we got a query from a licensee of our technology. I'm not going to go into masses of detail about our technology (mostly because it's not that interesting) but needless to say at the end of hte pipeline it produces output (HTML, TEXT, XML, PDF etc) by passing the output XML through XSLT.

This licensee was asking (read moaning!) about that fact that data information came out in the XML as either "YYYY-MM-DD G" or similar with a time on the end. For those of you who may not recognise it the "G" is the Era, i.e. "AD" or "BC". He said he couldn't do any sorting on it in the XSLT.

One of my biggest issue with people is when they ask for help without even trying to find the answer themselves, I judge this by how long it takes me to find the answer....

...10 minutes with the excellent Zvon XSLT Reference and Stylus Studio and I had all dates ordering correctly with only 9 lines of XSLT. You can imagine the curt yet polite response to the licensee.

Still, all of this sort (no pun intended) of thing will be a lot easier when XSLT v2 is available, however I do think that will be a long time coming. After talking to Michael Kay, creator of Saxon and Jacek R. Ambroziak creator of XSLTC at Sun and now the Gregor/XSLT compiler at XML Europe last year, XSLT v2 sounds like it will be much harder to implement and more importantly optimise in XSLT processors.