See the attached file

1 Homework # 2 CIS 562 – John P. Baugh, Ph.D. University of Michigan - Dearborn Points: ________ / 100 Objectives • To better understand XML • To apply XSLT techniques • To under stand XPath better There are two separate parts that you must complete. Part 1: The Spice Bowl Backgr ound information Sharon Krueger manages accounts for The Spice Bowl , an online seller of spices in bulk quantities for restaurants and grocery stores. One of Sharon’s colleagues has created an order report in an XML file detailing some of the orders placed at the Spice Bo wl over the last few days. Rather than organizing the data by orders, Sharon would prefer to have an XML document that organizes the data by customer ID number. The layout of the file she was given and the file she would like to have are displayed in the following figure: She’s asked you to write an XSLT style sheet to transform the layout of her file into the new structure. To create this style sheet, you’ll work with the XSLT commands to create elements and attributes. Note that 2 you must have access to a n XML editor (such as Eclipse with the XML plugins) to generate the result document. Instructions Complete the following: 1. In Eclipse, open the orders .xml file , which is provided 2. Create a n XSL file, clist .xsl 3. Enter your name and date in XML comments at the top of each file 4. In the XSL file, insert the root template 5. Within the r oot template, create a comment node for the result document that contains the following text: Author: name Date: date 6. Within the root template, create and add the customer element node to the result tr ee 7. Within the new customer element, apply the order template using the pathname orders/order, sorted by custid attribute a. Hint: use apply -templates, and select to use a specific template 8. Create the order template 9. Within the order template, create the customer element node 10. Add the id attribute node to the customer element, using the custid attribute as the value 11. Within the customer element node you just created, create the order element with the ordered attribute taken from the id attribute in the source document, and with the qty, date, and amou nt elements tak ing their values from the qt attribute and the date and a mount elements in the source document 12. Save your changes 13. Create and run a configuration to generate customers.xml a. Take a screenshot of your configuration as one o f the screenshots you turn in 3 Part 2: Carin Camping Store Background information John Blish manages accounts for the Cairn Camping Store, a hiking and camping store based in Redmond, Washington. Information from the sales and accounts database is often written to XML files for use with othe r programs and applications. John often works with an XML file containing a listing of customers and their recent orders. He would like to transform the contents of this document into a web page that can be easily viewed in his browser. One possible design for his report is shown in the foll owing image: Design an XSLT style sheet to write the HTML code for John’s report. Instructions 1. In Eclipse, open the campin g.xml file , which is provided 2. Create a camping.xsl file 3. Enter your name and the date in the comment section at the top of each file 4. Take time to study the contents of camping.xml 5. In campi ng .xsl , begin designing your XSLT style sheet. John wants the report to contain the following features: • The name of the store as a main heading • A customer ID table providing each customer ’s name, address, and ID , with customers liste d alphabetically by customer name • Order tables following each customer ID table with the order information for that customer – the order ta bles should be listed in descending order by order ID 4 • Each order table should include the date of the order an d the order ID • Each order table should list the items purchased with those items in the l argest quantities listed first . If two products have the same quantity of items ordered, the products should be arranged a lphabetically by item ID 6. The web page code should be written in HTML 7. The la yout of the page is flexible – you can choose something different than the example, b ut you should include an external style sheet (CSS) to make the HTML pretty a. The CSS file does n’t need to be generated by XSL – make s ure it ’s linked in the result HTML document, but the actual CSS can be hard -coded as usual 8. Run an appropriate configuration for generating the HTML file, ca mping.html a. Take a screenshot and include this as one of your screenshots in what you turn in Delive rables To turn in the assignment, please : 1. Create a zip file of a folder containing the following: a. All XML and XSL f iles for both parts b. Screenshots of your code working properly with all major functiona lity implemented – place the screenshots at the top level of the folder you zip 2. Upload the zip file to the appropriate assignment/homework directory on Canvas