This semester, I have the exciting opportunity to work as an intern among the hum of computers and maze of cubicles at Indiana University’s Digital Library Program! My main projects include migrating two existing digital collections from TEI P4 to TEI P5 using XSLT. If you are familiar with XML and TEI, feel free to skim a bit! Otherwise, I’ve included short explanations of each and links to follow for more information.
Texts for digital archives and libraries are frequently marked up in a language called eXtensible Markup Language (XML), which looks and acts similarly to HTML. Marking up the texts allow them to be human- and machine-readable, displayed, and searched in different ways than if they were simply plain text.
The Text Encoding Initiative (TEI) Consortium “develops and maintains a standard for the representation of texts in digital form” (i.e. guidelines). Basically, if you wanted to encode a poem in XML, you would follow the TEI guidelines to markup each line, stanza, etc. in order to make it machine-readable and cohesive with the collection and standard. In 2007, the TEI consortium unveiled an updated form of TEI called TEI P5, to replace the older P4 version.
However, many digital collections still operate under the TEI P4 guidelines and must be migrated over to P5 moving forward. Here is where XSLT and I come in.
eXtensible Stylesheet Language (XSL) Transformations are used to convert an XML document to another text document, such as (new) XML, HTML or text. In my case, I’m migrating from one type of XML document to another type of XML document, and the tool in between, making it happen, is XSLT.
Many utilize custom XSLT to transform an XML representation of a text into HTML to be displayed on a webpage. The process is similar to using CSS to transform basic HTML into a stylized webpage. When working with digital collections, or even moving from XML to PDF, XSLT is an invaluable tool to have handy. Learning it can be a bit of an undertaking, though, especially adding to an already full work week.
I have free time, sign me up!
Here are some helpful tips I have been given (and discovered) in the month I’ve been learning XSLT to get you started:
- Register for a tutorial.
Lynda.com, YouTube, and Oracle provide tutorials to get your feet wet and see what XSLT actually looks like. Before registering for anything with a price, first see if your institution offers free tutorials. Indiana University offers an IT Training Workshop on XSLT each semester.
- Keep W3Schools bookmarked.
Their XSLT page acts as a self-guided tutorial, providing examples, function lists, and function implementations. I access it nearly every day because it is clear and concise, especially for beginners.
- Google is your best friend.
If you don’t know how to do something, Google it! Odds are someone before you didn’t have your exact problem, but they did have one like it. Looking over another’s code on StackOverflow can give you hints to new functions and expose you to more use possibilities. **This goes for learning every coding and markup language!!
- Create or obtain a set of XML documents and practice!
A helpful aspect of using Oxygen Editor (the most common software used to encode in XML) for your transformations is that you can see the results instantly, or at least see your errors. If you have one or more XML documents, figure out how to transform them to HTML and view them in your browser. If you need to go from XML to XML, create a document with recipes and simply change the tags. The more you work with XSLT, the simpler it becomes, and you will feel confident moving on to larger projects.
- Find a guru at your institution.
Nick Homenda, Digital Projects Librarian, is mine at IU. For my internship, he has built a series of increasingly difficult exercises, where I can dabble in and get accustomed to XSLT before creating the migration documents. When I feel like I’m spinning in circles, he usually explains a simpler way to get the desired result. Google is an unmatched resource for lines of code, but sometimes talking it out can make learning less intimidating.
Note : If textbooks are more your style, Mastering XSLT by Chuck White lays a solid foundation for the language. This is a great resource for users who already know how to program, especially in Java and the C varieties. White makes many comparisons between them, which can help strengthen understanding.
If you have found another helpful resource for learning and applying XSLT, especially an online practice site, please share it! Tell us about projects you have done utilizing XSLT at your institution!