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

RE: Boolean XPath Expression and sum

Subject: RE: Boolean XPath Expression and sum
From: "Clapham, Paul" <pclapham@xxxxxxxxxxxxx>
Date: Wed, 9 May 2001 15:35:00 -0700
boolean xpath
11=1+2+3+5, so that's what I would have expected.  If you'd used count()
instead of sum() I would have expected 4.

PC2

-----Original Message-----
From: John Wang [mailto:jwang@xxxxxxxxxxx]
Sent: May 9, 2001 14:46
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Boolean XPath Expression and sum


Here is my XML

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="notAvailable.xsl"?>
<abuncha>
	<thing>1</thing>
	<thing>2</thing>
	<thing>N/A</thing>
	<thing>3</thing>
	<thing>5</thing>
	<thing>N/A</thing>
</abuncha>

Here is my XSL

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml"/>
	<xsl:template match="/">
		<abuncha>
			<xsl:apply-templates/>
			<sum>
				<xsl:value-of
select="sum(//thing[.!=&apos;N/A&apos;])"/>
			</sum>
		</abuncha>
	</xsl:template>
	<xsl:template match="thing[.!=&apos;N/A&apos;]">
		<xsl:copy-of select="."/>
	</xsl:template>
	<xsl:template match="thing[.=&apos;N/A&apos;]">
	</xsl:template>
</xsl:stylesheet>

Here is what I expected:

<?xml version="1.0"?>
<abuncha>
	<thing>1</thing>
	<thing>2</thing>
	<thing>3</thing>
	<thing>5</thing>
	<sum>4</sum>
</abuncha>

Here is what I actually got:

<?xml version="1.0"?>
<abuncha>
	<thing>1</thing>
	<thing>2</thing>
	<thing>3</thing>
	<thing>5</thing>
	<sum>11</sum>
</abuncha>

my question is: Where does the 11 come from?

Thanks in advance.

-John

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


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.