Web Development with XML Workshop Day 3
May 24th, 2007 by Karen
The morning of day 3 focused on advanced XSLT; primarily conditionals such as <xsl:if>, <xsl:choose>, <xsl:when>, and <xsl:otherwise>. There was also discussion of XSLT functions such as position(), last(), and name(). name() is really helpful if you want to know what the name of a given node is or use the name of a given node in the document you are producing. When you test the following syntax is helpful:
- = - equal to (this can also mean node exists)
- != - not equal to (this can also mean node does not exist)
- < - less than
- > - greater than
contains() is also an interesting function to use to test if the text of a given node contains a string. The instructors didn’t talk about starts-with() which does something similar and I like to use as well.
We also learned about combining documents using the document() function. I’d never used this before. It was SO cool and helpful. What the document() function does is allow you to import content from another document into your stylesheet. So if you have a list of people in one xml files and bios in another xml file then you can use this function in your XSLT to get content from both xml files. To do this you get need to get the content from the other xml document. This is done using <xsl:variable name=”variable_name” select=”document(’filename.xml’)/> This maps the xml document’s content to the variable_name. You can then access this content using the following XPath syntax $variable_name/xpath/to/node
A significant part of the afternoon was spent working on creating XSLTs from scratch. This was really good practice for me because the document we were asked to style was pretty complicated. There were lots of nested tags and tags with both nodes and text in them, which creates a little bit of a challenge.
The last part of the day was a discussion of how xml is being used in libraries today. Patrick Yott talked about METS how it can be used to model complex digital objects, and combine different types of metadata into a single record (descriptive metadata, technical metadata, and structural metadata [relationships between files]). METS can also be used to move files from one system to another.
Brown is using the following metadata standards for their digital objects.
- METS
- MODS
- MIX
- METSRights
Brown creates a lot of their MODS for their digital object from the EAD finding aids for the collections that the objects were digitized from. They also use an XLST to check to see if a created MODS record has all of the necessary (according to Brown) elements filled in.
Then Matthew Gibson talked about XSL-FO (Formating Objects) FO processors, Apache FOP. Up until this point I’ve been kind of terrified of trying to write an XSL-FO. However, Matthew did a good job a explaining the basics in a really short time (less than an hour). He also provided examples that we could download from the class site and play with later. XSL-FO seems a lot less intimidating now. I’m hoping to try out some of my newly acquired skills to do a transformation from our EAD to printed PDFs. This will really make our Special Collections folks happy.

