Alex's blog

Version 4.1: Going XSLT-only

Published on

I decided to redesign my static site generator, XSite, because the way it worked previously was kind of limiting. So I threw out XSlots, my custom templating language, and switched to using XSLT for everything. My entire site is now generated with XSLT.

In order to do this, I ended up implementing all of XSlots' unique features as XPath functions (and to do that, I added support for XPath extension functions and XSLT extension elements (so far unused) to XSite's plugin system). As a consequence of having done this, I was able to implement a couple of things I've wanted to do for a while: Previews on the blog index page, and summaries and full content in the Atom feed.

There was a lot of back-and-forth necessary to get all of this working, and most of it doesn't show up in the Git history; most of the commits involved in this hide at least two or three things that didn't work.

While I was making changes to the templates, I also added a bunch of microformats2 markup, specifically h-feed on the blog index, h-entry on blog posts themselves (including for the summary entries in the index), and h-cite on mentions. I want to add a p-author h-card for myself on blog posts, but I can do that later.

One interesting possibility with XSLT is that, because it can do much more complex processing, it would be feasible to actually make the input documents full HTML documents (with <head> elements and such), then pick them apart and put them back together with template content. I don't know if that's actually a good idea, but it seems interesting.

Anyway, I'm glad to be away from the world of juggling what was basically two different templating languages, each with separate capabilities. I am thinking about the idea of bringing back the XSlots language, compiled to XSLT, for conciseness, but not too seriously; I'm personally fine with verbosity, so unless other people who aren't complain, I probably won't go the the effort of building something I probably won't use much.

This is a major engineering change to the site, but the content and structure are basically the same, so: Version 4.1.

Tagged: