Programming XML in Java - Final Exam (Example Question)


Instructor: John Punin
CSCI 2962 Spring 2001



1. Write an XSLT Style Sheet that transforms the following XML file into the well-formed HTML file listed below.

XML File:

<addr_book>

   <person pid="p01" work="b01" gender="m" age="21">
      <name>
         <first>Gerard</first>
         <last>Uffelman</last>
         <middle>Alexander</middle>
      </name>
      <phone type="work">518-276-6907</phone>
      <phone type="home">518-276-8964</phone>
      <email>uffelg@cs.rpi.edu</email>
      <email>uffelg@rpi.edu</email>
      <addr>
         <street>51 Central St.</street>
         <pobox>400</pobox>
         <city>MDI</city>
         <state>ME</state>
      </addr>
      <url>http://www.cs.rpi.edu/~uffelg/</url>
   </person>
   <person pid="p03" work="b01" gender="f">
      <name>
         <first>Christine</first>
         <last>Coonrad</last>
      </name>
      <phone type="work">518-276-8412</phone>
      <email>coonrad@cs.rpi.edu</email>
   </person>

</addr_book>
HTML File:
<html>
<head>
<title>Address Book</title>
</head>
<body>
<table>
<tr><th>First Name</th><th>Last Name</th><th>Work Phone</th><th>Email</th></tr>
<tr><td>Gerard</td><td>Uffelman</td><td>518-276-6907</td><td>uffelg@cs.rpi.edu</td></tr>
<tr><td>Christine</td><td>Coonrad</td><td>518-276-8412</td><td>coonrad@cs.rpi.edu</td></tr>
</table>
</body>
</html>
 
    
    

to Programming XML in Java Home Page