Link to home
Start Free TrialLog in
Avatar of mavmanau
mavmanauFlag for Australia

asked on

XSLT SUM IF example

Hi,

Thank you for taking the time to look at my question.

Essentially I have the following XSL:
<clientdemo><transaction><account>16</account><tr_to_agency>-2808.6</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20090202</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091128</tr_listed_date></transaction>
<transaction><account>1</account><tr_to_agency>750</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20100505</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091128</tr_listed_date></transaction>
<transaction><account>1</account><tr_to_agency>0</tr_to_agency><tr_to_client>250</tr_to_client><tr_payment_date>20100527</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091128</tr_listed_date></transaction>
<transaction><account>1</account><tr_to_agency>1200</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20100712</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091128</tr_listed_date></transaction>
<transaction><account>1</account><tr_to_agency>100</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20100909</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091128</tr_listed_date></transaction>
<transaction><account>16</account><tr_to_agency>-35.8</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20100529</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20100703</tr_listed_date></transaction>
<transaction><account>16</account><tr_to_agency>-1000</tr_to_agency><tr_to_client>0</tr_to_client><tr_payment_date>20090330</tr_payment_date><Client_row_id>1</Client_row_id><tr_listed_date>20091230</tr_listed_date></transaction>
</clientdemo>

and what I want to do is if account=16 and trpaymentdate > 20091231 and trpaymentdate is <=20100131 sum of all tr_toagency and sum of all tr_to_client and then sum these two figures together.

Could someone please help with how the XSLT sheet would look?  Once I see how you go about that I can then fill in what I need to.

Many thank you's in advance.
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mavmanau

ASKER

many thank you's I think I can work out most of what I need from there except for one more quick question that I forgot to include as part of original.  Say I am feeding in a value for clientrowid.  When the page first loads, this is of course blank, but if the user clicks on a row above this particular section and selects a particular clientrowid that is then fed into the XSLT page, how would I then make it choose to only do the ones with that particular ClientROWid...say for example it is 2??
that works perfect though, the first part you have given me.
Thank you!! very appreciative, very quickly done too!!
You welcome. So, did you figure out how to feed an input id value?
i think so...I am trying at the moment!