Hi, I don't really know which title to give to my question....
I have this sample XML:
<lineItems>
<code>135</code>
<description>ABC COMMUNICATION SERVICES</description>
<taxAmount>3.500</taxAmount>
</lineItems>
<lineItems>
<code>253</code>
<description>LOCAL COMMUNICATIONS SERVICES</description>
<taxAmount>2.800</taxAmount>
</lineItems>
<lineItems>
<code>135</code>
<description>ABC COMMUNICATIONS SERVICES</description>
<taxAmount>12.500</taxAmount>
</lineItems>
<lineItems>
<code>253</code>
<description>LOCAL COMMUNICATIONS SERVICES</description>
<taxAmount>2.400</taxAmount>
</lineItems>
I need to group by code and add the amount together using this sample code but for for the code 135 choose the second description
<xsl:for-each select=".//taxLineItem/lineItems[generate-id(.)=generate-id(key('tax-by-address-description', concat(ancestor::accountInvoiceElements/accountId, code))[1])]">
<xsl:sort select="description" />
<fo:table-row>
<fo:table-cell >
<fo:block >
<xsl:value-of select="description" />
<fo:block >
</fo:table-cell >
<fo:table-cell >
<fo:block >
<xsl:value-of select="sum(key('tax-by-address-description', concat(ancestor::accountInvoiceElements/accountId, code))/taxAmount)" />
<fo:block >
</fo:table-cell >
</fo:table-row>
............................
..........................
I am getting this result:
ABC COMMUNICATION SERVICES ................. 16.00
LOCAL COMMUNICATIONS SERVICES .................. 5.20
But I want to have this:
ABC COMMUNICATIONS SERVICES ................. 16.00
LOCAL COMMUNICATIONS SERVICES .................. 5.20
I thought of using order = "descending" but it only applies the order on the whole list not selecting exactly the desired description under same code
Any idea?
Thanks