This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Variables and constants
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Variables and constants
- From: "Pawson, David" <DPawson at rnib dot org dot uk>
- Date: Fri, 25 Feb 2000 16:37:40 -0000
- Reply-To: xsl-list at mulberrytech dot com
<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