title: Group results based on value of child element
body: <p>HI i have folder full of images which are been read as xml file.
  I want to group them by child element which is date.</p>
  
  <p>Images format:</p>
  
  <pre><code>entry_212_CA60CTF_2014-10-30_12-14-57.jpg
  </code></pre>
  
  <p>XML doc:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;Incidents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Count="3" Date="2014-10-30" Time="12:14:57" FileName="2014-10-30_dones_Hillsborough_Leisure_Centre.xml"&gt;
    &lt;Incident&gt;
      &lt;EntryTime&gt;2014-08-16T08:54:12&lt;/EntryTime&gt;// want to group by this element
      &lt;ExitTime&gt;2014-08-16T17:03:51&lt;/ExitTime&gt;
   &lt;/Incident&gt;
  </code></pre>
  
  <p>PHP FILE:</p>
  
  <pre><code>    if(file_exists($xmlFullFilename)) {
              $xmlDoc = new DomDocument();
              $xmlDoc-&gt;load($xmlFullFilename);
              $tmp = $xmlDoc-&gt;getElementsByTagName("Incidents");
              $root = $tmp-&gt;item(0);
  }
  </code></pre>
  
  <p>I want to group all the EntryTime of same date into one xml file. the xml file should contain only 16th date.</p>
  
  <pre><code>eg:&lt;EntryTime&gt;2014-08-16T08:46:17&lt;/EntryTime&gt;...
  
            $tmp = split(" ", $entryTime);
                  $dateString = $tmp[0] . "T" . $tmp[1];
                  $entryTimeNode = $xmlDoc-&gt;createElement("EntryTime", $dateString);
  </code></pre>