Category Archives: General

XSL for iTunes XML Export

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.

Technorati Tags: , , ,

Google’s “Personlised Home”

Google have just released their “Personalised Home” for those of us with a Google account. (Gmail, for example)

It allows you to subscribe to feeds right there on the search engine home page, as well as numerous other bits of RSS goodness. I like it.

(You may be able to see it at Google.com, if you have an account…)

Spam just gets better and better!

This just arrived in my work inbox. It is great on so many levels…

Dear Home Owner,
After satisfying the analysis we are jubilant to provide for you this endorsement,

Your current mortgage qualifies you for more than a 3.4 lesser rate!

——————————————————————
!! ATTAINING THE LOWEST RATES IN THE US HAS NEVER BEEN EASIER !!
——————————————————————

Hundreds of thousands of residential owners have re-financed this month alone!

So why not you?

Go HERE to make that change.

If you prefer to be left out of this superfluous offer go here.

I am overjoyed to be the cause of this company’s jubliation, but I’m afraid that – even though this offer is indeed superfluous – I will probably not be clicking on that link.

Thin Sliced Bread

A good friend of mine asked me an interesting question last weekend. “What happened to thin sliced bread?” It got me wondering, so today I got off my backside and went to do a (very small) bit of research. I fired off an email to Warburtons’ customer services.

Can you tell me what has happened to the “thin sliced” loaf that was readily available in my youth, but is mysteriously lacking in modern life? It isn’t exactly keeping me awake at nights, but I miss that option.

Incredibly, they replied.

Thank you for your email.

We did produce a thin sliced loaf until about six or seven years ago. Around this time demand for the thin loaf fell and we delisted it. The thinnest sliced loaf we produce now is the Milk Roll.

I hope this answers your query.

Kind regards

Barbara Kelly
Customer Care Officer

Well, it does answer the question, and it doesn’t. Surely the word “medium” in “medium sliced loaf” implies there is something thinner? Perhaps they should re-align their product set accordingly?

Problems re-installing VS.NET 2003

I tried the latest beta of VS.NET 2005 a few weeks ago, didn’t enjoy it so I uninstalled it. Anyway, that’s by the by. My problem was when I was tried to put 2003 back on, I was getting the vague message “Please go to the control panel to install and configure system components”. Thanks. Any more hints?

It turns out, after much Googling the answer to the problem was to delete a registry key that seemingly has nothing to do with VS at all : HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/App Paths/setup.exe

Renamed that whole section to setupNOMORE.exe and the installer was happy. I daresay there may be other issues that arise from this change in future, so I’ll put it back when the install is done.

PHP Galleries for Picasa

I have just completed an initial draft of a PHP-based photo gallery system. Take a look. The readme is available separately here

The system is built on templates designed by Douglas Bowman

Download the slim version (just an msi package for the Picasa template) of my offering here, or the full version here and feel free to leave me feedback. I know there is still a lot to do, but I’d like to hear what others think before I fix / break things.