Homework Assignment 2 (XML Document Processing)

The homework is due 9:30 am, April 17, 2007, Taipei Time. Please prepare and hand in the homework in the specific way that is requested below. Your homework will be rejected immediately if it is not prepared accordingly. No late homework will be accepted.

  1. (40 points) QAML is a "Question and Answer Markup Language," for FAQs. Please consult website http://xml.ascc.net/en/utf-8/qaml-index.html for detailed information, especially about its DTD ( http://xml.ascc.net/resource/qaml-xml.dtd). File qaml-faq.xml is a QAML document about QAML itself; file faq-xt.xsl is an XSLT program that converts a QAML document to an XHTML document. Study the two documents, as well as the QAML DTD, to get an understanding of QAML and the sample QAML-to-XHTML transformation. (Note: I have modified both qaml-faq.xml and faq-xt.xsl for the purpose of this exercise. Do NOT use the original versions at the QAML website, use my modifications.) File qaml-faq.xml uses stylesheet gaml.css, and the generated XHTML file uses stylesheet faq-html.css. Ignore the two stylesheets for now.

    File xml10points.xml is a QAML re-markup of (most of) the data in webpage http://www.w3.org/XML/1999/XML-in-10-points. Study these two documents as well.

    Your task is to write an XSLT program qaml2html.xsl such that:

    Please note that your program will be quite different from fqa-xt.xsl. In particular, the XHTML documents produced by your program are structured differently from those by faq-xt.xsl, your program adds back links (to the table of contents), and your program implements auto-numbering if the autonum attributes (for the body and section elements) are set to yes. The generated XHTML documents also use a new stylesheet gaml2html.css which you need to create by yourself.

    Your program must be able to process every QAML element types. But to simplify your task, your program need only to take care of these attributes: archive (href), div (class), body (xml_lang, autonum), faq (date), link (href), logo (class, alt, href), p (class), qna (id) section (id, autonum), span (class, title). Note that the class attribute of element span can have these values: tt, em, i, b, strong, definition, keyword, literal, abbr, acronym, sup. You can assume the input QAML documents contain at most two-level section elements (i.e., section inside section, but no deeper). Remember to validate the generated XHTML documents at http://validator.w3.org.

  2. (40 points) Write a stylesheet qaml2html.css for the generated XHTML documents. The stylesheet shall present your XHTML documents as similar as possible to these screenshots and printouts: xml10points-screen-1.png, xml10points-screen-2.png, xml10points-printout.pdf, qaml-faq-screen-1.png, qaml-faq-screen-2.png, qaml-faq-printout.pdf.

  3. (20 points) Write a new stylesheet my-qaml.css for QAML documents, and new stylesheet my-qaml2html.css for the generated XHTML documents. You are free in your design of these two stylesheets. The stylesheets must be interesting in their own ways, and give out pleasant presentations of QAML and generated XHTML documents.

You must hand in your homework in the following ways (both):