Hi I am relatively new to XSLT (used to procedural programming languages) but finding it difficult to understand how I can accomplish that in XSLT and will appreciate any help:
The xml, I want to transform follows - Is nothing more than a listing of employees with their monthly salary changes. The objective is to determine the annual salary for 2015.
<employees>
<employee>
<id>E1</id>
<hiredt>2000-01-01</hiredt>
<salaryhistory>
<change>
<efffrom>2000-01-01</efffrom>
<monthlypay>4000</monthlypay>
</change>
<change>
<efffrom>2014-01-01</efffrom>
<monthlypay>5000</monthlypay>
</change>
<change>
<efffrom>2015-02-01</efffrom>
<monthlypay>6000</monthlypay>
</change>
<change>
<efffrom>2015-07-01</efffrom>
<monthlypay>7000</monthlypay>
</change>
</salaryhistory>
</employee>
<employee>
<id>E2</id>
<hiredt>2015-03-01</hiredt>
<salaryhistory>
<change>
<efffrom>2015-03-01</efffrom>
<monthlypay>5000</monthlypay>
</change>
</salaryhistory>
</employee>
</employees>
The objective is to compute the annual salary for all employees for 2015 and transform into the following XML document
<employees>
<employee>
<id>E1</id>
<annualsal>77000</annualsal>
</employee>
<employee>
<id>E2</id>
<annualsal>50000</annualsal>
</employee>
</employees>
Explanation on computation.
Computation for E1
5000 * 1 month = 5000
6000 * 5 months = 30000
7000 * 6 months = 42000
Total 77000
Computation for E2
5000 * 10 months = 50,000 employee started on March 1,2015.
Any guidance will be much appreciated.