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

sum of price * qty, without node-set()

Subject: sum of price * qty, without node-set()
From: Charles Gebhard <cgebhard@xxxxxxxxxxxxxxxx>
Date: Wed, 28 Jan 2004 19:22:38 -0800
charles gebhard
greetings all,
i'm a newbie and am trying to get a sum of a calculation; i'm hoping to get the value "162.00".


<BATCH>
  <RECEIPT>
    <qtyRcpt>1</qtyRcpt>
      <line>
        <pr>102.00</pr>
      </line>
  </RECEIPT>
  <RECEIPT>
    <qtyRcpt>3</qtyRcpt>
      <line>
        <pr>20.00</pr>
      </line>
  </RECEIPT>
</BATCH>

i've seen this FAQ:
http://www.dpawson.co.uk/xsl/sect2/N5121.html#d5351e202

but without the sample xml, i can't really understand it.

i've also seen posts that use the "node-set()" function. but i'm not able to successfully get the exslt stuff to work.

<xsl:template match="BATCH">
  <xsl:variable name="tmpTotal">
    <xsl:for-each select="RECEIPT">
      <item>
        <xsl:value-of select="( qtyRcpt * line/pr )"/>
      </item>
    </xsl:for-each>
  </xsl:variable>

  <xsl:variable name="myTotal" select="exslt:node-set($tmpTotal)"/>
  <xsl:value-of select="sum($myTotal/item)" />
</xsl:template>


so, i'd really like to be able to do this in native XSLT 1.0 (without node-set). could someone please point me in the right direction? seems like it would be really simple. i've been pounding my head for hours. thanks.


-charles


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

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
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.