Home
TOC Index |
Introducing XSLT and XPath
The XML Stylesheet Language (XSL) has three major subcomponents:
- The "flow object" standard. By far the largest subcomponent, this standard gives mechanisms for describing font sizes, page layouts, and how information "flows" from one page to another. This subcomponent is not covered by JAXP, nor is it included in this tutorial.
- This is the transformation language, which lets you define a transformation from XML into some other format. For example, you might use XSLT to produce HTML, or a different XML structure. You could even use it to produce plain text or to put the information in some other document format. (And as you'll see in Generating XML from an Arbitrary Data Structure, a clever application can press it into service to manipulate non-XML data, as well.)
- At bottom, XSLT is a language that lets you specify what sorts of things to do when a particular element is encountered. But to write a program for different parts of an XML data structure, you need to be able to specify the part of the structure you are talking about at any given time. XPath is that specification language. It is an addressing mechanism that lets you specify a path to an element so that, for example,
<article><title>
can be distinguished from<person><title>
. That way, you can describe different kinds of translations for the different<title>
elements.The remainder of this section describes the packages that make up the JAXP Transformation APIs. It then discusses the factory configuration parameters you use to select the Xalan or XSLTC transformation engine.
The JAXP Transformation Packages
Here is a description of the packages that make up the JAXP Transformation APIs:
- This package defines the factory class you use to get a
Transformer
object. You then configure the transformer with input (Source) and output (Result) objects, and invoke itstransform()
method to make the transformation happen. The source and result objects are created using classes from one of the other three packages.
- (Whether you get the Xalan interpreting transformer or the XSLTC compiling transformer is determined by factory configuration settings, which will be discussed momentarily.)
- Defines the
DOMSource
andDOMResult
classes that let you use a DOM as an input to or output from a transformation.
Home
TOC Index |
This tutorial contains information on the 1.0 version of the Java Web Services Developer Pack.
All of the material in The Java Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.