Jump to content

dmannion

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by dmannion

  1. 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>

     

  2. Thank you for the quick reply and information. Now that I know this I am playing with it and I can get output xml and text to work but it comes out as one line.

     

    > John Smith 1-800-123-4567 1960-05-25 35.85 Jane Jones 1-800-999-9999 1980-11-01 58.17

     

    <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" indent="yes"/><xsl:template match="/Employee"> <Employee> <FirstName><xsl:value-of select="First" /></FirstName> <LastName><xsl:value-of select="Last" /></LastName> <Phone><xsl:value-of select="Phone" /></Phone> <Birthday><xsl:value-of select="Birthday" /></Birthday> <HourlyRate><xsl:value-of select="HourlyRate" /></HourlyRate> </Employee></xsl:template></xsl:stylesheet>

     

    With an output method being XML can you have each Employee be a separate line without using HTML table?

     

    Thank you

    Don

  3. I would like to have my stylesheet use an XML output and if possible use it with a table. I seem to only get this to work with a HTML output not a XML output. I am fairly new at XML so any examples of how to do this or suggestions would be greatly appreciated.

     

    Here is my XML code

     

    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="Lesson_8_obj_1.xsl" type="text/xsl"?><!DOCTYPE Employees><Employees xmlns:xsi="http://www.w3.org/20...Schema-instance"xsi:noNamespaceSchemaLocation="xsd.xsd">> <Employee> <First>John</First> <Last>Smith</Last> <Phone Type="Home">1-800-123-4567</Phone> <Birthday>1960-05-25</Birthday> <HourlyRate>35.85</HourlyRate></Employee> <Employee> <First>Jane</First> <Last>Jones</Last> <Phone Type="Cell">1-800-999-9999</Phone> <Birthday>1980-11-01</Birthday> <HourlyRate>58.17</HourlyRate></Employee></Employees>

     

    Here is my XSL code.

     

     

    <?xml version="1.0" ?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" indent="yes"/>

    <xsl:template match="/"><table> <tr> <th>First</th> <th>Last</th> <th>Phone</th> <th>Birthday</th> <th>HourlyRate</th> </tr><xsl:for-each select="Employees/Employee"> <tr> <td><xsl:value-of select="First"/></td> <td><xsl:value-of select="Last"/></td> <td><xsl:value-of select="Phone"/></td> <td><xsl:value-of select="Birthday"/></td> <td><xsl:value-of select="HourlyRate"/></td></tr></xsl:for-each> </table> </xsl:template></xsl:stylesheet>

  4. I would like to have my stylesheet use an XML output and if possible use it with a table. I seem to only get this to work with a HTML output not a XML output. I am fairly new at XML so any examples of how to do this or suggestions would be greatly appreciated.

     

    Here is my XML code

     

    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="Lesson_8_obj_1.xsl" type="text/xsl"?><!DOCTYPE Employees><Employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="xsd.xsd">> <Employee> <First>John</First> <Last>Smith</Last> <Phone Type="Home">1-800-123-4567</Phone> <Birthday>1960-05-25</Birthday> <HourlyRate>35.85</HourlyRate></Employee> <Employee> <First>Jane</First> <Last>Jones</Last> <Phone Type="Cell">1-800-999-9999</Phone> <Birthday>1980-11-01</Birthday> <HourlyRate>58.17</HourlyRate></Employee></Employees>

     

    Here is my XSL code.

     

     

    <?xml version="1.0" ?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" indent="yes"/>

    <xsl:template match="/"><table> <tr> <th>First</th> <th>Last</th> <th>Phone</th> <th>Birthday</th> <th>HourlyRate</th> </tr><xsl:for-each select="Employees/Employee"> <tr> <td><xsl:value-of select="First"/></td> <td><xsl:value-of select="Last"/></td> <td><xsl:value-of select="Phone"/></td> <td><xsl:value-of select="Birthday"/></td> <td><xsl:value-of select="HourlyRate"/></td></tr></xsl:for-each> </table> </xsl:template></xsl:stylesheet>

×
×
  • Create New...