The homework is due 2:30 pm, November 12, 2008. 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.
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 at the above links.
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:
It accepts any valid QAML document and generates only valid XHTML document (precisely, XHTML-1.0-Strict);
The generated XHTML documents must, in their structure and information content,
be as close as to those exemplified by the two files
qaml-faq.html
and xml10points.html
(which are transformed from qaml-faq.xml
and xml10points.xml
respectively).
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
.
Your program must be able to process all 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., a section inside another section, but no deeper). Remember to validate the generated XHTML documents at http://validator.w3.org.
You must hand in your homework in the following way:
Send to the TA (teaching assistant; e-mail: evirt@iis.sinica.edu.tw) the following two files (exact file names):
readme.html
qaml2html.xsl
In your e-mail to the TA, your e-mail message has an empty body but with two
attachment of the file names readme.html
and qaml2html.xsl
.
Your e-mail must have the exact Subject: [TRC98XML-2]:student-id
,
where student-id is your student ID (for example, [TRC98XML-2]:B94705001
).