XML Europe 2001 logo21-25 May 2001
Internationales Congress Centrum (ICC)
Berlin, Germany

Developing with XSLT and Java™

Antony Scott <antony.scott@rivcom.com>
 PDF version    Latest version   

ABSTRACT

This presentation shows how a self-contained and self-describing application can be developed entirely in using XML and XSLT, allowing implementation in any suitable platform. A Java-driven implementation of the application is demonstrated and discussed.

Table of Contents

1. Introduction

In the past couple of years, XSLT has been widely adopted, both as a tool for producing HTML web sites, and more generally as a component in XML applications. As a key piece in the jigsaw of the XML family of standards, it has allowed developers to specify the processing of XML input independently of platform, operating system or processor. However, its scope remains limited to taking XML as input, and outputting XML, text or HTML. A developer wishing to implement XSLT-based applications in environments wider than the controlled sphere of the prototype or proof of concept may have to tackle some practical issues which XSLT on its own does not address. For example,

This presentation will look at approaches to these issues in the context of the Java environment, and demonstrated some of the practicalities of using the two technologies side by side.

2. Why XSLT and Java?

As a well supported, platform-independent programming language, Java is already widely used both to develop applications, and to deliver applications applications on the web. It has embraced XML to a considerable extent, and both the human and programming infrastructure which Java needs in order to be able to work with XML is well developed. JAXP™ (the Java API for XML Parsing) includes interfaces for both SAX (Simple API for XML) and DOM (Document Object Model), allowing processing and manipulation of XML documents.

XML and XSLT, on the other hand, provide a standard for data storage and processing which, as with Java, has been widely adopted both in the web sphere and elsewhere. Its underlying simplicity, platform and vendor independence and standards-based provenance have seen its use mushrooming in recent years.

What might be the attractions of XSLT to the Java developer, and vice versa?

To the Java developer, XSLT provides a mechanism for extracting from the body of Java code anything which is concerned with rule-based processing of XML input, and placing it in discrete, non-Java components. This has the following advantages:

To the XSLT developer, Java provides a platform in which to deploy applications, and a tool for doing the things which XSLT cannot do. For example:

3. Approaches to Java/XSLT Development

The demonstration which concludes this presentation shows the components of a possible approach to a Java/XSLT implementation strategy. The application shown is essentially XSLT-driven, and has been designed to be self-contained and hence portable. Its purpose is to allow forms to be specified and created independently of the form user's interface device and of the user's language, and to create XML output data based on the user's input which conforms to any required DTD. As much as possible of the application code has been written using XML and XSLT, including:

Java components have been used principally to provide the process control, and data interchange between the HTML interface and the XML data structures.

3.1. XML and XSLT Components

The principal XML components of the application are:

3.2. Java Components

The Java components used in the application are not intended as an optimal application of Java technology, but as a demonstration of different ways in which Java can be used to support XML applications. They are as follows:

4. Demonstration: An XSLT / Java Application

The demonstration of the application will:

5. Summary: What are the Benefits?

Combining XSLT and Java allows the developer to:

These benefits have already attracted huge interest in the Java community, opening the way for widespread incorporation of XSLT components into Java applications. Conversely, XML and XSLT developers can take advantage of this interest, and of the availability of Java components, to make their applications capable of easy implementation in Java environments.

Biography

Antony Scott
RivCom
Swindon
United Kingdom
Email: antony.scott@rivcom.com Web: www.rivcom.com

Antony Scott - Antony Scott is Director of Professional Services at RivCom, a consultancy and services company specializing in helping businesses adopt XML technologies to meet their information management and distribution needs. RivCom has been involved in the development of the XML family of standards as active members of W3C (including the XSL Working Group), OASIS; as joint project leader of the STEP/SGML harmonisation initiative under ISO; as editor of the NewsML standard; and as software development lead in the European XML/EDI Pilot Project. Antony has been developing XML applications at RivCom for the past three years, and has many years experience in writing and publishing structured documentation. During 1999, he was a co-developer on the European XML/EDI Pilot Project to develop good practice guidelines and prototype applications to show how the XML family of standards can be used to develop the next generation of EDI applications. He has spoken at a number of industry conferences over the past three years, and has run tutorials in XML and XSLT.