This is the source code to a website hosted at tei.pauldyck.com/ . The purpose of the web site is to provide a way to view TEI documents in an immersive, interactive environment.
This software grew out of a course I taught with Paul Dyck at Canadian Mennonite University in 2008. We were teaching humanities students to encode literary texts in the TEI, and I wanted some way to let students visualize the results of their encoding … in a sense, to get some payoff for the work they were putting in. (In addition to the pristine beauty of the XML itself, of course).
For example, <name key=“mrsbennet” type=“person”> would become <div class=“name” key=“mrsbennet” type=“person”>
At that point, I could use CSS to get a first approximation of how the document should look. Aside from the usual formatting, it was (of course) necessary to hide some things completely (display: none) and make quite a few things inline (display: inline).
From a technical point of view, I wanted to do the computing in the browser, rather than on the server. If I recall correctly, my thinking was that I wanted the experience to be very fluid, so I wanted to avoid round-trips to the server as much as possible. The general architecture, then, was something like this:
One of the consequences of the client-side XSLT was that the software only works in Firefox. The reason is that Firefox has the best XSLT support currently, and I ended up wanting to use XSLT features that were only supported in Firefox.
I was not at all sure whether the computing-in-browser approach would scale to large documents, but it did remarkably well, at least at the scale of the student projects. I have not yet identified at what point the size of the TEI document becomes unmanageable (it would, of course, vary depending on installed memory, and to a degree on CPU speed).
At that point, I was not using any dynamic framework on the Web server side. However, when rewriting this for more general consumption, I have embedded it in a Rails application. The general architecture is still the same, with the computing in the browser. The only substantial work the Rails application does on the server is keep track of the TEI uploads themselves.
I plan to keep tinkering with this from time to time … I've just scratched the surface of what would be possible. I expect we'll also use this again the next time we teach the course, and that will be an impetus for further development.
One of the key issues that would need to be addressed in using something like this as a tool for viewing a large variety of TEI documents is the flexibility inherent in TEI customizations of one kind or another. The code here is largely aimed at the TEI-lite, with certain assumptions about encoding idioms and practices. This worked fine for class purposes (since those were the idioms and practices we were teaching), but there will be many TEI documents that this software doesn't handle well (I expect). I would have some interest in figuring out ways to deal with that, if there are people for whom that would be useful.
The code that I've written here is subject to the MIT licence, as follows. However, you should be aware that I'm using several libraries that are subject to their own licence provisions. Thus, you need to pay attention to the various licence-related files in the source code.
Copyright © 2009 Ryan Rempel <email@example.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.