Processing XML with XSLT Add comment to Wiki View in Wiki Edit Wiki page Printable Version

Groovy's XML capabilities are powerful enough that you may not need to consider other alternatives such as XSLT. If you wish to use XSLT though, it isn't hard to do. Here we just added xalan and serializer jars from the Apache Xalan-J project to our CLASSPATH. Depending on your JVM version and other available libraries, you may need slightly different jars (or none at all). Once our path is set up, we can run the following script to convert an XML file into XHTML:

Here is the output (pretty-printed):

Depending on your environment (JVM, XSLT processor, operating system) you might be able to make use of XSLT directly from the command line instead of calling it from Java or Groovy. You can also call it from Ant using the xslt task.

 

Search

Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified