xsl-list
[Top] [All Lists]

RE: Totals for conditional sums ?maybe?

2005-12-06 11:06:11
Data:

<AwardFullData>
        <AwardItemizedLine>
                <periodLinePeriodNumber></periodLinePeriodNumber>
                <transactionAmount>$1,804.00</transactionAmount>
        </AwardItemizedLine>
        <AwardItemizedLine>
                <periodLinePeriodNumber></periodLinePeriodNumber>
                <transactionAmount>$600.00</transactionAmount>
        </AwardItemizedLine>
        <AwardItemizedLine>
                <periodLinePeriodNumber>1</periodLinePeriodNumber>
                <transactionAmount>$600.00</transactionAmount>
        </AwardItemizedLine>
        <AwardItemizedLine>
                <periodLinePeriodNumber>2</periodLinePeriodNumber>
                <transactionAmount>$600.00</transactionAmount>
        </AwardItemizedLine>
        ......
</AwardFullData>


This statement strips all non-numeric characters (haven't made it to
reformating back to $###,###.## yet):

<xsl:value-of
select="(translate(//AwardFullData/AwardItemizedLine/transactionAmount,t
ranslate(//AwardFullData/AwardItemizedLine/transactionAmount,'0123456789
', ''), ''))"/>

Result when applied to data: 180400


This statement is supposed to sum transactionAmount where count of
periodLinePeriodNumber <1

<xsl:value-of
select="sum(translate(//AwardFullData/AwardItemizedLine[count(./periodLi
nePeriodNumber)&lt;1]/transactionAmount,translate(//AwardFullData/AwardI
temizedLine[count(./periodLinePeriodNumber)&lt;1]/transactionAmount,'012
3456789', ''), ''))"/>

Result when applied to data: Can not convert #STRING to a NodeList!


Any suggestions?

--~------------------------------------------------------------------
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>
--~--