Processing TEI P5, with overlap, using XSLT 2.0 in the client.
By Wendell Piez, Mulberry Technologies Inc., October 2011. Updated February 2014.
For the Interedition 2011 Boot Camp, TEI Members Meeting 2011, Würzburg, Lower Franconia.
Please contact me at wapiez -at- mulberrytech -dot- com.
Features of this demonstration:
So-called “overlap” is a notorious problem for the XML and HTML data models, which each support only a single hierarchy. In particular, while TEI P5 describes a number of ways of encoding overlapping phenomena in documentary texts (see the TEI Guidelines, Chapter 16, Linking, Segmentation and Alignment), simply to encode them is not sufficient, if no processor is capable of implementing the semantics stipulated by the encoding. By taking advantage of features of XSLT 2.0 such as grouping, stylesheet functions, tunnel parameters and processing temporary trees (micropipelining), the XSLT 2.0 rendition here is able to accomplish several things that are prohibitively difficult in XSLT 1.0, representing and handling implicit structures in the XML source that overlap the primary document hierarchy, as encoded using TEI P5 conventions.
The easiest of these to see is the way in which pages are rendered in
the 2.0 display, not as simple milestones (markers occurring within
the text) but as actual containing blocks (div
elements
in the HTML). Others include the highlighting of direct discourse
quoted in the narrative (said
elements in the TEI source,
which are sometimes linked together across paragraph and page boundaries) and
annotated segments (pairings of note
with
anchor
elements in the TEI source). Move your mouse over
the narrative content, or click on footnote references, to see
these features in action.
Saxon CE provides extension functions that support dynamic bindings between XSLT templates and events (mouse or pointer operations) in the browser. No Javascript was written for this demonstration; all the dynamic functionalities are provided by Saxon directly in the XSLT implementation (which is compiled into Javascript at a lower level).
While the first of these is certainly not without interest (especially to markup developers and implementers who face the overlap problem), the second of these may actually have more immediately wide-ranging implications for projects in the humanities and indeed at large. Simply put, it significantly eases the burden on the developer who knows about document encoding and processing using XSLT; mastering Javascript as well is no longer necessary. Of course, a firm understanding of the HTML/CSS DOM (document object model) and its application for dynamic behavior in the browser is still necessary; nor do problems (for example) relating to different browsers' implementation of relevant standards such as DOM and CSS disappear. But these preliminary experiments are encouraging.