ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error
|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sum of price * qty, without node-set()
Using FXSL one would simply write:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foldl-func="foldl-func"
exclude-result-prefixes="foldl-func"
>
<xsl:import href="foldl.xsl"/>
<!-- This transformation must be applied to:
numList.xml
-->
<xsl:variable name="vFoldrFun" select="document('')/*/foldl-func:*[1]"/>
<xsl:output encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:call-template name="foldl">
<xsl:with-param name="pFunc" select="$vFoldrFun"/>
<xsl:with-param name="pList" select="/*/RECEIPT"/>
<xsl:with-param name="pA0" select="0"/>
</xsl:call-template>
</xsl:template>
<foldl-func:foldl-func/>
<xsl:template match="foldl-func:*">
<xsl:param name="arg1" select="0"/>
<xsl:param name="arg2" select="0"/>
<xsl:value-of select="$arg1 + $arg2/qtyRcpt * $arg2/line/pr"/>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied on your source.xml:
<BATCH>
<RECEIPT>
<qtyRcpt>1</qtyRcpt>
<line>
<pr>102.00</pr>
</line>
</RECEIPT>
<RECEIPT>
<qtyRcpt>3</qtyRcpt>
<line>
<pr>20.00</pr>
</line>
</RECEIPT>
</BATCH>
the wanted result is produced:
162
Cheers,
Dimitre Novatchev.
FXSL developer,
http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
"Charles Gebhard" <cgebhard@xxxxxxxxxxxxxxxx> wrote in message
news:40187C7E.5080706@xxxxxxxxxxxxxxxxxxx
> 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
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








