[xsl] XSLT compiler and syntax extensions

Subject: [xsl] XSLT compiler and syntax extensions
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Nov 2010 19:45:02 -0500
The recent mention of an XSLT optimizer reminded me of a project I've
been working on, here and there, for the last year or two.  It's an
XSLT compiler, by which I mean a pure XSLT 1.0 stylesheet (using no
extensions) that can take a stylesheet using certain XSLT 2.0 features
(and some other extensions) and "compile" it into a pure XSLT 1.0
stylesheet.  Both the compiler and its output should be able to run in
any XSLT 1.0 compliant engine.

My motivation is twofold.  First, I think one of the reasons that XSLT
2.0 hasn't gained more momentum is that there are still plenty of
environments where it just isn't an option, due to architectural
choices, policies regarding software vendor choices, or other reasons.
 Restrictive as these environments are, they may still be able to
accommodate a tool that requires no installation of new components
other than dropping an additional XSLT into the process to be run
whenever there are stylesheet changes.  If this enables the use of at
least some XSLT 2.0 (or newer!) features, additional momentum might be
built to encourage other vendors to add XSLT 2.0 support to their
engines.

The second motivation is to have a platform on which to experiment
with some types of extensions, so far mostly in the "syntax sugar"
category.  For instance, I've experimented with an extension-element
equivalent to XSLT 2.0's "stylesheet functions" and some enhancements
to XSLT instructions such as, a very simple example, replacing the
common XSLT 1.0 case of:

    <xsl:if test="condition"><xsl:attribute name="att"><xsl:value-of
select="concat('abc', value, 'def')"/></xsl:attribute></xsl:if>

with (some of this is supported in XSLT 2.0 - some of it isn't, but
maybe could be in XSLT 2.1/3.0?):

    <ext:attribute test="condition" name="att" select="concat('abc',
value, 'def')"/>

or even:

    <ext:attribute test="condition" name="att" value="abc{value}def"/>

I've implemented a variety of other extensions, with plans for more,
and have ideas for a variety of directions this tool could take.

So, the question is, would anyone here be interested in a tool like
this?  What types of features would you like to see it include?  If
this were to be turned into an open project, would anyone be
interested in collaborating on its further development?  I'm
interested in any type of feedback, positive, negative or otherwise.

-Brandon :)

Current Thread