This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Challenge 1 : A Connexions module transformed [June 6, 2012, 9:16 p.m.]


 

Challenge 1: Take a little XML module and transform it to HTML

Pre-requisites

All of the techniques you will need are located in the first three chapters of Jenni Tennison's "Beginning XSLT 2.0". The first chapter is a review of XML. If don't know much about XML, this is the chapter for you. It also has a nice review of encodings. Chapters 2 and 3 cover xsl:for-each, xsl:value-of, xsl:apply-templates, selecting, matching, modes, priorities, generating attributes and ids and xsl:next-match (a 2.0 feature). She gives a series of examples that transform an xml document describing tv channels and shows in to a simple web page displaying them. The techniques she uses can be applied directly in our challenge.

The goal

Transform a simplified CNXML module into an HTML page. The sample module contains some introductory paragraphs, some exercises, and some terminology within the exercises that are tagged as "terms". Each exercise has a title. The module also has a little bit of metadata, a title, some authors, and a license URL.

Resources

  • The input file
  • Other potentially helpful files.
    • CSS for rendering Connexions modules
    • Javascript for showing/hiding exercise solutions in Connexions modules
    • The html of an existing Connexions module.

Detailed description

Your solution should have the following components:

  • A table of contents with links to each of the exercises
  • The document output with exercises that hide their solutions initially and let you click on the them to open them.
  • A glossary at the end that lists all the terms found in the document.

The input document has a <verbatim-section> element that contains a table that we aren't processing yet. The intention is just to copy it into the output directly since it is already HTML. An easy way to copy it is to use the following template snippet. The first three chaps don't cover xsl:copy-of, so I am giving this to you.