Introduction
This tutorial is for developers who want to combine XSLT with other languages such as Scalable Vector Graphics and Java technology. It details the creation of an SVG image that represents a view of three-dimensional data from an arbitrary viewpoint.
The tutorial assumes that you are familiar with the basics of XML and XSL Transformations. It covers some SVG and a tiny bit of HTML, but no prior knowledge is assumed. It also uses Java code to perform the transformation and as an extension to the stylesheet, but the concepts hold true for any environment.
The previous parts of this series (see Resources) followed the exploits of the fictional MindMap Research Team and their work in using XSLT in data analysis. In this installment, the team decides that much of their data could be better understood if investigators were able to look at it three dimensionally. To this end, they create a proof-of-concept that uses XSLT to create a Scalable Vector Graphics (SVG) image out of the data.
This tutorial touches on several XML-related standards. In the course of working through it you will:
- Create a basic SVG image
- Use XSLT to create an SVG file
- Pass parameters to a transformation
- Call a Java class and method from within XSLT
- Create a simple HTML form
- Output the results of a transformation to the browser using a Java servlet
You'll also learn how to project three-dimensional coordinates onto a two-dimensional plane, but we promise to keep the math as painless as possible.
To follow along with this tutorial, you'll need to have the following tools installed and working.
For the command-line version, you will need:
- Java 2 Standard Edition 1.4 or another XSLT engine: As the title implies, this tutorial involves performing XSLT transformations. The sample code uses Java 1.4 (available at http://java.sun.com/j2se/1.4.2/download.html), which has XSLT built in. If you're using Java 1.3 or earlier, you can download the Xalan XSLT processor, available at http://xml.apache.org/xalan-j/index.html. You also have the option to use another language and another engine, but you'll have to adapt those sections of code accordingly.
- An SVG reader: You can download the Adobe SVG Reader from http://www.adobe.com/svg/viewer/install/ to give your browser the ability to view the SVG created here. The Mozilla browser (http://www.mozilla.org) has SVG support built into it, but at the time of this writing, support is turned off by default.
- An XSLT development environment, and a Java development environment: You can develop Java and XSLT using a text editor, but you will find it easier if you use an IDE such as WebSphere(R) Studio Application Developer. You can download a trial version at http://www.ibm.com/developerworks/websphere/downloads/wsad/.
For the browser-based version, you will also need:
- A servlet engine: This tutorial demonstrates an XSLT transformation in a Java servlet, so you'll need a servlet engine such as Tomcat, available from http://jakarta.apache.org/tomcat/index.html. If you're using WebSphere Studio Application Developer, however, you can skip this step and use the WebSphere Test Environment.



