Dynamic Data Manipulation using XSLT from XML

Posted by Imrul on Stack Overflow See other posts from Stack Overflow or by Imrul
Published on 2010-06-07T06:46:04Z Indexed on 2010/06/07 7:02 UTC
Read the original article Hit count: 307

Filed under:
|

I am not working with XSLT not too long. I read that variable of XSLT can't be updated on the fly, so how can i do the following task.

I want to sum up Purchase & Sales and put them into a variable, and make some decision according to these values. (For example, if Purchase is greater then sales then do something if not, do something else)

<rows>
    <row>
        <col attr2="Purchase" >100.00</col>
        <col  attr2="Sales" >100.00</col>
    </row>
    <row >
        <col attr2="Purchase" >19.16</col>
        <col  attr2="Sales" >12.94</col>
    </row>
    <row >
        <col attr2="Purchase" >0.67</col>
        <col  attr2="Sales" >2.74</col>
    </row>
    <row >
        <col attr2="Purchase" >71.95</col>
        <col  attr2="Sales" >61.54</col>
    </row>
    <row >
        <col attr2="Purchase" >3.62</col>
        <col  attr2="Sales" >14.72</col>
    </row>
    <row >
        <col attr2="Purchase">8.80</col>
        <col attr2="Sales">1.22</col>
    </row>
    <row >
        <col attr2="Purchase" >-4.28</col>
        <col  attr2="Sales" >6.53</col>
    </row>
</rows>

if anyone knows, please help me.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xslt