56 The XML Files: Develo pment of XML/XSL A pplications Using WebS phere Studio
3.1 XML applications
Tod a ys organizations rapid movement towards e-business brings new demands
on defining flexible systems architectures. Systems need to be powerful,
scalable, robust, and most of all, capable of meeting new business requirements.
With that in mind, applications often need to be able to support multiple client
types, all with different capabilities. The dominant client type for Web applications
is currently the desktop browser, but that will not last forever. Pervasive
Computing is rapidly evolving, introducing the use of cellular phones, PDAs, and
other front-end devices, all with different XML capabilities. So as time passes by,
each application gets a much broader audience, using a variety of new devices
for sending and receiving information.
The most recent edition of any browser that might have XML support cannot be a
prerequisite for using an XML based application. We also do not want to send the
same XML document to every client, because som e users of the application
might be authorized to see more data than ot hers. We must have the ability to
process XML documents and generate the kind of response to the client that is
adequate for the client type.
Extensible Stylesheet Language Transformations (XSLT) is designed to
transform XML data into some other XML form. An XSLT processor, such as
Apaches Xalan, performs transformations using one or more XSLT stylesheets,
which are also XML documents. Typically, in an XSLT- and Java-based Web
application, XML data is generated dynamically based on database queries.
Although some databases can export data directly as XML, you will often write
custom Java code to extract data using JDBC and convert it into XML. In order to
display this XML data on most browsers, it must first be converted into HTML.
The XML data is fed into the processor as one input, and as XSLT stylesheet is
provided as a second input. The output is then sent directly to the Web browser
as a stream of HTML. The XSLT stylesheet produces HTML formatting
instructions, while the XML provides raw data.
So in conclusion, at the heart of every XML application is an XML Processor that
parses an XML document, so that the docume nt elements can be retrieved and
transformed into a presentation understood by the target client. The other
responsibility of the parser is to check the syntax and struct ure of the XML
document. The focus of this chapter is on the Xalan Java processor with all the
aspects involved in processing an XML document.