Home |  Ramblings |  Code Samples |  Bookshelf |  Links |  Friends & Family

Ramblings


Table of Contents

Creating a site using XSLT

XML is a great technology for creating content. It does have some drawbacks. For example, by being a little oververbose. But in general, it does a great job of keeping content in a portable format.

So, now that we have the content, what do we do about the presentation? We all know about the importance of keeping content separate from presentation, don't we? It is drilled into us through programming courses, books, and a plethora of postings on newsgroups or mailing lists that keep reminding us of the Model-View-Controller (MVC) architecture, or some other such. This is where XSLT comes in. By using XSL Transformations, we can convert our XML source code into whatever presentation format we like.

For now, I will just get to grips with XSLT by converting my XML source into HTML. But later, I shall practice converting the site (or some portion of it) into other presentation formats (PDF, maybe others).

So I start to look into this XSLT stuff, starting with TheFirstPageOnTheInternet, and, of course, the W3C. I also chanced upon IBM's Toot-O-Matic tool, which is used to generate most of the tutorials on the developerWorks site. Toot-O-Matic is a nice place to start to get a feel for what you can achieve with XSLT and, most importantly, how.

Programming in XSLT

Being a declarative language, you have to do a context switch when programming in XSLT rather than your normal procedural/OO language (in my case Java).

Adventures in C#

I've been wanting to generate a website from XML some time. It has taken me a while to get started, but I was eager to start playing with XSLT, so I am finally here.

I came across Ron's series Adventures in C# with its very interesting anectdotes, where he describes how he generates all of the xprogramming.com using XML and XSLT. If that was not enough, I also came across Gregor Hohpe's Enterprise Integration Patterns site. That's where I pinched the idea for the colophon linked from the footer of every page.

So... it looks like I'm being hinted that I better get cracking with this website of mine. So I go look into this XSLT stuff (see Creating a site using XSLT).

After much study and reasearch I get a basic implementation running. Way off the perfect implementation, but, hey!, it does the job.

And now, for the point of this story: once you get everything up and running, the most arduous task is to actually write the XML source for the site. All of those tags to open an close, etc. That's what led Ron to start The Adventures in the first place!

But I found an old tool that will do the job quite nicely, to my liking. This old tool is the good old jEdit. The thing I like about it is that the XML plugin helps you by closing the tags for you. You still need to open them, but then, all you need to type is </, and the good old jEdit will fill out the rest of the closing tag for you. Now, isn't that neat!

Ron doesn't like typing Control-P in Textpad (my old XML editor) to create new paragraphs all the time. That's two key strokes! So it might not be of any help to him. But I think I'll be going with jEdit from now on for my website editing. And: I'd rather Ron kept up those great Adventures of his, anyway!

Untill next time!


Copyright © 2002 Manuel Amago. All Rights Reserved.
Colophon

Hosted by www.Geocities.ws

1