Digital humanities

Maintained by: David J. Birnbaum ( [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2019-03-29T00:52:45+0000

Test #6: XSLT

The task

For this test, we are revisiting the play The post office from the Regex test, this time to use XSLT to transform the entire play from XML into a reading view in valid HTML. The input XML is available at 2194_xslt-test-input.xml. One possible HTML output file is available at 2194-xslt-output.xhtml, but yours does not have to look exactly like ours.

Before you start

Before writing any XSLT, you should explore the XML file. Part of that exploration involves reading through it quickly, but you can also use the XPath browser interface in <oXygen/> to learn about the markup. What elements are used in the document? How are they structured, that is, which elements can occur where? To get you started, you can get the names of all of the distinct element types with the XPath expression distinct-values(//*/name()). This finds all elements anywhere in the document (//*); uses the name() function to get their names, instead of the elements themselves; and then uses the distinct-values() function to remove the duplicates and make the list easier to read. Before you write any XSLT, be confident that you know how each of these element types is used in the document. Hint: the <stage> element appears in two different contexts (you can find them using XPath), and you will probably want to process it differently according to where it appears.

HTML requirements

Your HTML must look like the script for a play. That gives you a lot of flexibility, since the typography of play scripts is not rigid, but it should be something that a reader would recognize as a script, and the expected parts of the script (such as acts, speakers, spoken text, stage directions) should be immediately recognizable as such.

Your HTML must be valid. This means that you should save the results of the transformation by specifying a filename in the Output dropdown in <oXygen/>, and, after running the transformation, you should open the output HTML in <oXygen/> and validate it. You are not required to apply CSS to the file, but if you do (it’s an optional bonus task, about which see below), the CSS needs to be valid, it needs to be linked to the HTML, and the link needs to be created during the transformation.

Required output features

Your output must include the following:

You should create this output by using XSLT in an algorithmic fashion, as described in our

Successful completion of everything above this line earns an A grade.

Bonus tasks

The following features earn extra credit:

What to submit

Upload your XSLT file and, if you created CSS, your CSS stylesheet. Do not upload either the input XML (we already have it) or the output HTML (we’ll run your XSLT transformation to create it).