blob: cd389938499245bef7811d117a505d62ff30163e [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ASF: Getting Started</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="resources/apache-xalan.css" />
</head>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<body>
<div id="title">
<table class="HdrTitle">
<tbody>
<tr>
<th rowspan="2">
<a href="../index.html">
<img alt="Trademark Logo" src="resources/XalanJ-Logo-tm.png" width="190" height="90" />
</a>
</th>
<th text-align="center" width="75%">
<a href="index.html">Xalan XSL Transformer User's Guide</a>
</th>
</tr>
<tr>
<td valign="middle">Getting Started</td>
</tr>
</tbody>
</table>
<table class="HdrButtons" align="center" border="1">
<tbody>
<tr>
<td>
<a href="http://www.apache.org">Apache Foundation</a>
</td>
<td>
<a href="http://xalan.apache.org">Xalan Project</a>
</td>
<td>
<a href="http://xerces.apache.org">Xerces Project</a>
</td>
<td>
<a href="http://www.w3.org/TR">Web Consortium</a>
</td>
<td>
<a href="http://www.oasis-open.org/standards">Oasis Open</a>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navLeft">
<ul>
<li>
<a href="resources.html">Resources</a>
<br />
</li>
<li>
<a href="http://xalan.apache.org/index.html">Home</a>
</li></ul><hr /><ul>
<li>
<a href="index.html">Xalan-J 2.7.2</a>
</li>
<li>
<a href="charter.html">Charter</a>
</li></ul><hr /><ul>
<li>
<a href="whatsnew.html">What's New</a>
</li>
<li>
<a href="readme.html">Release Notes</a>
</li></ul><hr /><ul>
<li>
<a href="overview.html">Overview</a>
</li>
<li>
<a href="downloads.html">Download/Build</a>
</li>
<li>Getting Started<br />
</li>
<li>
<a href="xsltc_usage.html">Using XSLTC</a>
</li></ul><hr /><ul>
<li>
<a href="faq.html">FAQs</a>
</li></ul><hr /><ul>
<li>
<a href="samples.html">Sample Apps</a>
</li>
<li>
<a href="commandline.html">Command Line</a>
</li></ul><hr /><ul>
<li>
<a href="features.html">Features</a>
</li>
<li>
<a href="trax.html">Transform API</a>
</li>
<li>
<a href="xpath_apis.html">XPath API</a>
</li>
<li>
<a href="usagepatterns.html">Usage Patterns</a>
</li></ul><hr /><ul>
<li>
<a href="apidocs/index.html">Xalan-J API</a>
</li>
<li>
<a href="public_apis.html">Public APIs</a>
</li>
<li>
<a href="dtm.html">DTM</a>
</li></ul><hr /><ul>
<li>
<a href="extensions.html">Extensions</a>
</li>
<li>
<a href="extensionslib.html">Extensions Library</a>
</li>
<li>
<a href="extensions_xsltc.html">XSLTC Exts</a>
</li></ul><hr /><ul>
<li>
<a href="design/design2_0_0.html">Xalan 2 Design</a>
</li>
<li>
<a href="xsltc/index.html">XSLTC Design</a>
</li></ul><hr /><ul>
<li>
<a href="builds.html">Building a release</a>
</li>
<li>
<a href="http://xml.apache.org/xalan-j/test/overview.html">Testing</a>
</li>
<li>
<a href="bugreporting.html">Bug Reporting</a>
</li></ul><hr /><ul>
<li>
<a href="contact_us.html">Contact us</a>
</li>
</ul>
</div>
<div id="content">
<h2>Getting Started</h2>
<ul>
<li>
<a href="#classpath">Setting up the system classpath</a>
</li>
<li>
<a href="#samples">Trying out the samples</a>
</li>
<li>
<a href="#commandline">Performing your own transformations from the command line</a>
</li>
<li>
<a href="#java-apps">Setting up your own XSLT applications</a>
</li>
</ul>
<table class="note">
<tr>
<td class="noteImg">
<img src="resources/note.gif" alt="note" />
</td>
<td class="noteTxt">Unless otherwise specified, the usage discussed in this section refers to
the Xalan-Java Interpretive processor. See <a href="xsltc_usage.html">Getting Started with XSLTC
</a> for information on using the Xalan-Java Compiling processor.</td>
</tr>
</table>
<br />
<a name="classpath"></a>
<p align="right" size="2">
<a href="#content">(top)</a>
</p>
<h3>Setting up the system classpath</h3>
<p>At the very minimum, you must include <code>xalan.jar</code>, <code>serializer.jar</code>, <code>xml-apis.jar</code>,
and <code>xercesImpl.jar</code> -- or another conformant XML parser -- see <a href="usagepatterns.html#plug">Plugging in a Transformer and XML parser</a>) on the system classpath.
To run the Xalan-Java Interpretive processor sample applications, include <code>xalansamples.jar</code>
(all samples other than the servlet) and <code>xalanservlet.jar</code>. All these JAR files are
distributed with Xalan-Java. To run Javascript extensions, include <code>bsf.jar</code>, which can
be obtained from the <a href="http://jakarta.apache.org/bsf/index.html">Apache Jakarta
BSF project</a>. For extensions implemented in other scripting language, see
<a href="extensions.html#supported-lang"> extensions language requirements</a>
to identify any additional JAR files you must place on the classpath and where you can
get them.</p>
<p>If you are using XSLTC, see <a href="xsltc_usage.html">Getting Starting with XSLTC</a>.</p>
<p>If you are using JDK or JRE 1.3.x or 1.4.x, include <code>tools.jar</code> on the classpath. If you
are using JDK or JRE 1.1.8 (supported for runtime only), then include <code>classes.zip</code> on the
classpath.</p>
<a name="samples"></a>
<p align="right" size="2">
<a href="#content">(top)</a>
</p>
<h3>Trying out the samples</h3>
<p>The Xalan-Java distribution includes a number of basic sample applications. These samples are easy
to run, and you can review the source files -- all of which are brief -- to see just how they
work.</p>
<p>To run the samples, do the following:</p>
<ol>
<li>Set up your classpath (see above), including <code>xalansamples.jar</code> and (for the servlet)
<code>xalanservlet.jar</code>.</li>
<li>Be sure the java executable is on your path.</li>
<li>Go to the samples subdirectory containing the sample (use the DOS shell if you are running
Windows).</li>
<li>Use the java executable to run the sample from the command line.</li>
<li>Examine the application source and result files.</li>
</ol>
<p>For example, go to the SimpleTransform subdirectory and issue the following command:</p>
<p>
<code>java SimpleTransform</code>
</p>
<p>The sample writes the transformation result to a file (birds.out). To see how the example works,
examine the source files: birds.xml, birds.xsl, and SimpleTransform.java.</p>
<p>The extensions examples require additional JAR files on the classpath, and the procedure for
running the sample applet and sample servlet is different. For more information about all the
samples, see <a href="samples.html">Xalan-Java Samples</a>.</p>
<a name="commandline"></a>
<p align="right" size="2">
<a href="#content">(top)</a>
</p>
<h3>Performing your own transformations from the command line</h3>
<p>org.apache.xalan.xslt.Process provides a basic utility for performing transformations from
the command line. You can use this utility, for example, to run several of the extensions samples.
The command line for most standard transformations is as follows:</p>
<p>
<code>java org.apache.xalan.xslt.Process -in <b>
<i>xmlSource</i>
</b>
</code>
<br />
<code>    -xsl <b>
<i>stylesheet</i>
</b> -out <b>
<i>outputfile</i>
</b>
</code>
</p>
<p>where <b>
<i>xmlSource</i>
</b> is the XML source file name, <b>
<i>stylesheet</i>
</b> is the XSL
stylesheet file name, and <b>
<i>outputfile</i>
</b> is the output file name.</p>
<p>If you want the output to be displayed on the screen, simply omit the -out flag and argument.</p>
<p>You can use this utility to try out XSL stylesheets you have written, to make sure they do what
you expect with the XML source files they are designed to transform. The utility provides useful
messages if the source file or stylesheet is not well formed. For more information, see
<a href="commandline.html">Command-Line Utility</a>.</p>
<a name="java-apps"></a>
<p align="right" size="2">
<a href="#content">(top)</a>
</p>
<h3>Setting up your own Java applications</h3>
<p>You can start by using your own XML source files and XSL stylesheets with the sample applications,
which illustrate a number of the <a href="usagepatterns.html">basic usage patterns</a>.</p>
<p>Here is the basic procedure to keep in mind when you set up a transformation:</p>
<ol>
<li>Use the <a href="apidocs/javax/xml/transform/TransformerFactory.html">TransformerFactory</a> static newInstance() method to instantiate a TransformerFactory.<br />
<br />
</li>
<li>Use the TransformerFactory newTransformer(Source stylesheet) method to process the
transformation instructions in an XSLT stylesheet Source (producing under the covers a
<a href="apidocs/javax/xml/transform/Templates.html">Templates</a> object) and generate
a <a href="apidocs/javax/xml/transform/Transformer.html">Transformer</a>.<br />
<br />
</li>
<li>Use the Transformer transform(Source xmlSource, Result transformResult) method to apply the
transformation instructions (the Templates object) to the XML Source and produce the
transformation Result.<br />
<br />
</li>
</ol>
<p>For more information about this procedure and its variations, see <a href="usagepatterns.html">Basic
Usage Patterns</a>.</p>
<p align="right" size="2">
<a href="#content">(top)</a>
</p>
</div>
<div id="footer">Copyright © 1999-2014 The Apache Software Foundation<br />Apache, Xalan, and the Feather logo are trademarks of The Apache Software Foundation<div class="small">Web Page created on - Thu 2014-05-15</div>
</div>
</body>
</html>