Transforming Data

XSL Transformations

The xslTransform activity allows you to transform an XML document into a text document of any format. For example, you can transform the WebRowSet output from an SQL query into an HTML page to be viewed with a browser.

  1. An example of an XSLT document can be found here. This XSLT document transforms WebRowSet format into a HTML table. For the purposes of this example this file should be made available on your Tomcat server. Therefore, it should be copied into /webapps/ROOT/tutorial/. You can then deliver the file to the service using the deliverFromURL activity:
    String url = "http://localhost:8080/tutorial/transformRowSet.xsl";
    DeliverFromURL deliver = new DeliverFromURL( url );
  2. Create an SQL query and a WebRowSet whose output will be connected to the input to the transform activity.
    SQLQuery query = new SQLQuery("select * from littleblackbook where id<=1000");
    WebRowSet rowset = new WebRowSet( query.getOutput() );
  3. Construct an XSLTransform object (corresponding to the xslTransform activity) and set its XML input field to the output of your SQL query. The XSLT input is the XML file delivered from the above URL.
    XSLTransform transform = new XSLTransform();
    transform.setXMLInput( rowset.getOutput() );
    transform.setXSLTInput( deliver.getOutput() );
  4. Save the results to a file and view it with a browser.

See OGSA-DAI/examples/src/uk/org/ogsadai/examples/clienttoolkit/XSLTransformWithDelivery.java .

ZIP and GZIP Compression

The gzipCompression activity compresses data from another activity producing the data in GZIPped form and also metadata about the compression. It has one input (data to be compressed) and two outputs (GZIPped data and metadata).

The zipArchive activity archives data from other activities producing a ZIP archive and also metadata about the compression. It has one or more inputs and two outputs.