[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL Running total help

  • To: xml-dev@l...
  • Subject: XSL Running total help
  • From: Ryan Ness <ryan.ness@g...>
  • 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@g...>

xsl total
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() &lt; 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() &gt; 8">
            <xsl:text>Add this one up</xsl:text>
          </xsl:if>

          <xsl:text>&#10;</xsl:text>
        </xsl:for-each>

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.