Wednesday, July 14, 2004

iTunes XML revisited

Thanks to some useful comments from Norm Walsh, I was able to make some major strides in transforming iTunes' pracically useless XML.

Due to the way Apple chose to structure the iTunes XML playlist export, I ran into some problems with Norm's approach: I kept getting invalid QName errors on some of the elements. Turns out, it was trying to create element names based only on the track number.

I hacked around and here is the resulting stylesheet: itunes.xslt

I still need to set up the XML pipeline, as Norm suggested, but for now, here is a simple output stylesheet as well: playlist.xslt

I plan to handle most of the formatting with CSS at a later date.

The only problem with this XSL, is that I've now lost the order of the original playlist. I imagine this could be solved with keys and sorting, but I just don't have time to mess with this further.

Hope you enjoy this! I'll be posting my playlists much more easily now.

BTW, I used Michael Kay's Saxon 8.0 for the transformations!

See also: