Sample card catalog output using XSLT and CSS from the AADL catalog
Tonight was as good a night as any to learn a little bit, and so I reinvented John Blyberg's virtual catalog card using XSLT and CSS. It's very rough right now, but the results are good enough to show.
The URL that shows everything is this uber-long monstrosity:
Go ahead, click, it won't bite. See?
In real life you would not use that - in real life the XML from the catalog would have a style sheet with it of some kind. But just to play along, here's how you parse that.
The first bit from w3.org is the public xslt translator they run. Be gentle, and don't expect it to be a production service.
The second part is the XSL file, http://www.superpatron.com/aadlexample.xsl . It's a programming language written in XML that takes an XML file and turns it into anything, very typically another XML (or HTML) file. Your web browser has that programming language built into it. If you look at the page it's not actually all that complicated - you're essentially grabbing elements from one page and plunking them into a template. I'm at about the edge of my knowledge with this file right now, but it does work....
This xsl file in turn includes a CSS file, http://www.superpatron.com/aadlexample.css . The CSS is a style sheet that makes the page look pretty - it selects things like fonts, background images, spacing, and other layout elements for a page. The CSS here is very minimal. You'll see that it includes a background image from John's card catalog collection on Flickr.
Finally, there's an XML file, http://www.aadl.org/cat/rest/record/1249810 , which has the raw catalog information from the AADL's site. It is marked up in such a way that all of the fields in it are readily accessable. (The only thing I noticed missing from it was subject headings.) The XML could, if it wanted to, specify an external XSL file to be interpreted by the browser.
String all of this stuff together, and you get this:
but this is now data, not just an image, and you could (though i stopped before I did) have some of the elements be live links.
Technorati Tags: css, xslt, xsl, annarbor, library, cardcatalog, library2.0

Yay! Love the XSLT hacks.
Posted by: Bill Humphries | 21 January 2006 at 06:43 PM
This is awesome. I love the idea of a catalog card with links. I tried to sell John on text instead of an image, but he was having too much fun with GD, the slacker.
Posted by: eli | 23 January 2006 at 10:30 AM
Thanks Eli.
I did some more work on this today. It'll be invisible to most people, but if you have a COINS resolver for ISBNs, you'll have a link to your local library's holdings for this record. I also marked up the card in the "openurl" microformat which might some day be more widely parsable.
Now to find some cardstock that's more to my liking :)
Posted by: Edward Vielmetti | 23 January 2006 at 05:55 PM
Hah, the link produces:
Using org.apache.xerces.parsers.SAXParser
Exception net.sf.saxon.trans.DynamicError: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
Looks like there is some more debugging to do.
Posted by: Greogry | 15 August 2007 at 05:06 PM
yup, it's broken.
(and it could have broken in a few places - this was cobbled together from web services not guaranteed to be stable, so I'm inclined to leave it be until the next round of hacking)
Posted by: Edward | 15 August 2007 at 05:14 PM