title: How to find start(min) and end(max) date in xml file?
body: <p>I have an XML file. I should find for same field2 start(min) date and End(max) date from field3. Maybe xsl have some function to find it.Because I try do it trying to find min month and min day and max month, max day.
  XML:</p>
  
  <pre><code>&lt;document&gt;
      &lt;line id="0"&gt;
          &lt;field id="2"&gt;X111&lt;/field&gt;
          &lt;field id="3"&gt;2011-03-31&lt;/field&gt;
      &lt;/line&gt;
      &lt;line id="1"&gt;
          &lt;field id="2"&gt;X111&lt;/field&gt;
          &lt;field id="3"&gt;2011-04-04&lt;/field&gt;
      &lt;/line&gt;
      &lt;line id="2"&gt;
          &lt;field id="2"&gt;X111&lt;/field&gt;
          &lt;field id="3"&gt;2011-04-02&lt;/field&gt;
      &lt;/line&gt;
      &lt;line id="3"&gt;
          &lt;field id="2"&gt;X222&lt;/field&gt;
          &lt;field id="3"&gt;2011-04-04&lt;/field&gt;
      &lt;/line&gt;
      &lt;line id="4"&gt;
          &lt;field id="2"&gt;X222&lt;/field&gt;
          &lt;field id="3"&gt;2011-04-01&lt;/field&gt;
      &lt;/line&gt;
      &lt;line id="4"&gt;
          &lt;field id="2"&gt;X333&lt;/field&gt;
          &lt;field id="3"&gt;2011-04-01&lt;/field&gt;
      &lt;/line&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;document&gt;
  &lt;Message&gt;
      &lt;ID&gt;X111&lt;/ID&gt;
      &lt;dateStart&gt;2011-03-31&lt;/dateStart&gt;
      &lt;dateEnd&gt;2011-04-04&lt;/dateEnd&gt;
  &lt;/Message&gt;
  &lt;Message&gt;
      &lt;ID&gt;X222&lt;/ID&gt;
      &lt;dateStart&gt;2011-04-01&lt;/dateStart&gt;
      &lt;dateEnd&gt;2011-04-04&lt;/dateEnd&gt;
  &lt;/Message&gt;
  &lt;Message&gt;
      &lt;ID&gt;X333&lt;/ID&gt;
      &lt;dateStart&gt;2011-04-01&lt;/dateStart&gt;
      &lt;dateEnd&gt;2011-04-01&lt;/dateEnd&gt;
  &lt;/Message&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>Please help to solve it. I'm working with stylesheet version="1.0". </p>