<?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="html" encoding="iso-8859-1"/>

  <xsl:template match="booklist">
    <!-- output is embedded in the body myBooks.html 
    <html>
      <head>
        <title><xsl:value-of select="title"/></title>
      </head>
      <body>
    -->
        <h1 class="title"><xsl:value-of select="title"/></h1>
        <table border="1" cellpadding="3" cellspacing="1">
          <tr><th>Title</th><th>Author</th><th>Publisher</th><th>Date</th><th>ISBN</th><th>Buy</th></tr>
          <xsl:apply-templates select="book"/>
        </table>
    <!--
      </body>
    </html>
    -->
  </xsl:template>

  <xsl:template match="book">
    <tr>
      <td><!-- Title -->
        <xsl:value-of select="title"/>
        <xsl:if test="edition"><!-- Edition, if any -->
          , <xsl:value-of select="edition"/>
        </xsl:if>
      </td>
      <td><!-- Author, if any -->
        <xsl:choose>
          <xsl:when test="author">
            <xsl:value-of select="author"/>
          </xsl:when>
          <xsl:otherwise>
            -
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td><!-- Publisher -->
        <xsl:value-of select="publisher"/>
      </td>
      <td><!-- Date -->
        <xsl:value-of select="date"/>
      </td>
      <td><!-- ISBN -->
        <xsl:value-of select="ISBN"/>
      </td>
      <td><!-- Buy -->
        <xsl:apply-templates select="buy"/>
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="buy">
    <a href="{@url}">
      <xsl:value-of select="."/>
    </a>
  </xsl:template>

</xsl:stylesheet>

