Contact | FAQ Call Now: 1-877-999-0155     416-515-0155    
 
class
  Home /Resources /David Slonosky
 

Gadzooks! XSLT meets Shakespeare...

By: David Slonosky

XSLT... I could insert some bad joke here about this not being an acronym for a something or other, but frankly it would have been LAME.

OK, so what is XSLT? Let's say you've been given a bunch of XML data. XML data that is, let's say, the entire play of "Hamlet". In conveniently wrapped XML bits of data. Someone has gone in and organized all the acts together, then all the scenes within each act, then each speaker in each act and also separated out the stage directions. And there it is. All in one big XML file. (If you think such things are impossible, then There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy. But come; ) And someone says, "You know, I've always admired that Willy Shakespeare boy, but I've never liked that Polonius character. Get me a printout of that script with that Polonius's speeches taken out and do it by five o'clock."

You could sit there with your favourite text editor and do it with the old-fashioned global search and delete method. Or you could apply some XSLT to it and get the whole thing done by lunch, then pretend to edit the rest of the day while secretly you are listening to Miles Davis on your MP3 player and liberally hitting the Boss key in that game no one admits to having on their computer at work. XML is structured text.

Formally structured, which means that it goes beyond loose structuring, which is what you get if you build a Word or FrameMaker template and everyone who gets the template doesn't change it very much and mostly follows your in-house style guide. XML is structured in terms of how elements inside it can be set out (acts and scenes), but can be even more rigidly structured by defining and applying a Document Type Definition (DTD) or XML Schema (XSD file) to it.

So if our copy of hamlet.xml had a DTD or XML Schema attached to it, we could demand (and rightfully so) that there can't be a new act heading popping up in the middle of a soliloquy followed by the rest of the soliloquy. So who cares?

What's wrong with just having hamlet.txt? Well, because XML is structured, and because you can precisely define that structure, you can use Extensible Stylesheet Language Transformations (XSLT) to massage hamlet.

 
 
 

Articles


The Social Web
David Slonosky


The Pomodoro Technique™
David Slonosky


SharePoint Oddysey....
David Slonosky


SharePoint, the most interesting Microsoft product ever!
David Slonosky


Gazing into the Crystal Ball
David Slonosky


Gadzooks! XSLT meets Shakespeare...
David Slonosky


"Linux and the old laptop... they lived happily ever after."
David Slonosky


Back To Time Management.
David Slonosky


Seasonal Attention Deficit Syndrome
David Slonosky


The Laptop
David Slonosky


I go mad and install Linux.
David Slonosky


 
                       

Contact | FAQ | FrontRunner Training 2009 ©