<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='xml' indent='yes'/>

<xsl:template match='/'>
	<playlist version="1" xmlns="http://xspf.org/ns/0/">
		<title>Blaise Demo Tracks</title>
		<creator>Blaise Alleyne</creator>
		<info>http://blaise.ca/music</info>
		<trackList>
			<xsl:for-each select='//song'>
        <xsl:if test='branch/recording'>
				<track>
					<location>http://audio.blaise.ca/songs/<xsl:value-of select="@id"/>/<xsl:if test="branch/@id"><xsl:value-of select="branch/@id"/>/</xsl:if><xsl:value-of select="@id"/>-<xsl:value-of select="branch/recording/@version"/><xsl:if test="branch/@id">-<xsl:value-of select="branch/@id"/></xsl:if>.mp3</location>
					<creator><xsl:for-each select='artist'><xsl:value-of select='.'/></xsl:for-each></creator>
					<annotation><xsl:value-of select='@title'/></annotation>
					<title><xsl:value-of select='@title'/> (<xsl:value-of select='branch/recording/@version'/><xsl:if test="branch/@id">-<xsl:value-of select='branch/@id'/></xsl:if>)</title>
<!--					<album> TODO: review <xsl:value-of select='@title'/></album>-->
					<info>/music/songs/<xsl:value-of select='@id'/></info>
					<xsl:if test='image'>
						<image>
            <xsl:choose>
              <xsl:when test='image[1]/@square'><xsl:value-of select='image[1]/@square'/></xsl:when>
              <xsl:otherwise><xsl:value-of select='image[1]/@src'/></xsl:otherwise>
            </xsl:choose>
            </image>
					</xsl:if>
				</track>
        </xsl:if>
			</xsl:for-each>
		</trackList>
	</playlist>
</xsl:template>

</xsl:stylesheet>

