blob: 987b368d82a0089128411fe6b99fb7a64d5f271a [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!DOCTYPE s1 SYSTEM "../../style/dtd/document.dtd"[
<!ENTITY xsltcdone SYSTEM "XSLTCDONE">
<!ENTITY xsltc_history SYSTEM "xsltc_history.xml">]>
<s1 title="XSLTC Release Notes">
<p>For this release, please note the following changes, additions, omissions, problems, procedures for running demos,
and new support for the TrAX API.</p>
<p>For an introduction to XSLTC, see <link idref="xsltc_usage">Using XSLTC</link>.</p>
<ul>
<li><link anchor="xsltcnew">Changes and New Features</link></li>
<li><link anchor="xsltcconf">Conformance</link></li>
<li><link anchor="xsltcknownproblems">Known Problems</link></li>
<li><link anchor="xsltcsmart">Smart Transformer Switch</link></li>
<li><link idref="samples" anchor="translets">Sample Translets</link></li>
<li><link idref="xsltc_history">History of XSLTC software changes</link></li>
</ul>
<anchor name="xsltcnew"/>
<s2 title="Global changes since &xslt4j; 2.2.D14">
<note>For a list of &xslt4j; commits, see xalan-cvs@xml.apache.org in the
<jump href="http://nagoya.apache.org/eyebrowse/index.html">Apache mailing list archive index</jump>.</note>
<p><em>Fix to &xslt4j; 2.3.0.</em> Beginning with release 2.3.0, regexp.jar is required to compile translets and use the XSLTC API (see <link idref="xsltc_usage" anchor="classpath">Setting the system classpath for XSLTC</link>). For release 2.3.0, we posted regexp.jar to the Apache CVS repository, but we failed to update the Ant build process to include regexp.jar in the distribution files. As soon as a user alerted us to this error, we fixed build.xml to include regexp.jar in the distribution files. Accordingly, regexp.jar is in the 2.3.x binary and source distribution files.</p>
</s2>
<anchor name="xsltcconf"/>
<s2 title="XSLT 1.0 Conformance and Extensions">
<p>XSLTC does not yet support the following features of the XSL Transformations
(XSLT) Version 1.0:</p>
<ul>
<li>The case-order option to the sort element is not supported, because XSLTC
relies on the underlying Java sorting classes (bugzilla 1396).</li>
</ul>
<p>XSLTC supports a number of features that are not required by the XSLT 1.0 specification,
but which are supported by a number of other XSLT processors:</p>
<ul>
<li><em>Calling external Java functions from a Translet.</em><br/>
Constructors, static, and nonstatic functions are supported. You may use
either the <code>&lt;http://xml.apache.org/xslt/java</code>
or the <code>&lt;http://xml.apache.org/xalan/xsltc/java</code> namespace to
call your external function. The class can be specified as part
of the namespace URI or as part of the function call as shown in the following
example:<br/>
<source> &lt;xsl:stylesheet version=&quot;1.0&quot;
xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:java=&quot;http://xml.apache.org/xslt/java&quot;
xmlns:java-system=&quot;http://xml.apache.org/xslt/java/java.lang.System&quot;&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
&lt;xsl:value-of select=&quot;java:java.lang.System.currentTimeMillis()&quot;/&gt;
&lt;xsl:value-of select=&quot;java-system:currentTimeMillis()&quot;/&gt;
&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;</source><br/>
The following example shows you how to call constructors, static, and nonstatic functions<br/>
<source>&lt;xsl:stylesheet version=&quot;1.0&quot;
xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:java=&quot;http://xml.apache.org/xslt/java&quot;
exclude-result-prefixes=&quot;java&quot;&gt;
&lt;!--
* test: construction of Date object using a parameter calculated
* by a static call to the java.lang.Math object. Then call
* a non-static method (getTime()) on the newly created Date
* object. Demonstrates calling constructors, static functions
* (Math.max) and non-static functions (getTime()).
*
* Output:
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
* Date of object: Sat Nov 30 17:32:41 EST 2002
* Time of object: 1038695561000
*
--&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
&lt;!-- create Date object with calculated parameter --&gt;
&lt;xsl:variable name=&quot;dateObject&quot;
select=&quot;java:java.util.Date.new(
java:java.lang.Math.max(1027695561000,1038695561000)
)&quot;/&gt;
Date of object: &lt;xsl:value-of select=&quot;$dateObject&quot;/&gt;
Time of object: &lt;xsl:value-of select=&quot;java:getTime($dateObject)&quot;/&gt;
&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</source><br/>
</li>
<li><em>Result Tree Fragments as Node Sets</em><br/>
Result Tree Fragments (RTFs) can be captured as the template content of a
variable or parameter and then the variable can be passed to a for-each or
an apply-templates as a node set.<br/><br/></li>
<li><em>nodeset() Function</em><br/>
XSLTC also supports the nodeset() function for transforming an RTF (result
tree fragment) into a node set. It can be used as an xsltc-extension function or as a standard
XPATH function as shown in the following example:<br/>
<source>&lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:xsltc-extension=&quot;http://xml.apache.org/xalan/xsltc&quot;
xmlns:some-extension=&quot;http://some-extension&quot;
version=&quot;1.0&quot;&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
&lt;xsl:variable name=&quot;rtf&quot;&gt;
&lt;docelem&gt;
&lt;elem1&gt;elem1&lt;/elem1&gt;
&lt;elem2&gt;elem2&lt;/elem2&gt;
&lt;/docelem&gt;
&lt;/xsl:variable&gt;
&lt;!-- Use nodeset as XSLTC extension --&gt;
&lt;xsl:value-of select=&quot;xsltc-extension:nodeset($rtf)/docelem/elem1&quot;/&gt;
&lt;!-- Use nodeset as standard function --&gt;
&lt;xsl:value-of select=&quot;nodeset($rtf)/docelem/elem1&quot;/&gt;
&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</source><br/></li>
<li><em>Output Redirection</em><br/>
Output can be redirected to one or more files, using code like the following:<br/>
<source> &lt;xsl:stylesheet
xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:xsltc=&quot;http://xml.apache.org/xalan/xsltc&quot;
xsl:version=&quot;1.0&quot;&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
&lt;xsl:text&gt;This goes to standard output&lt;/xsl:text&gt;
&lt;xsltc:output file=&quot;blob.xml&quot;&gt;
&lt;xsl:text&gt;This ends up in the file 'blob.xml'&lt;/xsl:text&gt;
&lt;/xsltc:output&gt;
&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;</source><br/></li>
</ul>
</s2>
<anchor name="xsltcknownproblems"/>
<s2 title="Known Problems">
<ul>
<li>The strip space element does not work with copy-of. For example, with <code>&lt;xsl:strip-space
elements=&quot;*&quot;/&gt;</code>, if you do an identity transform by matching on
the root node (/) and then do a <code>copy-of select=&quot;.&quot;</code>, the whitespace-only
nodes are not stripped out. <code>xsl:strip-space</code> works when you do not do a copy-of.<br/><br/></li>
<li>In some cases, XSLTC can generate methods that are too long (<em>&gt; 64K length</em>)
to run, or contain jump offsets that are too large for the JVM to handle.
You can minimize this by breaking up large templates into smaller templates.
XSLTC has a new compile option to disable template inlining, compiling each
template in a separate method. From the command line, you would use <code>&quot;-n&quot;</code>
to turn off inlining, or with TrAX set the &quot;disable-inlining&quot; attribute to the TransformationFactory.
For example,
<source>TransformationFactory tfac = new TransformationFactory();
tfac.setAttribute(&quot;disable-inlining&quot;, new Boolean(true))</source><br/></li>
<li>XSLTC tries to determine the order in which global variables are initialized
by tracking the dependencies between them. In some cases, the value of a variable
may depend on a template, e.g., if <code>xsl:call-template</code> is used to initialized
a variable whose type is RTF. If this happens, a NPE may be thrown at runtime
when the translet attempts to access a variable that has not been properly
initialized. In most cases, this problem can be avoided by reordering the
variable declarations.<br/></li>
</ul>
<p>To check on the open bugs in the current Apache xml-xalan/java repository,
follow the instructions below:</p>
<ol>
<li>Go to <jump href="http://nagoya.apache.org/bugzilla">http://nagoya.apache.org/bugzilla</jump>.</li>
<li>Select <em>Query Existing Bug Reports</em>.</li>
<li>Choose:<br/>
Program: <em>XalanJ2</em><br/>
Component: <em>org.apache.xalan.xsltc</em> (and) <em>Xalan-Xsltc</em></li>
<li>Submit the query.</li>
</ol>
</s2>
<anchor name="xsltcsmart"/>
<s2 title="Smart Transformer Switch">
<p>As part of the TrAX API, a &quot;Smart Transformer Switch&quot; enables automatic switching between Xalan and XSLTC
processors within your application. It uses Xalan to create your
<code>Transformer</code> objects, and uses XSLTC to create your <code>Templates</code> objects.</p>
<p>To use the switch, you set the TrAX system property,
<code>javax.xml.transform.TransformerFactory</code>, to <code>org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl</code>.
For one-time transformations or transformations that require extensions supported by Xalan, and not XSLTC,
you would use Transformer objects. For a repeated transformation where performance is critical, you would
use Templates objects.</p>
</s2>
</s1>