[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: Variables and constants


Subject: RE: Variables and constants
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Fri, 25 Feb 2000 16:37:40 -0000

<gasp/> <xsl:for-each... inside <xsl:variable.

It is nice to have mathematicians on the list :-)

Gathers a list of nodes into the variable,
then the sum 'adds 'em up'

Impressed David.

Regards, DaveP


><total xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>       xsl:version="1.0"
>       xmlns:xt="http://www.jclark.com/xt"
>                >
>
><xsl:variable name="x">
>  <xsl:for-each select="x/thing">
>    <a><xsl:value-of select="quantity * price"/></a>
>  </xsl:for-each>
></xsl:variable>
>
><xsl:value-of select="sum(xt:node-set($x)/a)"/>
>
></total>
>
>xt basket.xml basket.xsl 
><?xml version="1.0" encoding="utf-8"?>
><total>54</total>


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



Current Thread