[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem with filtrate sum

Subject: Problem with filtrate sum
From: j23 <duniaj@xxxxxxxxxxxx>
Date: Thu, 1 Oct 2009 19:12:07 +0200
 Problem with filtrate sum
Hello,
I have a problem, probably it is very easy but I'm beginner
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="22.xsl" type="text/xsl" ?>

<root-element>
	<Row NR="1">
		<Name>Andrew</Name>
		<Number>6.0</Number>
	</Row>
	
	<Row NR="2">
		<Name>Andrew</Name>
		<Number>0</Number>
	</Row>
	
	<Row NR="3">
		<Name>Joe</Name>
		<Number>1.600</Number>
	</Row>
	
	<Row NR="4">
		<Name>Joe</Name>
		<Number>1.000</Number>
	</Row>
	<Row NR="5">
		<Name>Andy</Name>
		<Number>4.003</Number>
	</Row>
</root-element>	

my xsl:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:exslt="http://exslt.org/common"
		version="1.0">
	
	<xsl:template match="/" >
		<html>
			<body>
	<xsl:apply-templates />
			</body>
		</html>
	</xsl:template>
	<xsl:output indent="yes"/>
	
	<xsl:template match="root-element">
		
		<table>
			<xsl:variable name="x">
				<xsl:for-each select="Row[position()>=1]">
					<d><xsl:value-of select="translate(Number,'.','')"/></d>
				</xsl:for-each>
			</xsl:variable>
			
			<td><xsl:value-of select="sum(exslt:node-set($x)/d) "/></td>
			
		</table>
	</xsl:template>
	
</xsl:stylesheet>

I would  like to sum number (without character '.'). It works.
Now I try sum  for one name, I make like this but it doesn't work
<xsl:value-of select="sum([Name = 'Joe']exslt:node-set($x)/d) "/>
How can I filtrate sum with using function translate, or key?

thank you for help
Regards
J23

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.