Вы находитесь на странице: 1из 2

ITEM523

Practical Exam on XLST

Working in groups of up to 2 members is allowed. You must submit the following: (Hardcopy) Input files XSLT stylesheets Output files Any readme files, as applicable.

Question 1 (40 pts)


Assume you have three files, Supplier.xml, Parts.xml and Shipment.xml with information about Customers, Parts and Shipments respectively (A part can be shipped by more than one supplier and a supplier can ship more than one part). The data in Supplier.xml is obtained from a table (primary key: supplier_no) Supplier from a relational database; Parts.xml is generated from a table (primary key: part_no) called Parts and Shipment.xml from a table called shipment (primary key: {supplier_no, part_no} and foreign keys: supplier_no and part_no) in a relational database. You can assume the following structure (content and end tags are not shown) for the data in the files. Note: Create the input files, Supplier.xml, Parts.xml and Shipment.xml with data of your choice. Supplier.xml <supplier> <supplier_no> s1 </supplier_no> <name> Wideget Inc <name> <city> San Jose <phone> 555-1212 </supplier> Parts.xml <part > <part_no> p1 </part_no> <part_name> wrench <price> <weight> </part> Shipment.xml <shipment> <supplier_no> <part_no> p1 s1 </supplier_no> </part_no> 10.00 2.00 </part_name> </price> </weight> <city> </phone>

<quantity> 100 </quantity> <date_shipped> 11-12-03 </date_shipped> </shipment>

Using XSLT, you are required to generate a single file called Part_Shipments.xml with all the Shipment information using the data from the three files.

You have two choices for generating the structure of Parts_Shipment.xml document:

Choice A
The main element is Shipment (nested under the root, Part_Shipments), where each Shipment elment contains a Supplier element, a Part element, quantity and date_shipped as the children. See the example below: <part_shipments> <shipment> <supplier> <supplier_no> s1 </supplier_no> <name> Wideget Inc <name> <city> San Jose <phone> 555-1212 </supplier> <part > <part_no> p1 </part_no> <part_name> wrench <price> <weight> </part> <quantity> 100 </quantity> <date_shipped> 11-12-03 </date_shipped> </shipment> </part_shipments> 10.00 2.00 </part_name> </price> </weight> <city> </phone>

Choice B (10 pts Extra Credit)


Parts_Shipment.xml includes Supplier elements, Part elements and Shipment elements, where Supplier and Part elements contain an ID attribute (using the supplier_no and part_no) and Shipment elements refer to the Supplier and Part elements using the IDREFs ( supplier_no and part_no). Refer to notes on IDs and IDREFs.

Question 2 (30 + 30 pts)


Using the Parts_Shipment.xml file you generated in Question 1, do the following: a) Write an XSLT style sheet to display all Suppliers from San Jose (where city = San Jose) area. b) Write an XSLT style sheet to display the Parts (all the Part information) supplied by a supplier with Supplier_no = S1 and a supplier with supplier_no=S2;

Вам также может понравиться