Java and Extensible Stylesheet Language Transformations (XSLT) are very different
technologies that complement one another, rather than compete. Java's strengths are portability,
its vast collection of standard libraries, and widespread acceptance by most companies. One
weakness of Java, however, is in its ability to process text. For instance, Java may not be the
best technology for merely converting XML files into another format such as XHTML or Wireless
Markup Language (WML). Using Java for such a task requires skilled programmers who
understand APIs such as DOM, SAX, or JDOM. For web sites in particular, it is desirable to
simplify the page generation process so nonprogrammers can participate.
XSLT is explicitly designed for XML transformations. With XSLT, XML data can be transformed
into any other text format, including HTML, XHTML, WML, and even unexpected formats such as
Java source code. In terms of complexity and sophistication, XSLT is harder than HTML but
easier than Java. This means that page authors can probably learn how to use XSLT successfully
but will require assistance from programmers as pages are developed.
XSLT processors are required to interpret and execute the instructions found in XSLT
stylesheets. Many of these processors are written in Java, making Java an excellent choice for
applications that must interoperate with XML and XSLT. For web sites that utilize XSLT, Java
servlets and EJBs are still required to intercept client requests, fetch data from databases, and
implement business logic. XSLT may be used to generate each of the XHTML web pages, but
this cannot be done without a language like Java acting as the coordinator.
This book explains the most important concepts behind the XSLT markup language but is not a
comprehensive reference on that subject. Instead, the focus is on interoperability with Java, with
particular emphasis on servlets and web applications. Every concept is backed by working
examples, all of which work on widely available, free tools.