XML technologies / XSLT / Java and XSLT / XSLT processing with Java

(Excerpt from “Java und XSLT” by Eric M. Burke)

Many XSLT processors are written in Java, so they can also be called directly from a Java application or servlet. Embedding a processor in a Java application generally requires only adding one or two JAR files to CLASSPATH and calling the appropriate methods. This chapter shows how to do that and presents many further programming techniques.

When an XSLT processor such as Xalan is called from the command line, it expects the locations of an XML file and an XSLT stylesheet as parameters. After an XML parser such as Xerces or Crimson loads both files into memory, the transformation runs. Calling the XSLT processor programmatically removes the restriction to static files: you can send it a precompiled stylesheet and a dynamically generated DOM tree, or even submit SAX events as processor input. Avoiding unnecessary parsing is an important goal and can dramatically improve performance.

This chapter covers Java and XSLT programming techniques for standalone applications and servlets, focusing on Sun’s Java API for XML Processing (JAXP). In Servlet basics and XSLT we will apply these techniques to servlets and examine concurrency, server deployment and performance.

   

   

 

 

 

back to top