XSLTC - an XSLT compiler

Version 0.4

Portions (c) 2000 Olivier Gerardin <ogerardin@vo.lu>

This is XSLTC, an XSLT stylesheet compiler, based on TransforMiix.

XSLTC takes as input an XSLT stylesheet, and generates C++ code. The executable that is generated from this code is expected to have the same behaviour as the source stylesheet when run through an XSLT processor, only much faster.

XSLTC is still at an early stage; however, it works, it implements all the functionalities present in TransforMiix, and it's up to 70% faster. Optimization is the next step.

This work is not related to Sun's XSLT Compiler.

Changes from version 0.3

Obtaining XSLTC

XSLTC is available in C++ source form

Older versions:

Building XSLTC

The Makefiles in XSLTC try to apply some of the techniques described in Peter Miller's  very interesting paper "Recursive Make Considered Harmful" (http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html)

GNU-make is required. Currently, the build process is known to work with:

First you should check the main Makefile, namely src/Makefile, for settings that are best suited for your configuration. Here are the most useful: Then you should edit the file src/depend.sh to make sure it is correctly configured.

Next try building XSLTC by simply typing:

 $ make

After a successful compilation, you should have an executable named 'xsltc' in the bin directory, and a library named 'libxsltc.a' in the lib directory.

If you manage to compile XSLTC on another platform, please let me know so that I can update the Makefiles and/or doc. If by chance you happen to be an autoconf specialist willing to devote some time to making XSLTC use autoconf, feel free to do so...

Compiling stylesheets

Suppose you have a stylesheet named foo.xsl, and you want to compile it. First you must generate the C++ code:
 # xsltc foo.xsl Foo

This creates two files, Foo.h which contains the Foo class interface, and Foo.cpp which contains the actual class code.

Next you must C++ compile Foo.cpp. The typical command is something like:

 # CC Foo.cpp -I${XSLTCDIR}/include -L${XSLTCDIR}/lib -lxsltc -o foo

where ${XSLTCDIR} is the XSLT root directory. Your actual command might be different, check your C++ compiler doc.

Using compiled stylesheets

The executable compiled from XSLTC-generated code understands the following syntax:
 xxxxx [-i xml-file] [-o output-file]

You may use '-' in place of xml-file or output-file to specify standard input/output, which is also the default if the option is omitted.


 # foo -i testdata.xml -o result.xml


XSLTC is licensed under the Mozilla Public Licence 1.1

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The complete text of the license is available here



Constructive criticism is always welcome, as well as bug reports and fixes, ideas for improvement, and personal gifts.
I don't plan to set up a CVS server for XSLTC in the near future, so send any patches to me and I'll try to integrate them in the next release.

Olivier Gerardin <ogerardin@vo.lu>