[xsl] sum() with selective attribute

Subject: [xsl] sum() with selective attribute
From: "Lee, Insoo" <Insoo.Lee@xxxxxx>
Date: Mon, 6 Jan 2003 16:53:52 -0500
 Hi,  how would I use sum() function along with attribute?
  for the given xml shown below, I would get a grand total per each
currency...
  I guess I can do something like
sum(/REPORT/ENTITY/FUND_GROUP/ROW/SOME_VALUE) along with "xsl:if", but I'd
like to avoid scanning through the tree again looking up CURRENCY
attribute... any suggestion?
  Thanks


<REPORT>
    <ENTITY NUMBER="1">
        <FUND_GROUP CURRENCY="GBP">
            <ROW>
                <SOME_VALUE>100</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>200</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>300</SOME_VALUE>
            </ROW>
        </FUND_GROUP>

        <FUND_GROUP CURRENCY="USD">
            <ROW>
                <SOME_VALUE>100</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>200</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>300</SOME_VALUE>
            </ROW>
        </FUND_GROUP>		
    </ENTITY>

    <ENTITY NUMBER="2">
        <FUND_GROUP CURRENCY="GBP">
            <ROW>
                <SOME_VALUE>100</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>200</SOME_VALUE>
            </ROW>
        </FUND_GROUP>

        <FUND_GROUP CURRENCY="USD">
            <ROW>
                <SOME_VALUE>200</SOME_VALUE>
            </ROW>
            <ROW>
                <SOME_VALUE>300</SOME_VALUE>
            </ROW>
        </FUND_GROUP>		
    </ENTITY>

</REPORT>

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


Current Thread