<?xml version="1.0" encoding="UTF-8"?>

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

<!-- strip leading and trailing whitespace from all elements ... -->
<xsl:strip-space elements="*"/>

<xsl:param name="expandID">empty</xsl:param>

<xsl:output method="html" media-type="text/html"/>

<!-- ******************************************************* -->
<!-- ******************************************************* -->

<!-- root template: controls overall page layout -->

<xsl:template match="/">
       <tr>
	<td width="25%" valign="top"><!-- cell for TOC -->
	  <table border="0" cellspacing="4" cellpadding="0">
           <tr><td><h2>
            <a href="engDecIndex.php">The Decameron</a>
           </h2></td></tr>
           <xsl:apply-templates select="//head" mode="toc"/>
          </table>
        </td>
        <td align="left" valign="top"><!-- cell for main content -->
         <h1>The Decameron</h1>
         <p><strong>an XML-encoded English translation of the Italian text<br/>based on THE DECAMERON OF GIOVANNI BOCCACCIO<br/>faithfully translated by J.M. Rigg, London, 1921<br/>(first printed 1903)</strong></p>
        </td>
       </tr>
</xsl:template>



<xsl:template match="head" mode="toc">
  <xsl:variable name="parentID" select="parent::*/@id"/>
    <xsl:choose>
    <!-- take unwanted heads out of the picture -->
      <xsl:when test="not(parent::div1) and not(parent::prologue) and not(parent::epilogue)">
      </xsl:when>
      <!-- prologue, epilogue don't need expand values -->
      <xsl:when test="parent::prologue or parent::epilogue">
       <tr height="20">
        <td>
         <p class="toctitle">
          <a class="arrow" href="engDecShowText.php?myID={$parentID}&amp;expand=">
           <xsl:value-of select="."/>
          </a>
         </p>
        </td>
       </tr>
      </xsl:when>
      <xsl:otherwise>
       <tr height="20">
        <td>
         <p class="toctitle">
          <a class="arrow" href="engDecShowText.php?myID={$parentID}&amp;expand={$parentID}">
           <xsl:value-of select="."/>
          </a>
         </p>
        </td>
       </tr>
      </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>

