|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] sum based on grouping by date and node
The follwing xml and xsl sum the StepCharge_TTBlack value by TradeID and Customer.
How is it possible to display the sums while using the same date groupings but also based on grouping by the Customer node instead of TradeID?
Thanks,
Dmitri
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:variable name="global">
<xsl:value-of select="Portfilio/AsOf"/>
</xsl:variable>
<xsl:template match="/">
<html>
<head>
<title>Portfilio</title>
</head>
<body>
<table border="0" width="100%" cellpadding="10">
<tr><b>Credit Risk</b></tr>
<tr><b>Customer Buckets Report</b></tr>
<tr><b>As Of: </b><xsl:value-of select="$global"
/></tr>
</table>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="Portfilio">
<html>
<style>
td { width: 120px; font-family:verdana; font-size:10px; }
.r0 {background-color: #f0f0f0}
.r1 {background-color: white}
</style>
<body>
<table border=".5">
<tr>
<!--<td ><b>Trade Id</b></td>-->
<td align="center"><b>Customer</b></td>
<td align="center"><b>0</b></td>
<td align="center"><b>3</b></td>
<td align="center"><b>TradeId Totals</b></td>
</tr>
<xsl:for-each select="Trade">
<tr class="r{position() mod 2}">
<td>
<xsl:value-of select="TradeId"/><xsl:text/></td>
<!--<td align="right">
<xsl:value-of select="Portfilio/Trade/Customer"/>
</td>-->
<td align="right">
<xsl:value-of select="format-number(sum(Portfilio/Trade/Step
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7),substring($global,1,2),substring($global,4,2))]
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]
/StepCharge_TTBlack), '###,###,##0')"/>
</td>
<td align="right">
<xsl:value-of select="format-number(sum(Portfilio/Trade/Step
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+6,substring($global,1,2),substring($global,4,2))]
/StepCharge_TTBlack), '###,###,##0')"/>
</td>
</tr>
</xsl:for-each>
<tr>
<td><b>Yearly Totals</b>
</td>
<!--<td> </td>-->
<td align="right"><b>
<xsl:text/>
<xsl:value-of select="format-number(sum(Trade/Step
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7),substring($global,1,2),substring($global,4,2))]
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]
/StepCharge_TTBlack), '###,###,##0')"/>
</b></td>
<td align="right"><b>
<xsl:value-of select="format-number(sum(Trade/Step
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+6,substring($global,1,2),substring($global,4,2))]
/StepCharge_TTBlack), '###,###,##0')"/>
</b></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<Portfilio>
<AsOf>11/01/2004</AsOf>
<Trade>
<TradeId>ED.TEST</TradeId>
<Customer>ABC</Customer>
<Step>
<MinFlowDate>11/30/2004</MinFlowDate>
<StepCharge_TTBlack></StepCharge_TTBlack>
</Step>
<Step>
<MinFlowDate>11/30/2005</MinFlowDate>
<StepCharge_TTBlack>6</StepCharge_TTBlack>
</Step>
</Trade>
<Trade>
<TradeId>ED.TESTFX1</TradeId>
<Customer>AAA</Customer>
<Step>
<MinFlowDate>12/11/2004</MinFlowDate>
<StepCharge_TTBlack>3</StepCharge_TTBlack>
</Step>
<Step>
<MinFlowDate>12/11/2004</MinFlowDate>
<StepCharge_TTBlack>61</StepCharge_TTBlack>
</Step>
<Step>
<MinFlowDate>12/11/2005</MinFlowDate>
<StepCharge_TTBlack>11</StepCharge_TTBlack>
</Step>
</Trade>
<Trade>
<TradeId>ED.TESTFX1</TradeId>
<Customer>AAA</Customer>
<Step>
<MinFlowDate>12/11/2004</MinFlowDate>
<StepCharge_TTBlack>3</StepCharge_TTBlack>
</Step>
<Step>
<MinFlowDate>12/11/2004</MinFlowDate>
<StepCharge_TTBlack>61</StepCharge_TTBlack>
</Step>
<Step>
<MinFlowDate>12/11/2005</MinFlowDate>
<StepCharge_TTBlack>11</StepCharge_TTBlack>
</Step>
</Trade>
</Portfilio>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








