[XSLT] Summing calculated values
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 2
- Joined: Sat Nov 03, 2007 10:55 am
[XSLT] Summing calculated values
Post by Worteltaart »
Hi,
Say I have this order/orderline/article structure in my application.
Each orderline:
The price is fetched from the article, all an all in a pretty BLOATED function I've tried to add up the calculated values for each order line:
This nicelt prints the value for each of the orderlines in an order, but how do I go about summing these values, I'm totally lost here. Any help is appreciated![/code]
Say I have this order/orderline/article structure in my application.
Each orderline:
Code: Select all
<orderline articleidref="article0003">
<quan>1</quan>
</orderline>
Code: Select all
<xsl:template name="total">
<xsl:param name="orderid_ref">0</xsl:param>
<xsl:variable name="tmp_subprice">
<!-- loop throuch all orderlines -->
<xsl:for-each select="/webshop/orders/order[@orderid=$orderid_ref]/orderregels/orderregel" >
<!-- remember quantity of current orderline -->
<xsl:variable name="tmp_artikelaantal" select="aantal" />
<!-- remember articleid from current line -->
<xsl:variable name="tmp_artikelid" select="@artikelidref" />
<!-- remember price from current article -->
<xsl:variable name="tmp_artikelprijs" select="number(translate(substring(/webshop/artikelen/artikel[@artikelid=$tmp_artikelid]/prijs, 3), ',', '.'))" />
<!-- calculate value of single orderline -->
<xsl:value-of select="$tmp_artikelaantal * $tmp_artikelprijs" />
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$tmp_subprice" />
</xsl:template>
-
- Posts: 2
- Joined: Sat Nov 03, 2007 10:55 am
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service