Archive for the ‘xslt’ Category

XSL for the Archivits’ ToolKit

August 1, 2008

I just finished the XSL work I’ve been doing for the Archivists’ ToolKit. The stylesheets will both be included in the next release which I believe is scheduled for September. I’m fairly pleased with how they came out, the layouts had to be simple, no images and neutral color schemes in order to be generic enough for any institution to use, but at the same time I wanted them to look attractive. Here is a sample of the HTML output, and here is a sample of the PDF (this is an EAD from UVM’s collection). In fact I think I like the design quite a bit more than the one I did for UVM, it is nice and simple.

The work itself was enjoyable though a bit more of a challenge then I had anticipated, partially due to my daughter not napping as much as I thought she would, and partially due to the limitations of XSL 1.0. I prefer 2.0, it has a lot of nice functions that are lacking in 1.0, but in the end it was not a problem, just took me a little longer to do some things. I ended up starting from scratch rather than using the existing XSL (which was derived from one of the EAD Cookbook examples). I think this made things easier, I didn’t have to wade through anyone else’s code, although it may have taken a bit longer.

I’m still waiting for UVM to come through with my consulting contract, but am also starting to look around for other possible consulting opportunities. So if you need any XSL, XQuery or XForms work done, drop me a line.

Useful little xsl tidbit

July 10, 2007

While avoiding my presentation, I discovered this useful xsl trick for copying an entire xml document and its attributes and changing only selected elements.

<xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>

We are working on migrating our finding aids out of Dyna Web and into eXist, this is including a transformation from SGML to XML and quite a bit of clean up. Chris (the Curator of Manuscripts) has been doing most of the work, but every once in a while we need to tweak the stylesheet, or create a new one, to deal with some special UVM eccentricity. In this case we had a c02 that contained a scopecontent element with a series of nested lists that we wanted to turn into <c03 level=”item”> elements.
The above code copies all the attributes and elements as is unless I have a special template for that element, then it follows the template’s rules. So then I added a convoluted template that creates the new c03 elements from the list items. The transformation is fairly quick even on large EAD files.