Lets consider some Web application, which receives initial request from
users Web browser, creates a query to information provider, receives the data, makes
some intermediate processing of this data and as a final result creates an HTML page to
send it to our user. Pretty much a common task! Any e-business application doing it all
the time. Now lets say that the query to information provider should be an XML
document and the response is an XML document too. As a result well need to create an
HTML page, and the easiest way of doing it is an XSL transformation of our XML document.
So we have a flow of information stored in XML format. The most efficient way of creating
and processing XML documents is XSLT. If we will keep the information about XSLT file
inside XML file then well get the picture:
Following picture shows the process in details:
First XML formed from user HTTP request, and servlet path information used to define the
XSLT file. Output is an XML document, which contains the XML query. The query is submitted
to the information provider during second transformation using Java extension. Final
transformation outputs HTML document, which does not have any reference to the next XSLT
file, so process is finished and output goes to the PrintWriter.
This approach may be used in many e-business applications, which dealing with data stored
in XML format. The advantage is that logic of building XML documents is stored in XSL
files, and in many cases it is just a plain XML file with few XSL expressions. The
programming process becomes very easy and straightforward. The important part of the
development and future updates is that changing XSLT file does not required change of Java
code, so all replacements of XSLT files may be done on the fly, no shutdown of the Web
Server required.
Multi-X Engine
- Java servlet toolkit (MXE). Using MXE you can create powerful
transformer for multi XSL transformations. Just with few lines of
Java code you will have a servlet supported by all the power of
Apache's Xalan XSL transformer. In addition you will have
diagnostic tools, caching, support for Java extensions and an
ability to make multi XSL transformations.
Home |