You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/03/09 19:32:25 UTC
Anakia (was: Re: Using XML/XSLT instead of Velocity?)
Introduction:
XSLT is simply a transformation language. It takes as input XML data and
outputs whatever you want to transform the XML into. Nothing special about
that. If you think of it as nothing more than a language for doing
transformations, then it will become apparent that you can implement
something like XSLT in other languages.
My opinion:
As a "language" I think that XSLT sucks. It is ugly, somewhat incomplete and
*very hard to use* and learn and maintaining it seems like it would be a
nightmare. For an example of complex XSLT usage, take a look at Sam Ruby's
Gump project (in jakarta-alexandria/proposals). He has done a very good job
of breaking things up into small pieces and it has a good design, but
following all the logic everywhere is a royal pain in the ass.
My problem:
I had a problem. I wanted to be able transform my XML files into another
format, but didn't want to have to use XSLT.
My solution:
Because I like Velocity, what I did was create a way to do the
transformations using Velocity Template Language and JDOM to make walking
the XML tree easy. That is what I call Anakia. This solution gets us about
90% of the way there. The missing piece is to emulate the way that XSLT
works with its procedural driven design. This is something that I have not
been able to quite figure out yet. I can do it by using a recursively nested
Velocimacro, but it still isn't the "right way". However, it is still
possible to use Anakia to do some pretty complex transformations and for the
most part solves the problem. Eventually, we will solve the remainder 10%.
Back to Turbine:
It should be possible to fairly easily embed the core of Anakia into a
Screen which is then used to do the transformation on the fly. Because
Anakia is already quite fast (XSLT is dog slow), the amount of caching and
compilation work that needs to go on in order to make it fast should be
pretty minimal. I would suggest simply caching the JDOM tree's of the most
frequently requested documents (ie: not all documents because that would eat
up all your memory on a huge site). That alone should probably be enough.
thanks,
<http://jakarta.apache.org/velocity/anakia.html>
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org