<?xml version="1.0" encoding="Shift_JIS"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:decimal-format />

<xsl:template match="/books">
  <html><head>
  <title>Books <xsl:value-of select="@year" /></title>
  </head><body>
  <table width="100%" border="2" align="center">
    <tr bgcolor="#cccc00" align="center">
      <th><b><xsl:text>Books </xsl:text><xsl:value-of select="@year" /></b></th>
    </tr>
  </table>
  <table border="2" align="center">
    <xsl:for-each select="book">
      <xsl:choose><xsl:when test="position() = 1"> 
        <tr bgcolor="#6699cc" align="center">
          <th><xsl:value-of select="date" /></th>
          <th><xsl:value-of select="title" /></th>
          <th><xsl:value-of select="subtitle" /></th>
          <th><xsl:value-of select="author" /></th>
          <th><xsl:value-of select="translate" /></th>
          <th><xsl:value-of select="publisher" /></th>
          <th><xsl:value-of select="issue" /></th>
          <th><xsl:value-of select="isbn" /></th>
          <th><xsl:value-of select="purchase" /></th>
        </tr>           
      </xsl:when><xsl:otherwise>
        <tr bgcolor="#ffffff" align="left">
          <td><xsl:value-of select="date" /></td>
          <td><xsl:value-of select="title" /></td>
          <td><xsl:value-of select="subtitle" /></td>
          <td><xsl:value-of select="author" /></td>
          <td><xsl:value-of select="translate" /></td>
          <td><xsl:value-of select="publisher" /></td>
          <td><xsl:value-of select="issue" /></td>
          <td><xsl:value-of select="substring(isbn, 5)" /></td>
          <td><xsl:value-of select="format-number(purchase, '###,###,##0')" /></td>
        </tr>           
      </xsl:otherwise></xsl:choose>
    </xsl:for-each>
  </table>
  </body></html>
</xsl:template>

</xsl:stylesheet>