Getting Started with TEI

Resources

  • the TEI By Example website has lots of examples for how to implement the TEI Guidelines. It also includes a TEI validator, which is especially useful if you don’t have access to one on your machine.
  • the TEI Wiki has a lot of information about using TEI, including tools.
  • SARIT includes a set of encoding guidelines, which is annoyingly unavailable at the moment. I have mirrored the guidelines here.
  • The TEI P5 Guidelines are of course extremely useful and should be one’s starting-point in all questions of encoding.

Suggestions for a ‘TEI Stack’

A ‘stack’ is a set of programs that work together for a certain purpose. You will probably have noticed that working with TEI is not like working with a word processor: you can’t do everything you might want to do with it inside a single application; instead, you generally need to use multiple applications to edit, validate, transform and view your TEI documents.

To start seeing the fruits of your text-encoding labors, you will generally need:

  • your TEI document (e.g., setubandha.xml);
  • an XSLT stylesheet that will transform that document into a format of your choosing (e.g., tei-to-html.xsl); and
  • an XSLT processor that will use the instructions provided by the stylesheet to transform your TEI document into the form you want.

A lot of people, including myself, mostly use “home-cooked” stylesheets: this provides the maximum degree of flexibility, but comes at a cost of having to write a lot of XSLT. (If you ever do decide to learn XSLT, W3Schools has a great set of tutorials.) There are a number of web-based tools that provide generic stylesheets which will get you 50% to 90% of the way towards your goal, and these projects will additionally process your documents for you. These include:

  • OxGarage, designed by “the TEI people” themselves. You choose your input file type, your output file type, and their large library of stylesheets will do the rest. No sign-in necessary, and I find the results pretty impressive.
  • The TAPAS project is a big repository of TEI data, and you can create records by uploading TEI files which will then be displayed according to their stylesheets.
  • If you are intrepid enough, you can run eXist-DB locally and install the TEI Publisher app, which will allow you to upload and display TEI documents in an eXist database. (This is essentially what I have done for the Sātavāhana Inscriptions database.)

The final step, of processing the document using the stylesheet, usually requires software such as Saxon which is not so easy to set up (and for which, after all this time, I still have trouble getting the Java dependencies to work). If your desired output is an HTML document, however, then you have a big advantage: you can use the XSLTProcessor object in Javascript, which means you can do all of your processing within a single web page.

For examples of how to do this, see here in one of my implementations of an in-browser XSLT processor; the Mālatīmādhava site uses this strategy.

Examples