[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Why are there no XSLT processors implemented in XSLT?

Subject: Re: [xsl] Why are there no XSLT processors implemented in XSLT?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 01 May 2012 13:54:21 +0100

Back in 2007 I wrote a paper on writing one part of an XSLT processor, namely the optimizer, in XSLT: see


The main obstacle turned out to be that XSLT isn't good at doing "local rewrites", where most of the tree stays the same but a small part changes. It's possible that an implementation strategy based on creating deltas could solve that, and it might be generally useful. But I think one might need to modify some notions like node identity to make it really viable.

The other challenge is that while XSLT is good at doing XML, it's not all that good at a lot of the other jobs needed in a compiler, like parsing XPath. You can do it, but it's not the most natural tool for the job, and it's not the job that the tool was designed for.

Remember that sentence right at the start of the XSLT 1.0 spec:

"XSLT is not intended as a completely general-purpose XML transformation language. Rather it is designed primarily for the kinds of transformations that are needed when XSLT is used as part of XSL"

I've never been comfortable with that (which is why it's not there in 2.0). I think it should be a general-purpose XML transformation language. But I don't think it should be a general-purpose programming language. What actually surprises me is how people have used it well outside its original intended application area, an example being creating programs for machine tools from the output of a CAD package.

Michael Kay

On 01/05/2012 12:49, Costello, Roger L. wrote:
Hi Folks,

I will take the following as an axiom:

Programs written to process XML should be implemented in XSLT.

An XSLT processor is a program that processes XML.

Therefore an XSLT processor should be implemented in XSLT. (As an analogy, many C compilers are implemented in C.)

However, there are no XSLT processors implemented in XSLT.

Instead, XSLT processors are implemented in languages such as Java.

The implication of this state of affairs is this: "For real, manly XML processing don't use XSLT; instead, use Java."

Why are there no XSLT processors implemented in XSLT?


Current Thread