Hi Wlaver,
Comment: your XML is not well formated. The first tag is not well
closed!!!!!!!!!
i will solve your problem by sending the code and result:
good lock
XSL code:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<Total>
<Totalscenarios>
<xsl:value-of
select="sum(ScenarioSummary/Scenario/TotalScenarios)"/>
</Totalscenarios>
<Totalsuccess>
<xsl:value-of
select="sum(ScenarioSummary/Scenario/SuccessfulScenarios)"/>
</Totalsuccess>
<Totalfailed>
<xsl:value-of
select="sum(ScenarioSummary/Scenario/FailedScenarios)"/>
</Totalfailed>
<Totalerror>
<xsl:value-of
select="sum(ScenarioSummary/Scenario/ErrorScenarios)"/>
</Totalerror>
</Total>
</xsl:template>
<xsl:stylesheet>
Result Totals:
<?xml version='1.0' ?>
<Total>
<Totalscenarios>7</Totalscenarios>
<Totalsuccess>2</Totalsuccess>
<Totalfailed>1</Totalfailed>
<Totalerror>4</Totalerror>
</Total>
wl****@gmail.com wrote:
I would like to sum up several numbers using xsl.
I have tried <xsl:value-of select="count(//TotalScenarios)" /but that
only returns the number of times that the tag "TotalScenarios" appears,
and does not sum the actual value contained in the tag.
Here is my xml.
<ScenarioSummary>
<LastRunDate>Aug 29, 2006 3:56:44 PM</LastRunDate>
<Scenario>
<Area>FacilityCharges</Area>
<TotalScenarios>3</TotalScenarios>
<SuccessfulScenarios>2</SuccessfulScenarios>
<FailedScenarios>1</FailedScenarios>
<ErrorScenarios>0</ErrorScenarios>
</Scenario>
<Scenario>
<Area>GasSales</Area>
<TotalScenarios>4</TotalScenarios>
<SuccessfulScenarios>0</SuccessfulScenarios>
<FailedScenarios>0</FailedScenarios>
<ErrorScenarios>4</ErrorScenarios>
</Scenario>
<ScenarioSummary>
I would like to be able to sum up the totalScenarios,
SuccessfulScenarios, etc, and expect the results below.
Total scenarios should be: 7
Total success: 2
Total failed: 1
Total error: 4
wl****@gmail.com wrote:
I would like to sum up several numbers using xsl.
I have tried <xsl:value-of select="count(//TotalScenarios)" /but that
only returns the number of times that the tag "TotalScenarios" appears,
and does not sum the actual value contained in the tag.
Here is my xml.
<ScenarioSummary>
<LastRunDate>Aug 29, 2006 3:56:44 PM</LastRunDate>
<Scenario>
<Area>FacilityCharges</Area>
<TotalScenarios>3</TotalScenarios>
<SuccessfulScenarios>2</SuccessfulScenarios>
<FailedScenarios>1</FailedScenarios>
<ErrorScenarios>0</ErrorScenarios>
</Scenario>
<Scenario>
<Area>GasSales</Area>
<TotalScenarios>4</TotalScenarios>
<SuccessfulScenarios>0</SuccessfulScenarios>
<FailedScenarios>0</FailedScenarios>
<ErrorScenarios>4</ErrorScenarios>
</Scenario>
<ScenarioSummary>
I would like to be able to sum up the totalScenarios,
SuccessfulScenarios, etc, and expect the results below.
Total scenarios should be: 7
Total success: 2
Total failed: 1
Total error: 4