title: Grouping a Child after Sorting XSLT
body: <p>I am trying to group some data that I've already sorted by adding another group after the "Events" parent.</p>
  
  <p>Here's my code where I already have the sorting function working, I am just wondering how to add another group under "Events" before it sorts. Any help is appreciated as I am very new to XSLT </p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/&gt;
    &lt;xsl:strip-space elements="*" /&gt;
    &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="Games"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates select="Game/Event[@type_id='1' and @team_id='8']"&gt;
                  &lt;xsl:sort select="event_id" order="ascending" data-type="number"  /&gt;
              &lt;/xsl:apply-templates&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>