<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="/groceryList">
    <html>
    <head>
    <title>Shopping list for <xsl:value-of select="@shoppingDate"/></title>
    </head>
      <body bgcolor="white">
        <p>
         Date: <xsl:value-of select="attribute::shoppingDate"/>
        </p>
        <!-- insert the contents of the letter here -->
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

  <!-- done with main document -->
  <!-- from here on, we're defining templates for individual elements -->

  <xsl:template match="item">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>

  <xsl:template match="itemName">
      <br/><xsl:value-of select="."/>
  </xsl:template>

  <xsl:template match="itemQuantity">
      <br/><xsl:value-of select="."/>
  </xsl:template>

  <xsl:template match="section">
      <br/><xsl:value-of select="."/>
  </xsl:template>
</xsl:stylesheet>

