0

I wanna select entry record about each unique user with the large date from xml. How i can do it?

Example XML:

<ReconciliationList>
  <ReconciliationListRow>
     <Employee>John Smith</Employee>
     <Date>2000-01-24</Date>
  </ReconciliationListRow>
  <ReconciliationListRow>
     <Employee>Marilyn Manson</Employee>
     <Date>2001-12-15</Date>
  </ReconciliationListRow>
  <ReconciliationListRow>
      <Employee>John Smith</Employee>
      <Date>2002-09-24</Date>
  </ReconciliationListRow>
  <ReconciliationListRow>
      <Employee>John Smith</Employee>
      <Date>1998-07-02</Date>
  </ReconciliationListRow>
  <ReconciliationListRow>
      <Employee>Liam Peters</Employee>
      <Date>1979-10-22</Date>
  </ReconciliationListRow>
</ReconciliationList>

I tried to get something like this:

ReconciliationList:
2002-09-24   John Smith
2001-12-15   Marilyn Manson
1979-10-22   Liam Peters

I want to use this here to reduce the amount of output

  <xsl:template name="print">
    <xsl:for-each    select="//ReconciliationList/ReconciliationListRow">
      <xsl:sort select="@DateStart" order="ascending"/>
      <tr>
        <xsl:call-template name="printresult">
          <xsl:with-param name="recrow" select="current()"/>
        </xsl:call-template>
      </tr>
    </xsl:for-each>
  </xsl:template>
  • This is basically a [grouping](https://stackoverflow.com/tags/xslt-grouping/info) question. The exact answer depends on which version of XSLT your processor supports. – michael.hor257k Jan 26 '23 at 12:04
  • The version supported by your processor may not be the version declared in your stylesheet - see: https://stackoverflow.com/a/25245033/3016153. But if you are limited to XSLT 1.0 then use the Muenchian grouping method: http://www.jenitennison.com/xslt/grouping/muenchian.html – michael.hor257k Jan 26 '23 at 12:11

0 Answers0