[xsl] Advantages and disadvantages of XSLT

Subject: [xsl] Advantages and disadvantages of XSLT
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Feb 2025 12:27:55 -0000
Hi Folks,

I like XSLT. It is powerful at transforming small- to medium-sized XML
documents. A few lines of XSLT code can do what hundreds of lines of Java code
does. But XSLT does have disadvantages that one needs to be aware of (and I
often forget):

1. XSLT is best suited for input data that is XML-formatted. It can process
non-XML-formatted data, but XSLT is clunky at this; there are better languages
for that.

2. XSLT is good when the XML is not too large. Recall that an XSLT processor
builds an in-memory representation of the entire XML document; a large XML
document results in blowing up memory and you get an out-of-memory error--and
no amount of additional heap space helps. There is Streaming XSLT to deal with
large XML documents. It's okay. Not great. With large XML documents, it is
probably better to use SAX with a general-purpose programming language.

3. XSLT has a "limited set of data structures available in the XDM data
model." This means that it's difficult--well-nigh, impossible--to implement an
XSLT processor--or any processor--in XSLT. On November 3, 2024, Michael Kay
wrote: "I have written a number of papers over the years on the potential for
writing an XSLT processor in XSLT: see for example

https://www.saxonica.com/papers/xmlprague-2019mhk.pdf

The main difficulty in doing it is the limited set of data structures
available in the XDM data model. XSLT has always been designed as a
special-purpose programming language rather than a general-purpose language,
and writing compilers is not one of those special purposes."

What other advantages and disadvantages does XSLT have?

/Roger

Current Thread