Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2018-04-19T14:41:17+0000


Test #8: Schematron

The text

This test uses the main text from the Zelda: Twilight princess project, which you can download by right-clicking on http://dh.obdurodon.org/schematron-test-2184-xml-instance.xml

The structure of this document, which is not in a namespace, is that the root element, <zelda>, contains three acts (<act>), each of which contains several chapters (<chapter>). Both acts and chapters have @n numbers, which are used to number them sequentially. The acts, then, are numbered 1, 2, and 3, and the chapters within each act are numbered consecutively, beginning anew with 1 at the start of each act.

The task

When you first began marking up documents at the start of the semester, we advised you that it wasn’t necessary to number document components (such as acts and chapters) manually because XPath can do the numbering for you. Should you nonetheless choose to do it manually, not only are you doing unnecessary work, but you run the risk of introducing an error. To ensure that that hasn’t happened here, your task is to write a Schematron schema to validate that the chapter numbers (the values of the @n attributes on the <chapter> elements) within each act 1) begin at 1 and 2) run consecutively through the end of the act. You do not have to validate the act numbers, although you are encouraged to do so as a bonus task if you would like to challenge yourself.

You should associate your schema with your XML document instance in <oXygen/> and verify that it works by changing some of the @n values on chapters in the XML. When you are satisfied with your answer, please upload just the Schematron file (not the XML).