18 November 2011

Even Umbraco agree: XSLT is not an interface building tool

It seems that Umbraco are finally dropping XSLT on the next release of their CMS. About time too. As anybody who has spent hard time debugging a mess of templates will tell you – XSLT is not an interface building tool.

Long ago when the web was young

Ten years ago XSLT was a respectable choice for building web interfaces. Data was increasingly represented in XML documents, browsers were rendering interfaces based on XHTML so it made sense to use XSLT to provide the means for transforming data into a UI.

It carried a number of advantages over the tools being offered by Microsoft, particularly to developers who wanted full control over the mark-up that was being generated. XSLT is platform agnostic, offered easier unit testing, supported MVC-based patterns and could be used to deliver better quality, standards-compliant mark-up.

This led to a proliferation of systems that handed the interface processing to XSLT templates. It offered a certain architectural simplicity and saved you from having to write a load of server-side code for every page. A number of web CMS platforms adopted it as a template building tool, particularly those that relied on XML-based content repositories.

However, XSLT has a number of drawbacks that make it difficult to work with over the long term. Anybody who has laboured on a system that is drowning in multiple XSLT templates that are impossible to debug will tell you – it’s not a terribly elegant UI tool.

The right tool in the wrong context

XSLT is the classic example of a technology solution that makes every problem look like a nail. It is a great tool for tweaking XML data from one format into another. However, it lacks the complex program flow constructs that you need to deliver modern interface logic. It just is not expressive enough to handle today’s more engaging and complex interfaces.

Websites are evolving and their taxonomies are more fluid than the strict, hierarchical sites of ten years ago.  Web site developers have to manage a lot more complexity than was the case ten years ago. Pages have become more complex and featuring more content and interactive functionality. It becomes ever more difficult to render this kind of content using something as limited as XSLT.

If you work with .NET it’s also important to realise which way the train is moving. Microsoft have never been great supporters of XSLT and this is shown in their reluctance to support XSLT 2.0. However, they have developed superior interface building tools that address many of the issues that were used to justify using XSLT such as testability and standards compliance.

Ten years ago you could be excused for balking at using embryonic web forms along with the poor mark-up they produced and their design shortcomings. However, the options available in .NET 4.0 make the batch-based processing of XSLT look pretty last century.

Filed under ASP.NET, CMS.