2009-04-04

XSLT 1.0 implemented in Common Lisp

Newly released: Xuriella XSLT, the first implementation of XSLT written entirely in Common Lisp.

Based on Plexippus XPath, Xuriella is an implementation of XSLT 1.0, written by Ivan Shvedunov and me.

Xuriella is quite complete and correct -- we run the official testsuite, with more than 95% of tests currently passing.

Extensions

One advantage of a pure-Lisp implementation is that extension elements (as well as XPath extensions) can be defined easily.

That's a huge plus because XSLT itself is a very specialized programming language -- it excels at XML/HTML generation and transformation only. Being able to write custom extensions in Lisp helps with any non-XML-ish parts of the task which XSLT itself might not handle conveniently.

Documentation

If you just want to try applying stylesheets, there are only two functions you need to know about: parse-stylesheet and apply-stylesheet.

For details about these functions (and all others, including those for extensions), refer to the API documentation.

Example

The example uses Hunchentoot and Xuriella with XSLT as a template language in a simple directory listing request.

4 comments:

Peter Housel said...

Bravo!

Walter GR said...

Which version of Hunchentoot does the example require?

R. Mattes said...

guess the example should mention that with newer versions of
hunchentoot the correct startup code would be:

(hunchentoot:start (make-instance 'hunchentoot:acceptor :port 4242))

Anonymous said...

This is pretty cool. Is there a simple way to apply the transformation rules to a lisp s-expr and produce a new s-expr. I am wondering if this would be useful to write code transformation macros/functions. I can see some benefits of using an xslt-like engine vs traditional macro-writing-style to generate code. I know lisp and xml are not the same ... but I was just hoping that you implemented some intermediate-layer functionalty to transform s-expr and not xml?

Anyways, thanks. It is great to have an xslt in common lisp.