Ant Fan

Ant is rapidly becoming my favourite Java and XML processing tool. It features heavily in my next tutorial for IBM developerWorks (working title “Code Generation using XSLT”) which describes how to use XSLT as a code generation tool using an Ant based build framework. Basically using Ant + Jalopy takes all the hard work out of handling multi-step transformations that have to result in nice clean Java code.

The tutorial also discusses XSLT meta-stylesheets which is a pretty powerful technique that I’ve successfully used when building XML/XSLT web page templating systems. Basically this involves: defining an XML template language, a meta-stylesheet to process that language and generate the final XSLT stylesheet to apply to your data. This avoids the limitations of a single step transformation. E.g. the need to carry around extra context as exhibited in Example 10 in this article “Template Languages in XSLT“.
I’ve previously written up how to use meta-stylesheets in Cocoon.
You can also do a lot of XML pipelining with Ant as this excellent article illustrates. The XSLT support also came in useful recently during a migration from Weblogic to JBoss. I was able to whip up some XSLT stylesheets that allowed the automatic conversion of our Weblogic deployment descriptors into the JBoss equivalents. We did this originally because it was easier than going through an changing all the descriptors manually as we were trying to maintain support for both platforms.
Whilst tinkering with Spooky (really must upload the final working version) it finally dawned on me that Ant provides a good way to write cross-platform scripts in general, not just build scripts. The installation is easy, and there’s more than enough functionality there to handle any task you care to think of. Wonder if anyone has produced an application installer using Ant?
Anyway, tip of the hat to the Ant developers. Nice one.

One thought on “Ant Fan

Comments are closed.