Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2018-03-23T21:40:13+0000


Test #5: XSLT

The task

For this test, we are revisiting the play The bicyclers and three other farces from the Regex test, this time to use XSLT to transform an XML version of the entire text into a reading view in HTML. The input XML is available at http://dh.obdurodon.org./xslt-test_input.xml. One possible HTML output file is available at http://dh.obdurodon.org/xslt-test_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 may 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 scenes, speakers, spoken text, stage directions) should be recognizable.

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 http://dh.obdurodon.org/algorithms.xhtml.

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).