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

RE: RE: Totals for conditional sums ?maybe?

Subject: RE: RE: Totals for conditional sums ?maybe?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 6 Dec 2005 22:01:19 -0000
RE:  RE: Totals for conditional sums ?maybe?
> This statement strips all non-numeric characters (haven't made it to
> reformating back to $###,###.## yet):
> 
> <xsl:value-of
> select="(translate(//AwardFullData/AwardItemizedLine/transacti
> onAmount,t
> ranslate(//AwardFullData/AwardItemizedLine/transactionAmount,'
> 0123456789
> ', ''), ''))"/>
> 
> Result when applied to data: 180400

That's with a 1.0 processor (using a node-set where a string is expected
takes the string value of the first node and ignores the others). With a 2.0
processor (in 2.0 mode) this will give you an error: if you want the first
item only, you have to say so; if you want to convert all the nodes, you use
a "for" expression.
> 
> 
> This statement is supposed to sum transactionAmount where count of
> periodLinePeriodNumber <1
> 
> <xsl:value-of select="
    sum(translate(....
> 
> Result when applied to data: Can not convert #STRING to a NodeList!
> 

The sum() function in 1.0 expects a node-set, the translate function returns
a string, and (as the Xalan message almost says) you cannot convert a string
to a node-set.
> 
> Any suggestions?
> 

Use one of the several approaches given in previous responses.

Michael Kay
http://www.saxonica.com/

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.