Jump to content

Give all employees a 5% raise


dmannion
 Share

Recommended Posts

The output of this XML I need to give all employees a 5% raise. I am fairly new to XML and I need to figure out the XSL to give me this output. This is what I have. I am sure this is something to do with my XPath

 

<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href="Lesson_11_obj_2.xsl" type="text/xsl"?><!DOCTYPE Employees><Employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="Lesson_11_obj_2.xsd">><Employee> <First>John</First> <Last>Smith</Last> <Phone Type="Cell">1-800-123-4567</Phone> <Birthday>1960-05-25</Birthday> <HourlyRate>35.85</HourlyRate></Employee><Employee> <First>Jane</First> <Last>Jones</Last> <Phone Type="Work">1-800-999-9999</Phone> <Birthday>1980-11-01</Birthday> <HourlyRate>58.17</HourlyRate></Employee><Employee> <First>Lisa</First> <Last>Galo</Last> <Phone Type="Home">1-978-999-9999</Phone> <Birthday>1980-01-01</Birthday> <HourlyRate>20.17</HourlyRate></Employee><Employee> <First>Greg</First> <Last>Morgan</Last> <Phone Type="Home">1-603-865-9874</Phone> <Birthday>1995-11-01</Birthday> <HourlyRate>30.17</HourlyRate></Employee><Employee > <First>Michelle</First> <Last>Lewis</Last> <Phone Type="Cell">1-603-434-9874</Phone> <Birthday>1978-11-01</Birthday> <HourlyRate>15.00</HourlyRate></Employee><Employee> <First>Mike</First> <Last>Westbrook</Last> <Phone Type="Cell">1-910-265-3214</Phone> <Birthday>1972-06-10</Birthday> <HourlyRate>123.00</HourlyRate></Employee><Employee > <First>Sue</First> <Last>Jillian</Last> <Phone Type="Work">1-910-987-1214</Phone> <Birthday>1972-08-10</Birthday> <HourlyRate>23.00</HourlyRate></Employee><Employee > <First>Bob</First> <Last>Johnson</Last> <Phone Type="Cell">1-213-231-1214</Phone> <Birthday>1974-10-10</Birthday> <HourlyRate>20.50</HourlyRate></Employee><Employee > <First>David</First> <Last>Little</Last> <Phone Type="Cell">1-980-540-9087</Phone> <Birthday>1943-02-10</Birthday> <HourlyRate>20.05</HourlyRate></Employee></Employees>

 

<?xml version="1.0" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html"/><xsl:template match="/"> <xsl:for-each select="/Employees/Employee/"> <xsl:for-each select="HourlyRate"> First Name: <xsl:value-of select="First"/><br/> Last Name: <xsl:value-of select="Last"/><br/> New Hourly Rate<xsl:value-of select="'HourlyRate' * 1.05"/> </xsl:for-each> </xsl:for-each></xsl:template></xsl:stylesheet>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...