[
Lists Home |
Date Index |
Thread Index
]
- To: xml-dev@lists.xml.org
- Subject: XSL Running total help
- From: Ryan Ness <ryan.ness@gmail.com>
- Date: Thu, 21 Oct 2004 13:42:48 -0700
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=BCT+Ofkky13vkWJuF1z8XzuANscdp7W6yA7xIb9hQGgpTvKG2nKy+Z7IL3srYOskdYLFUL3D8wefKmi/xJSQnNWDpc3tWPxGQAMIbtHoyd9Fldl3Q28Zp/aJrIMEPhHTXYIV7SfIKtRoPC4GBBQxowj3K808Mu3DawcRJEmtxUA=
- Reply-to: Ryan Ness <ryan.ness@gmail.com>
Here's my XML snip:
<snip>
<assetWeights name="A" weight=".033"/>
<assetWeights name="B" weight=".033"/>
<assetWeights name="c" weight=".033"/>
<assetWeights name="D" weight=".033"/>
<assetWeights name="E" weight=".033"/>
<assetWeights name="F" weight=".033"/>
<assetWeights name="G" weight=".033"/>
<assetWeights name="H" weight=".033"/>
<assetWeights name="I" weight=".033"/>
<assetWeights name="J" weight=".033"/>
<assetWeights name="K" weight=".033"/>
<assetWeights name="L" weight=".033"/>
<assetWeights name="M" weight=".033"/>
<assetWeights name="N" weight=".033"/>
<assetWeights name="O" weight=".033"/>
<assetWeights name="P" weight=".033"/>
<assetWeights name="Q" weight=".033"/>
<assetWeights name="R" weight=".033"/>
<assetWeights name="S" weight=".033"/>
<assetWeights name="T" weight=".033"/>
<assetWeights name="U" weight=".033"/>
<assetWeights name="V" weight=".033"/>
<assetWeights name="W" weight=".033"/>
<assetWeights name="X" weight=".033"/>
<assetWeights name="Y" weight=".033"/>
<assetWeights name="Z" weight=".033"/>
<assetWeights name="AA" weight=".033"/>
<assetWeights name="BB" weight=".033"/>
<assetWeights name="CC" weight=".033"/>
<assetWeights name="DD" weight=".034"/>
</snip>
What I need is to display the largest 8 weight values (in a text file)
and then instead of continuing to display the remaining assetWeights,
I want to add them up, and display the total...
Here's my <for-each> xsl block... Thanks in advance...
<xsl:for-each select="statementData/assetWeights">
<xsl:sort select="@weight" data-type="number" order="descending"/>
<xsl:value-of select="position()"/><xsl:text>- </xsl:text>
<xsl:if test="position() < 9">
<xsl:text>DET2</xsl:text>
<xsl:call-template name="rightpad">
<xsl:with-param name="fieldvalue"
select="string(../../recipient/groupAccount/@gaId)"/><xsl:with-param
name="fieldsize" select="number(10)"/>
</xsl:call-template>
<xsl:call-template name="rightpad">
<xsl:with-param name="fieldvalue"
select="string(../../recipient/indId/text())"/><xsl:with-param
name="fieldsize" select="number(10)"/>
</xsl:call-template>
<xsl:call-template name="rightpad">
<xsl:with-param name="fieldvalue"
select="string(@name)"/><xsl:with-param name="fieldsize"
select="number(50)"/>
</xsl:call-template>
<xsl:call-template name="rightpad">
<xsl:with-param name="fieldvalue"
select="string(@weight)"/><xsl:with-param name="fieldsize"
select="number(5)"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="position() > 8">
<xsl:text>Add this one up</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:for-each>
|