What is XSLT and is it still relevant in a website context in 2024

Let’s explore concisely what XSLT is, why we should be interested and whether it has a place in website context in 2024 — or is it historic?

XSLT for the Modern Web
6 min readApr 27, 2024
XSLT for the Modern Web — Re-visiting XSLT in the modern website landscape

What is XSLT?

Let’s start with XSL. XSL (eXtensible Stylesheet Language) is a XML-based stylesheet language to present, style and extract fragments of XML documents.

XSLT is defined as XSL with a Transformation ability (i.e XSL + T = XSLT). This means it builds upon XSL’s abilities and can be used to extract and transform fragments of one XML document into another XML vocabulary or to pick out selected context from an XML document and transform into a HTML output. It can also be used more creatively to transform fragments of XML in a non-XML based syntax, such as CSV or plain text or almost any textual based file type you can think of! In this sense, XSLT is very versatile.

Isn’t XSLT really old?

The original XSL Transformations (XSLT) Version 1.0 XSLT specification is now over 20 years old, however pieces of software built around XSLT are still remain relevant technology, though XSLT itself is a language that is not likely to generate a huge new following in 2024.

It is worthwhile being reflective upon how some aspects of web technology are evolutionary can make an active resurgence at a later date — the humble .gif image format which once was used to excess on 90’s MySpace profiles, has since become relevant since the dawn of social media and internet memes, equally Javascript was also once considered a ‘toy’ language and early uses were widely seen as gimmick or a source of irritation, but now it has developed into one of the top programming languages to learn and is used for both simple personal websites and powering large-scale application-style websites with millions of users — both frontend and server-side.

The use of XSLT within websites declined due to other tools and simpler, more lightweight, formats for data exchange becoming more popular, in particular the JSON (Javascript Object Notation) format, which provides a more concise object notation to exchange data.

There are some areas though where XML and XSLT remains relevant to use where textual data is involved or the source material used is by default encoded in, or lends itself to, an XML first format — one key area is Humanities computing.

Some interesting Humanities XML files that can be used to experiment with XSLT can be found via the Perseus Digital Library website.

It is worthwhile considering that when the use of XSLT on the web declined, the landscape of the internet was very different that in it now.

Some factors to put this point in context:

Faster internet connections were not available — the ‘overhead’ of downloading an XML file of even a few MB in filesize could have been a blocker to use.

Today, files with a filesize of hundreds of MB can be downloaded very quickly.

Computers were far slower, expensive, and with limited memory — comparably, today fast computing is prevalent and memory available within web browsers has grown significantly —for example, it is now possible to run entire applications within the web browser, even computationally expensive 3D graphics can be provided within a webpage using newer API’s such as WebGL.

Whilst XSLT has declined in popularity, ironically, the faster computers of today are more suited to running XSLT transformations than before. Does this mean that the use of XSLT in a website context now needs a rethink?

Web browsers had limited functionality and were synchronous in operation — comparably, there is now a strong focus on asynchronous techniques in website development — this is not just due to ‘Ajax’ techniques (i.e uses of XMLHttpRequest) but more newer features to Javascript such as Promises, and the Await, Async functionality.

These features make dealing with loading of external resources easier and larger filesize resources, such as XML documents and XSLT templates, much easier. Dealing with the loading of files — potentially multiple files at the same time — becomes far easier with asynchronous approaches. What could this mean for XSLT in the modern web?

Javascript API’s were limited and Javascript itself was emerging as a language — We now have a host of new Javascript API’s that can can be used to support use of XSLT in the browser and in website development — Fetch API, FileReader API, Drag and Drop API, Web Workers, Service Workers and IndexedDB.

Many of these API’s could support and augment XSLT transformation abilities in the browser and lead to richer XSLT generated user experiences. Although Web and Service workers do not allow access to DOM manipulation, they provide a way to separate computationally expensive transformations from other elements of the webpage.

Why is XSLT interesting?

XSLT is also an interesting language to learn in 2024 since it is template-based and thereby provides a different way to traverse XML documents than via XML Document Object Model (DOM) or SAX methods. It is also very different from the scripting languages that dominate the website landscape currently such as Python and Javascript.

XSLT is generally used in a ‘pull’ or ‘push’ fashion — XSLT templates can both ‘push’ XML fragments into a transformation, matching elements, but XSLT can also pull in content into specific sections of a XML. This gives the developer of XSLT stylesheets different ways to develop their transformation approach and a mixture of ‘push’ and ‘pull’ approaches can be taken within one XSLT stylesheet.

The value of learning XSLT is in part that it will make you think in a different way to scripting languages about how to get the output you want from a transformation — and so this then facilitates taking a different approach to problem solving. It is also interlaced with an ecosystem other XML related technologies — in particular XSLT would not be possible without XPath which provides a path-based syntax to select specific elements of XML documents.

A downside of XSLT however is that the template structure can become very verbose to write and verbose to read and digest — but that isn’t necessarily always a negative point — the use of templates means XSLT can be broken down into discreet sections and the transformation made more manageable.

XSLT Standards

There are 3 standard versions of the XSLT specification:

XSL Transformations (XSLT) Version 1.0 W3C Recommendation 16 November 1999

XSL Transformations (XSLT) Version 2.0 (Second Edition) W3C Recommendation 30 March 2021 (Amended by W3C)

XSL Transformations (XSLT) Version 3.0 W3C Recommendation 8 June 2017

If you are using XSLT in 2024 you probably are using it within a legacy application which you need to support or are using XSLT to generate separate files from one XML document via a software application.

What is the current level of support in web browsers?

Current browsers support XSLT 1.0 with no clear plan to support higher features.

XSLT 1.0 will give lots of basic functionality for relatively simple XSLT transformations — but you won’t be able to use any features in XSLT 2.0 or 3.0. A summary search engine peruse will likely confirm that browsers are not intending to support anything further than 1.0.

When using XSLT in web-browsers it is then sensible to assume XSLT 1.0 support is available as a minimum. XSLT is available either through the browser itself or via the Javascript XSLTProcessor API.

To apply the transformation in the browser, it is necessary for the XML and XSLT files to be served by a server.

My articles so far on XSLT for the Modern Web:

--

--

XSLT for the Modern Web

Re-learning XSLT in the context of the Modern Web - occassional writer, reader, Digital Humanities enthusiast All text is 100% non-AI - learn, explore, reuse