Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2017-04-19T17:54:28+0000


Schematron test

The XML Document

This test uses an XML document containing the total reference counts from the U.S. presidential inaugural addresses: So help me God project, which you can download by right-clicking on http://dh.obdurodon.org/schematron-test-2174-xml-instance.xml

The structure of this document is that the root element, <speeches>, contains data for 57 inaugural speeches (<speech>), each of which has a count of 0 or more references. Each speech also has a @year number, which denotes the year that the speech was given.

The task

Your task is to write a Schematron schema to validate the following:

  1. There are exactly 57 speeches.
  2. No year has a negative reference count.
  3. The year number (the value of the @year attribute) for each speech is not less than 1789 and not greater than 2013, since the project only contains speech data up until 2013 and no inaugural speeches were given prior to 1789.
  4. (Optional bonus question) Inaugural addresses are given every four years, even though presidents may succeed to office at other times when the incumbent dies. Verify that sequential years of the inaugural addresses differ by exactly 4.

Associate your schema with your XML document instance in <oXygen/> and verify that it works by changing the total number of <speech> elements, changing some of the reference counts inside of the <speech> elements, and changing some of the @year attribute values on the <speech> elements. When you are satisfied with your answer, please upload just the Schematron file (not the XML).