# Re: summing set of records

 Subject: Re: summing set of records From: "anil an.kumar" Date: Thu, 18 Feb 2010 17:11:02 +0530
Hi,

```Thanks in Advance
Anil```

On 2/17/2010 5:24 PM, anil an.kumar wrote:
Hi Team,

i want the out put like below...

<mezo eazon="OB0001X1CA">200</mezo>
<mezo eazon="OB0001X2CA">150</mezo>
<mezo eazon="OB0001X3CA">350</mezo> -> This line has to print for every two set of records ex: sum of OB0001X1CA (200) + OB0001X2CA(150)
<mezo eazon="OB0002X1CA">300</mezo>
<mezo eazon="OB0002X2CA">50</mezo>
<mezo eazon="OB0002X3CA">350</mezo> -> again 3CA should appear here, sum of 300 + 50

The tag "OB001X1CA" should frame in such a way that,
POINT1 : The number appearing before 'CA' should reset after every two records
POINT2 : The number appearing before 'X' should be same and need to increment by 1 for every two records.
like 001,001 then 002,002 then 003....

with my current logic iam getting required out put

```<mezo eazon="OB0001X1CA">200</mezo>
<mezo eazon="OB0001X2CA">150</mezo>
<mezo eazon="OB0002X1CA">300</mezo>
<mezo eazon="OB0002X2CA">50</mezo>```

BUT , now i want to show the sum of every two records,

here is my logic,

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:key name="group" match="G_REP_TRX_DETAIL_INFO" use="concat(C_BILLING_TP_TAX_REG_NUM,C_TAX_REPORTING_NAME)"/>

<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates select=".//LIST_G_REP_TRX_DETAIL_INFO"/>
</xsl:template>
<xsl:template name="Temp1" match="LIST_G_REP_TRX_DETAIL_INFO">
<xsl:for-each select="G_REP_TRX_DETAIL_INFO[C_TAX_REPORTING_NAME = '01'][generate-id()=generate-id(key('group',concat(C_BILLING_TP_TAX_REG_NUM,C_TAX_REPORTING_NAME))[1])]"><xsl:sort select="C_TAX_REPORTING_NAME"/>
<mezo eazon="OB{format-number((position()+1) idiv 2,'0000')}X{(((position()+1) mod 2) + 1)}BA"><xsl:value-of select="C_BILLING_TP_TAX_REG_NUM"/>
</mezo><xsl:text>&#xD;</xsl:text>
<mezo eazon="OB{format-number((position()+1) idiv 2,'0000')}X{(((position()+1) mod 2) + 1)}CA"><xsl:value-of select="sum(key('group', concat(C_BILLING_TP_TAX_REG_NUM,C_TAX_REPORTING_NAME))/C_FUNCTIONAL_TOTAL)" /></mezo><xsl:text>&#xD;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

My xml is ,

```<ZXXEUSL>
<LIST_G_REP_PARAMETER_INFO>
<G_REP_PARAMETER_INFO>
<CP_ESL_ROUND_RULE_CODE>NO</CP_ESL_ROUND_RULE_CODE>
</G_REP_PARAMETER_INFO>
</LIST_G_REP_PARAMETER_INFO>
<LIST_G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>abc</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>def</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>50</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>xyz</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>abc</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>def</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>xyz</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>abc</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>02</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>bbb</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>02</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>xyz</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>50</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>xyz</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>50</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>xyz</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>02</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>100</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
<G_REP_TRX_DETAIL_INFO>
<C_BILLING_TP_TAX_REG_NUM>ddd</C_BILLING_TP_TAX_REG_NUM>
<C_TAX_REPORTING_NAME>01</C_TAX_REPORTING_NAME>
<C_FUNCTIONAL_TOTAL>50</C_FUNCTIONAL_TOTAL>
</G_REP_TRX_DETAIL_INFO>
</LIST_G_REP_TRX_DETAIL_INFO>
<CS_CURRENCY_CODE>GBP</CS_CURRENCY_CODE>
</ZXXEUSL>```

```Thanks in Advance
Anil
```

### PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!