<?xml version="1.0"?>

<!-- 
	file: playlists.xsl
	author: davidfmiller http://www.fivevoltlogic.com
	about: an xslt stylesheet used to transform a playlists.xml
	       document into something that is friendlier to a web browser
	       note: the resulting html document makes use of resources
	       (javascript, css, images) that are not included in this
	        download.
	version: 1.0
	history: v1.0 april 18, 2005
	          - initial release
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="html"/>
  <xsl:template match="*"/>

  <xsl:template match="mytunes">
    <html>
      <head>
        <title>
           <xsl:value-of select="@id"/>'s tunes 
        </title>
        <link rel="stylesheet" type="text/css" href="../css-bin/playlists.css"/>
        <xsl:element name="script">
          <xsl:attribute name="type">text/javascript</xsl:attribute>
          <xsl:attribute name="src">../js-bin/dom.js</xsl:attribute>
        </xsl:element>
      </head>
      <body class="playlists">
        <h1><xsl:value-of select="@id"/>'s tunes</h1>
        <p class="info">
          <xsl:text>generated by </xsl:text>
          <a href="http://www.fivevoltlogic.com/code/mytunes/" title="mytunes" class="">com.fivevoltlogic.mytunes.sync.Export</a>
          v<xsl:value-of select="@version"/> on <xsl:value-of select="@date"/>
        </p>
        <ul class="playlists">
          <xsl:apply-templates/>
        </ul>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="playlist">
    <li>
    <dl class="playlist">
      <xsl:element name="dt">
        <xsl:if test="@smart = 'true'">
          <xsl:attribute name="class">smart</xsl:attribute>
        </xsl:if>
        <xsl:element name="a">
          <xsl:attribute name="href">#</xsl:attribute>
          <xsl:attribute name="title">show/hide "<xsl:value-of select="@name" />"</xsl:attribute>
          <xsl:attribute name="onclick">hideAndSeek(getNextElement(getParentNamed(this, 'dt'), 'dd'));</xsl:attribute>
          <xsl:value-of select="@name" />
       </xsl:element>
      </xsl:element>
      <dd style="display: none;">
        <ol class="tracks"><xsl:apply-templates /></ol>
      </dd>
    </dl>
    </li>
  </xsl:template>

  <xsl:template match="track">
    <li class="track">
      <xsl:value-of select="@artist" /> - 
        <!-- don't include the album name in the listing
              <xsl:value-of select="@album" /> - 
        -->
      <xsl:value-of select="@name" />
    </li>
  </xsl:template>
</xsl:stylesheet>
