xsl-list
[Top] [All Lists]

RE: RE: Totals for conditional sums ?maybe?

2005-12-06 15:01:19

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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--