Programming Assignment 5
Using XPath and XSLT

Due on Wednesday March 31 before midnight


This project must be done individually. No copying is permitted. The goal of this project is to learn XPath and XSLT to query XML data and display XML data on a web browser.


You will do this project on your own PC/laptop. You may use a text editor to develop your Java programs but you can use Netbeans if you want.

Here are some examples:


The following web pages provide some tutorials. Use them as a reference only.

Project Requirements

  1. Consider the following XML document along with its DTD that describes auctions: (The words for text paragraphs are taken from Shakespeare's plays.) Download the file and edit it to include the following XPath queries:
    1. Return the initial increases of all open auctions (this is the increase value of the first bidder in an open auction). Note that dates in bids are random. The order of bids is exactly the order of bidders inside an open auction.
    2. How many sold items cost more than 40?
    3. How many items are listed in Europe?
    4. Print the keywords in emphasis in annotations of closed auctions.
    5. Print the persons who have a homepage.
    6. Return the IDs of all open auctions whose current increase is at least twice as high as the initial increase (note that these are the increases of the last and first bidders of the same open auction). That is, for a given open auction, if the increase of the last bidder is greater than twice the increase of the first bidder, you return the ID of this open auction.
  2. Consider the following XML document along with its DTD that describes recipes: Write an XSLT program to display the recipes nicely on a web browser. The XSLT should generate HTML code. You should display all data except the related elements. Use the Java program to test your XSLT and then load the resulting html output file on your web browser.

What to Submit

Use the form below to submit your files.

Submit Project #5:

Last modified: 03/30/10 by Leonidas Fegaras