<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

     <xsl:template match="Row" mode="group">
       <xsl:variable name="this" select="substring-after(Assigned_x0020_To,'#')" />
       <xsl:if test="not(preceding-sibling::Row/Assigned_x0020_To[substring-after(.,'#')=$this])">
         <xsl:call-template name="group">
           <xsl:with-param name="group" select="$this" />
         </xsl:call-template>
       </xsl:if>
     </xsl:template>

     <xsl:template name="group">
      <xsl:param name="group" />
      <tr>
      <td>
       <xsl:value-of select="$group" />
      </td>
      <td>
       <xsl:value-of select="sum(/Rows/Row/Percent_x0020_Bandwidth[../Assigned_x0020_To[substring-after(.,'#')=$group)" />
      </td>
      </tr>
     </xsl:template>



<xsl:template match="/">
<html>
<head>
<title>Resource Allocator</title>
</head>
<body>
   <table border="0">
     <tr>
       <th><font color="#CA226B">Name</font><hr /></th>
       <th><font color="#CA226B">% Allocated</font><hr /></th>
       <th><font color="#CA226B">Free Date</font><hr /></th>
       <th><font color="#CA226B">Avg. Priority</font><hr /></th>
     </tr>
     <xsl:for-each select="/Rows/Row">
     <tr>
       <xsl:choose>
          <xsl:when test="Percent_x0020_Bandwidth*100 &lt; 90">
            <td bgcolor="#00FF00">
            <xsl:value-of select="substring-after(Assigned_x0020_To,'#')"/></td>
          </xsl:when>
          <xsl:when test="Percent_x0020_Bandwidth*100 &gt;= 90">
            <td bgcolor="#FF0000">
            <xsl:value-of select="substring-after(Assigned_x0020_To,'#')"/></td>
          </xsl:when>
          <xsl:otherwise>
            <td><xsl:value-of select="substring-after(Assigned_x0020_To,'#')"/></td>
          </xsl:otherwise>
        </xsl:choose>
       <td><center><xsl:value-of select="Percent_x0020_Bandwidth*100" /></center></td>
       <td><center><xsl:value-of select="substring-before(Due_x0020_Date,' ')" /></center></td>
       <td><center><xsl:value-of select="substring(Priority, 2,1)" /></center></td>
     </tr>
     </xsl:for-each>
   </table>
 </body>
 </html>
</xsl:template></xsl:stylesheet>