Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 17th, 2015, 01:49 AM
Registered User
 
Join Date: Apr 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to derive Annual Salary

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.

<?xml version='1.0' encoding='UTF-8'?>
<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>



To be transformed to
=============
The objective is to compute the annual salary for all employees for 2015
<employees>

<employee>
<id>E1</id>
<annualsal>77000</annualsal>
</employee>

<employee>
<id>E2</id>
<annualsal>50000</annualsal>
</employee>

<employee>
<id>E2</id>
<annualsal></annualsal>
</employee>

</employees>

-- explanation on the computation.
========================
Computation for E1
5000 * 1 month = 5000
6000 * 5 months = 30000
7000 * 6 months = 42000
Total 77000

Computation for E1

5000 * 10 months = 50,000 employee started on March 1,2015 and should only be paid for 10 months.





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the average salary of a PHP Freelancer? lucent PHP How-To 0 August 19th, 2010 04:36 AM
Derive TcpClient [email protected] C# 5 October 11th, 2004 11:01 PM
Select top third Salary rmukhija SQL Language 7 December 18th, 2003 05:32 AM
can we able to derive a script from mdb mrleokarthik Pro VB 6 0 November 28th, 2003 08:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.