|
| |
Xalan-Java (named after a rare musical instrument) fully implements the W3C Recommendation XSL Transformations (XSLT) Version 1.0 and the
XML Path Language (XPath) Version 1.0. XSLT is the first part of the XSL stylesheet language for XML. It includes the XSL
Transformation vocabulary and XPath, a language for addressing parts of XML documents. For links to background materials,
discussion groups, frequently asked questions, and tutorials on XSLT, see Getting up
to speed with XSLT.
You use the XSLT language to compose XSL stylesheets. An XSL stylesheet contains instructions for
transforming XML documents from one document type into another document type (XML, HTML, or other). In structural
terms, an XSL stylesheet specifies the transformation of one tree of nodes (the XML input) into another tree of nodes
(the output or transformation result).
| The XSL stylesheet may generate and refer to cascading style sheets (CSS) as part of its output. |
In the following example, the foo.xsl stylesheet is used to transform foo.xml into foo.out:
foo.xml:
| | | | <?xml version="1.0"?>
<doc>Hello</doc> | | | | |
foo.xsl:
| | | | <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc">
<out><xsl:value-of select="."/></out>
</xsl:template>
</xsl:stylesheet> | | | | |
foo.out:
By default, Xalan-Java uses Xerces-Java, and it may be configured with system properties to work with other XML parsers (see Plugging in a Transformer and XML parser). The input may be submitted in the form of a stream of XML markup (from a URI, a character or byte stream, or another transformation), a SAX InputStream, or a DOM Node.
Xalan-Java performs the transformations specified in the XSL stylesheet and packages a sequence of SAX events that may be serialized to an output stream or writer, used to build a DOM tree, or forwarded as input to another transformation.
|
| |
- XSLT Namespace
- The XML namespace for XSLT. An XML namespace is a
collection of element and attribute names, identified by a Unique Resource Identifier (URI), which often takes the form of
a URL, but is really just a unique string, not a pointer to a web page. The XSLT namespace URI is
http://www.w3.org/1999/XSL/Transform. In each XSLT stylesheet, you must declare this namespace in the stylesheet element
tag and bind it to a local prefix. Like the XSLT specification, we always use xsl as the XSLT namespace prefix in our
descriptions and examples, although you are free to bind any prefix to this namespace.
- XSL Instruction
- Any tag associated with the XSLT namespace.
- Template
- An element, usually with child elements, that specifies a "rule" or set of
instructions to perform when a particular kind of node is encountered in the source tree.
- XSL Template Instruction
- Any tag that occurs inside an xsl:template element and is associated with the XSLT namespace.
- Source Tree
- The XML tree input to the XSL process.
- Result Tree
- The tree that is output by the XSL process.
- Match Pattern
- The part of a template that defines the kind(s) of nodes to which the template applies.
For more definitions of XSLT terminology, see Dave Pawson's
XSLT Terminology
Clarification and the Glossary in Michael Kay's
XSLT Programmer's Reference.
|
|
|