This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: XSLT: SUM function or "+" operator usage problems to display subtotal/total


>           <xsl:variable name="subtotal">
>                <xsl:value-of select="$subtotal+number(Price)">
>           </xsl:variable>

You have fundamentally misunderstood the way XLST variables work, I'm
afraid. XSLT is not a sequential programming language with assignment
statements, it is a functional language in which you must express the output
you want as a function of the input. Don't think about accumulating the
total as you go along, think about calculating it at the point it is needed,
using XPath expressions such as "sum(../item/price)".

Mike Kay 


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]