← Back to context

Comment by gdwatson

13 hours ago

The first few times you use it, XSLT is insane. But once something clicks, you figure out the kinds of things it’s good for.

I am not really a functional programming guy. But XSLT is a really cool application of functional programming for data munging, and I wouldn’t have believed it if I hadn’t used it enough for it to click.

XSLT's matching rules allow a 'push' style of transform that's really neat. But you can actually do that with any programming language such as Javascript.

Right. I didn't use it much on the client side so I am not feeling this particular loss so keenly.

But server side, many years ago I built an entire CMS with pretty arbitrary markup regions that a designer could declare (divs/TDs/spans with custom attributes basically) in XSLT (Sablotron!) with the Perl binding and a customised build of HTML Tidy, wrapped up in an Apache RewriteRule.

So designers could do their thing with dreamweaver or golive, pretty arbitrarily mark up an area that they wanted to be customisable, and my CMS would show edit markers in those locations that popped up a database-backed textarea in a popup.

What started off really simple ended up using Sablotron's URL schemes to allow a main HTML file to be a master template for sub-page templates, merge in some dynamic functionality etc.

And the thing would either work or it wouldn't (if the HTML couldn't be tidied, which was easy enough to catch).

The Perl around the outside changed very rarely; the XSLT stylesheet was fast and evolved quite a lot.