I have just spent a few hours putting together an XSL stylesheet for the default output from iTunes when you export the library as XML. The real upset about the whole thing is Apples method of storing the tags as
<key>Name</key><string>value</string>
It forces a fairly hacky use of following-sibling processors in the XSL.
The code for the XSL sheet is as follows
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"> <xsl:template match="/" > <html> <head> <link rel="stylesheet" type="text/css" xhref="style.css" mce_href="style.css" /> <title><xsl:value-of select="key[1]" /></title> </head> <body> <h1>music</h1> <xsl:for-each select="plist/dict/dict/dict[not(key='Podcast')]"> <div class="track"> <span class="title"><xsl:value-of select="key/following-sibling::node()[1]" /></span> <span class="album"><span class="artist"><xsl:value-of select="key/following-sibling::node()[1]" /></span> :: <xsl:value-of select="key/following-sibling::node()[1]" /> <xsl:if test="key"> (<xsl:value-of select="key/following-sibling::node()[1]" />) </xsl:if> </span> <xsl:if test="key"> <span class="tracks"><xsl:value-of select="key/following-sibling::node()[1]" /> of <xsl:value-of select="key/following-sibling::node()[1]" /></span> </xsl:if> <xsl:variable name="tracklength" select="key/following-sibling::node()[1] div(1000)" /> <span class="time"><xsl:value-of select="round($tracklength div 60)" />: <xsl:value-of select="round($tracklength mod 60)" /></span> <a><xsl:attribute name="href"><xsl:value-of select="key/following-sibling::node()[1]" /></xsl:attribute>Play</a> </div> </xsl:for-each> <h1>podcasts</h1> <xsl:for-each select="plist/dict/dict/dict/key/.."> <div class="podcast"> <span class="title"><xsl:value-of select="key/following-sibling::node()[1]" /></span> <span class="album"><span class="artist"><xsl:value-of select="key/following-sibling::node()[1]" /></span> :: <xsl:value-of select="key/following-sibling::node()[1]" /> <xsl:if test="key"> (<xsl:value-of select="key/following-sibling::node()[1]" />) </xsl:if> </span> <xsl:if test="key"> <span class="tracks"><xsl:value-of select="key/following-sibling::node()[1]" /> of <xsl:value-of select="key/following-sibling::node()[1]" /></span> </xsl:if> <xsl:variable name="tracklength" select="key/following-sibling::node()[1] div(1000)" /> <span class="time"><xsl:value-of select="round($tracklength div 60)" />:<xsl:value-of select="round($tracklength mod 60)" /></span> </div> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
As far as styling the output is concerned, you’ll have to worry about that yourself.