<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes" /> 

<!--  Change parameters here  -->
<xsl:variable name="d1">20010407</xsl:variable>
<xsl:variable name="d2">20010609</xsl:variable>
<xsl:variable name="str1">lamps</xsl:variable>
<xsl:variable name="str2">shelves</xsl:variable>
<!--                          -->
                        
<xsl:template match="/">
  <html>
  <body>

    <h4 align = "center" >      
      List just those parts of the Item descriptions of the purchase orders
      that contain the words "lamps" or "shelves" 
    </h4>                         

    <table cellpadding="1" border="1">
      <thead>
        <th>Tracking #                    </th>
        <th>Date                          </th>
        <th>Status                        </th>
        <th>Login Name                          </th>
        <th>Item                       </th>
      </thead>
      <xsl:apply-templates select= 
        "//PO/Id[substring-after(date,'//') &gt; $d1  and
                 substring-after(date,'//') &lt; $d2]" />
     </table>
  </body>
  </html>
</xsl:template>

<xsl:template match="Id">
  <xsl:for-each select = "ancestor::PO/Items/Item">
    <xsl:if test = "contains(./Description,$str1) or contains(./Description,$str2)">
    <tr>
      <td> <xsl:value-of select="ancestor::PO//trackNbr" /> </td>
      <td> <xsl:value-of select="ancestor::PO//date" /> </td>
      <td> <xsl:value-of select="ancestor::PO//status" /> </td>
      <td> <xsl:value-of select="ancestor::PO//login" /> </td>
      <td> <xsl:value-of select="./Description"/> <br />
                      </td>
    </tr> 
    </xsl:if> 
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
