An XSLT Tutorial
Written by John Bradley, Elena Pierazzo and Paul Spence
Introduction
It should be pretty clear that a document entitled "An XSLT Tutorial" has the primary purpose of introducing you to (the basics of) XSLT! There are several excellent resources in print already that introduce people to XSLT. Why do we need another one? One possible reason is that we are using these notes in the context of courses in Humanities Computing. If you are one of our students it is likely that your background is different from that assumed for most of the other XSLT tutorials you will find. We try to accommodate this difference in these notes. Furthermore, in several ways the materials that we use to illustrate points about XSLT here are almost entirely drawn from humanities-like sources, and many are actual examples that we have come up against in our daily work. Materials from humanities-like sources are the kind of things those interested in Humanities Computing are likely to come up against, and it is useful to see how XSLT works with these kinds of materials.
Before we really begin, however, it is important for you to understand that, although introducing you to XSLT with examples drawn from humanities sources is the primary purpose of this tutorial, the writer has other agendas as well -- and, furthermore, does not want them to be hidden from you:
- The writer's second agenda is tied up with the fact that XSLT is a technology that is designed to work with XML markup. We believe that the way XSLT makes you think about XML will also cause you to develop a better understanding of the significance of XML markup itself, and will help you begin to see how this markup might be more fully exploited. Hence, during this tutorial you might expect to see features of XML that you have perhaps not seen described, or only briefly touched on before. Also, you might well be shown uses for XML that are significantly different from what you have thought about up to now.
- There is a third agenda as well. The CCH applies its technologies to research projects in the Humanities, and thus you will also see along the way how XML and XSLT are used in several humanities-oriented research projects in which the CCH is a partner. We believe that technologies such as XML and XSLT have a great deal to offer to the humanities, and it is in the full understanding of these technologies, and their implication to scholarship, that humanists can gain the most benefit.
- Finally, there is a fourth agenda. You will also be briefly exposed to the kind of "formal" approach to defining XSLT that is commonly used in computer science to describe things called formal languages. There could be a great deal more said formally about formal languages, so you should consider that you are getting only a taste of the significance of this here.
Finally, before we really begin, we must give you a different sort of warning. Almost all of our material (indeed, one of the principal uses of XSLT world-wide) makes use of XSLT to generate HTML. It turns out that XSLT will require you to understand HTML tagging in ways that high-level tools that "do" HTML for you such as Dreamweaver or Word don't show. Indeed, all of the exercises we have provided in this tutorial will expect you to know HTML well enough that you could first create at least basic HTML pages with text, lists, headings, links and tables with a non-HTML-aware editor such as Notepad. If your only experience of HTML has been to generate it using these high-level tools then you will find that your understanding of HTML will not be not enough to allow you to deal with the material covered here. Before proceeding further with XSLT be sure that you develop a real hands-on, low level, understanding of HTML.
About this Tutorial
This tutorial is composed by several modules, each of them will be structured as follows:
- Abstract and Goals: a description of the content of the module and a list of the leaning goals of the same.
- Main notes: the main content of the module.
- Exercises: some exercises about the things explained in the main notes.
- Taking it further: contains additional readings or more explanations on the topics covered by the main notes.
Notice that some of these sections may not be present all the times.