Subject: Re: [xsl] help to get data before '%' of 'value' attribute in element 'coverage' From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 01 Sep 2005 09:49:07 +0200 |
How can I get the values 0 , 15 and 25 and 'add' the together?
<xsl:variable name="measure"> <xsl:call-template name="summer"> <xsl:with-param name="nodes" select="report/data/all/package/coverage[@type='block, %']/@value"/> </xsl:call-template> </xsl:variable> Value of fpx: <xsl:value-of select="$measure"/>
<xsl:template name="summer"> <xsl:param name="nodes"/> <xsl:param name="sum" select="0"/>
<xsl:variable name="my-node" select="$nodes[1]"/> <xsl:variable name="my-value" select="number(substring-before($my-node,'%'))"/> <xsl:choose> <xsl:when test="count($nodes)!=0"> <xsl:call-template name="summer"> <xsl:with-param name="nodes" select="$nodes[position()!=1]"/> <xsl:with-param name="sum" select="$sum + $my-value"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$sum"/> </xsl:otherwise> </xsl:choose> </xsl:template>
regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) B+There are only 10 types of people in this world. Those who understand binary, and those who don'tB;
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] help to get data before '%' , Mikael Petterson (KI | Thread | Re: [xsl] Generate implicit wrapper, Ferdinand Soethe |
[xsl] Client XSL transformation wit, dabla © | Date | Re: [xsl] Client XSL transformation, David Carlisle |
Month |