I'm starting to learn asp.net and c# at work and I've been given a project to create and fix web pages in asp.net.

I am having trouble with one of the functions to display the data from xml to web page.

The intention of the code is to get the latest record(date and no time) at the top and the rest of records with same common name for same node will go below.

The problem is that at the moment if there are more than two nodes with same values and same dates it will split and treat like to different items and it will create two groups with two different top items.

Code:

```
var xd = XDocument.Parse(element.OuterXml);

if (xd != null)
{
    var results =
       (from el1 in xd.Descendants("Microbiology")
        from el2 in el1.Descendants("Test")
        orderby el2.Element("Date").Value descending
        //orderby el2.Element("Rubric").Value
        // I tried using distinct here but does not work.
        where el2.Element("Date").Value ==
              (el1.Descendants("Test").Where(
                  e => e.Element("ReadCode").Value ==
                      el2.Element("ReadCode").Value).First().Element("Date").Value) 
        select new Microbiology
        {
            Date = el2.Element("Date") != null ? el2.Element("Date").Value : "",
            ReadCode = el2.Element("ReadCode") != null
                           ? el2.Element("ReadCode").Value
                           : "",
            Rubric = el2.Element("Rubric") != null
                           ? el2.Element("Rubric").Value
                           : "",
            SubMicro = (from subMicroEl1 in xd.Descendants("Microbiology")
                        from subMicroEl2 in subMicroEl1.Descendants("Test")
                        orderby subMicroEl2.Element("Date").Value descending
                        orderby subMicroEl2.Element("Rubric").Value
                        where subMicroEl2.Element("Rubric").Value ==
                              el2.Element("Rubric").Value &&
                              subMicroEl2.Element("Date").Value !=
                              el2.Element("Date").Value
                        select new Microbiology
                        {
                            Date = subMicroEl2.Element("Date") != null
                                       ? subMicroEl2.Element("Date").Value
                                       : "",
                            ReadCode = subMicroEl2.Element("ReadCode") != null
                                       ? subMicroEl2.Element("ReadCode").Value
                                       : "",
                            Rubric = subMicroEl2.Element("Rubric") != null
                                       ? subMicroEl2.Element("Rubric").Value
                                       : "",
                        }).ToList<Microbiology>()
        });

```

XML:

```
<Microbiology>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value>123</Value>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
  <Value>123123</Value>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-10-23</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-30</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-30</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-30</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-30</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-07-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-05-12</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-05-12</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-05-12</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-05-12</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-03-07</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-03-07</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-03-07</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-03-07</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2008-01-15</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-11-07</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-11-07</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-11-07</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-11-07</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-10-08</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-08-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-08-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-06-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-06-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-06-13</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-06-13</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-05-04</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-05-04</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-05-04</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-05-04</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-01-26</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2007-01-26</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-09-29</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-09-29</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-31</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-31</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-31</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-31</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-16</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-16</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-16</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-08-16</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-06-02</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-06-02</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-06-02</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-06-02</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-05-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-05-09</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-05-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-05-09</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-01-17</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2006-01-17</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-11-22</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-11-22</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-10-18</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-10-18</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-10-18</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-10-18</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4JRA.</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus screening test</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-09-13</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-07-19</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-07-19</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-07-19</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-07-19</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-03-15</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-03-15</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-03-15</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-03-15</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J17.</ReadCode>
        <Rubric>Sample culture</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2004-04-05</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2003-10-06</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2003-10-06</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2003-01-20</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2003-01-20</Date>
        <ReadCode>4J15.</ReadCode>
        <Rubric>Sample: organism sensitivity</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2002-06-17</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2002-06-17</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>1998-04-02</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2002-04-02</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2002-01-09</Date>
        <ReadCode>4JG6.</ReadCode>
        <Rubric>Skin swab culture positive</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-01-08</Date>
        <ReadCode>4JG6.</ReadCode>
        <Rubric>Skin swab culture positive</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2005-12-05</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-12-03</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-12-03</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-12-03</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-10-01</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-10-01</Date>
        <ReadCode>4I16.</ReadCode>
        <Rubric>Microscopy, culture and sensitivities</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-07-06</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-06-12</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-06-12</Date>
        <ReadCode>4JG5.</ReadCode>
        <Rubric>Skin swab culture negative</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2001-05-22</Date>
        <ReadCode>4JG6.</ReadCode>
        <Rubric>Skin swab culture positive</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2000-11-10</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2000-09-19</Date>
        <ReadCode>4JG3.</ReadCode>
        <Rubric>Skin ulcer swab taken</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2000-06-07</Date>
        <ReadCode>4JP..</ReadCode>
        <Rubric>Methicillin resistant staphylococcus aureus positive</Rubric>
        <Value/>
        <Units/>
    </Test>
    <Test>
        <Date>2000-01-31</Date>
        <ReadCode>4JG6.</ReadCode>
        <Rubric>Skin swab culture positive</Rubric>
        <Value/>
        <Units/>
    </Test>
</Microbiology>

```

I kind of understand what the code does, but I dont know how to modify it.

**Update**
What I need is to group them by Rubric or ReadCode and order them by date, even if dates are repeated I would just need one group and all elements inside with one with latest date situated at the top.

Any help would be appreciated.

Let me know if you need more info, I will keep checking the question.

Thanks in advance.