Due: January 19, 2000.
Objective: We assume everyone has created a at least a small website (home page and links) using HTML. This approach is problematic when creating a larger site because HTML does not distinguish between content and presentation. In this assignment, you will use XML to encode site contents and use XSL to specify presentation. This will allow you to easily change the presentation of the site, or to create multiple views of the data - i.e. several different websites that present the same data in different ways. The assignment also requires you to script your page in a way that requests input from a user and does simple computation.
Groups & Collaboration: For this assignment, students will work independently (we'll form into groups of two or three students for parts 2-4 of the project). We encourage collaboration on coursework, provided that (1) you do the reading and spend some time thinking about each problem before discussing it with others, and (2) you write up each and every problem in your own writing, using your own words, and understand the solution fully. Copying someone else's work is cheating, a serious offense.
The same rules will apply to groups. Each group is encouraged to discuss its approach with other groups, but copying of architectures, diagrams, or code is forbidden.
Next, you need to write two XSL style sheets that display the same information (.xml document) attractively, presenting the following two different views of the information:
You might find the following examples of working pages helpful. On kimtah.cs.washington.edu, see /www/htdocs/examples. Hello world is /www/htdocs/examples/hello/hello.xml and is reachable here.
Here's a way to specify a document and an associated stylesheet: compare this with this.
Cocoon's PDF rendering example is also available, in /www/htdocs/examples/pdf/.
You might find the following javascript example helpful: a form which calls sample.xml. XML source is available in /www/htdocs/examples/dcp/.
If your username is joe and you create a file foo.xml in your ~/www directory on Kimtah, then the URL kimtah.cs.washington.edu/~joe/foo.xml should access it. Your file must be readable by the web server, which is running as user nobody. Generally, this means that you need to make the file world-readable using chmod.
First make a drawing of the structure of the XML file we have given you, using the notation used in Figure 14-1, in Chapter 14 of The XML Bible.
Next read the pages listed below, focussing on basic principles and on these XSL directives: xsl:template, xsl:apply-templates, xsl:attribute, xsl:value-of, and xsl:text.
Your XSL file has to be a well-formed XML file. Note that several HTML tags that you know and love, such as <LI>, are not well-formed XML. So in order to make the XSL file well-formed, you need to close the tag with </LI>.
This restriction will also cause problems when you try to create an HTML anchor tag whose attribute value depends on your input data (for example, <A HREF="...">). In this case, you need to use the xsl:attribute directive. For example, the XSL template:
<A HREF="URLNode's value">NameNode's value</A>