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

    <xsl:output method="html" />
    <xsl:strip-space elements="*" />

    <xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Daily Planner</title>
<style type="text/css">
  .day, th { background-color: #FF8; }
  table, td, th { border: solid #000 1px; padding: 3px; }
</style>
</head><body>
<table border="0" cellpadding="0" cellspacing="0"><caption>Daily Planner</caption>
<tr><th>&#160;</th><th>AM</th><th>PM</th></tr>
        <xsl:apply-templates/>
</table>
</body>
</html>
    </xsl:template>

    <xsl:template match="sunday|monday|tuesday|wednesday|thursday|friday|saturday">
        <tr>
            <td class="day">
                <xsl:variable name="day" select="local-name()"/>
                <xsl:choose>
                    <xsl:when test="$day='sunday'">Sunday</xsl:when>
                    <xsl:when test="$day='monday'">Monday</xsl:when>
                    <xsl:when test="$day='tuesday'">Tuesday</xsl:when>
                    <xsl:when test="$day='wednesday'">Wednesday</xsl:when>
                    <xsl:when test="$day='thursday'">Thursday</xsl:when>
                    <xsl:when test="$day='friday'">Friday</xsl:when>
                    <xsl:otherwise>Saturday</xsl:otherwise>
                </xsl:choose>
            </td>
            <xsl:apply-templates/>
        </tr>
    </xsl:template>

    <xsl:template match="am|pm">
        <td><xsl:value-of select="."/></td>
    </xsl:template>

</xsl:stylesheet>
