title: XSLT 1.0 Group By
body: <p>I have the following XML data:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;results&gt;
      &lt;result&gt;
          &lt;MemberFirstName&gt;JOHN&lt;/MemberFirstName&gt;
          &lt;MemberLastName&gt;DOE&lt;/MemberLastName&gt;
          &lt;MemberLogin&gt;1&lt;/MemberLogin&gt;
          &lt;Store&gt;0180&lt;/Store&gt;
      &lt;/result&gt;
      &lt;result&gt;
          &lt;MemberFirstName&gt;JANE&lt;/MemberFirstName&gt;
          &lt;MemberLastName&gt;DOE&lt;/MemberLastName&gt;
          &lt;MemberLogin&gt;2&lt;/MemberLogin&gt;
          &lt;Store&gt;0180&lt;/Store&gt;
      &lt;/result&gt;
      &lt;result&gt;
          &lt;MemberFirstName&gt;ALAN&lt;/MemberFirstName&gt;
          &lt;MemberLastName&gt;SMITH&lt;/MemberLastName&gt;
          &lt;MemberLogin&gt;3&lt;/MemberLogin&gt;
          &lt;Store&gt;0181&lt;/Store&gt;
      &lt;/result&gt;
      &lt;result&gt;
          &lt;MemberFirstName&gt;DAVID&lt;/MemberFirstName&gt;
          &lt;MemberLastName&gt;GREEN&lt;/MemberLastName&gt;
          &lt;MemberLogin&gt;4&lt;/MemberLogin&gt;
          &lt;Store&gt;0183&lt;/Store&gt;
      &lt;/result&gt;
  &lt;/results&gt;
  </code></pre>
  
  <p>In XSLT 1.0, I want to group by  and create a table for employees in each store.  so in the above data, 3 tables would be created. A table with two rows for the first 2 records (store 180), etc..</p>
  
  <p>How can I do this in XSLT 1.0?</p>
  
  <pre><code>&lt;table id="table"&gt;
    &lt;tr class="heading"&gt;
      &lt;th scope="col"&gt;Member Id&lt;/th&gt;
      &lt;th scope="col"&gt;First Name&lt;/th&gt;
      &lt;th scope="col"&gt;Last Name&lt;/th&gt;
    &lt;/tr&gt;
    &lt;xsl:for-each select="results/result"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;xsl:value-of select="MemberLogin"/&gt;&lt;/td&gt;
        &lt;td&gt;&lt;xsl:value-of select="MemberFirstName"/&gt;&lt;/td&gt;
        &lt;td&gt;&lt;xsl:value-of select="MemberLastName"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/xsl:for-each&gt;
  &lt;/table&gt;
  </code></pre>