http://xml.apache.org/http://www.apache.org/http://www.w3.org/

What's New
DTM
XSLTC Translets

Overview
Getting Started

FAQs

Sample Apps
Command Line

Usage Patterns
Features

TrAX
API (Javadoc)

Extensions
Extensions Library

Release Notes

Xalan 2 Design
XSLTC Design

Bugs
Testing

Credits
XSLTC Credits

For this release, please note the following changes, additions, omissions, problems, procedures for running demos, and new support for the TrAX API.

For an introduction to XSLTC, see Using XSLTC.

Changes since Xalan-Java 2.2.D14
 

Fix to Xalan-Java 2.3.0. Beginning with release 2.3.0, regexp.jar is required to compile translets and use the XSLTC API (see Setting the system classpath for XSLTC). 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.1 binary and source distribution files.

XSLTC source code updates:

  • Committed by tmiller@apache.org on 01/24/2002
    Modified: java/src/org/apache/xalan/xsltc/runtime TextOutput.java
    Committer's log entry: bug 1520 fix, escape chars over 0080 instead of 00FF

  • Committed by tmiller@apache.org on 01/24/2002
    Modified: java/src/org/apache/xalan/xsltc/runtime TextOutput.java
    Committer's log entry: bug 1520, adjusted 0080 to 007F in ASCII cutoff

  • Committed by tmiller@apache.org on 02/01/2002
    Modified: java/src/org/apache/xalan/xsltc/compiler AttributeValueTemplate.java AbsoluteLocationPath.java AbsolutePathPattern.java AlternativePattern.java AncestorPattern.java ApplyImports.java ApplyTemplates.java AttributeSet.java BooleanCall.java BinOpExpr.java BooleanExpr.java CallTemplate.java CastExpr.java CeilingCall.java Choose.java Comment.java DecimalFormatting.java ConcatCall.java Constants.java ContainsCall.java Copy.java CopyOf.java CurrentCall.java DocumentCall.java EqualityExpr.java Import.java If.java ElementAvailableCall.java Expression.java Fallback.java FilterExpr.java FilterParentPath.java FloorCall.java FlowList.java ForEach.java FormatNumberCall.java FunctionAvailableCall.java FunctionCall.java GenerateIdCall.java IdKeyPattern.java Include.java IntExpr.java Key.java KeyCall.java LangCall.java LastCall.java LiteralAttribute.java LiteralElement.java LiteralExpr.java LocalNameCall.java NamespaceAlias.java LogicalExpr.java Message.java Mode.java NameBase.java NameCall.java NamespaceUriCall.java NotCall.java Number.java NumberCall.java Output.java Param.java ParentLocationPath.java ParameterRef.java ParentPattern.java PositionCall.java RelationalExpr.java Predicate.java Sort.java ProcessingInstruction.java RealExpr.java VariableRef.java RoundCall.java ValueOf.java SimpleAttributeValue.java StartsWithCall.java Stylesheet.java StringCall.java StringLengthCall.java StepPattern.java Template.java TestSeq.java Text.java TopLevelElement.java TransletOutput.java UnaryOpExpr.java UnionPathExpr.java UnparsedEntityUriCall.java UseAttributeSets.java LongExpr.java Variable.java Whitespace.java XslAttribute.java WithParam.java XSLTC.java XslElement.java UnsupportedElement.java VariableBase.java VariableRefBase.java FilteredAbsoluteLocationPath.java SyntaxTreeNode.java Step.java UnresolvedRef.java ProcessingInstructionPattern.java
    Committer's log entry: changed de.fub.bytecode to org.apache.bcel

  • Committed by tmiller@apache.org on 02/01/2002
    Modified: java/src/org/apache/xalan/xsltc/compiler/util NamedMethodGenerator.java NodeCounterGenerator.java NodeSetType.java NodeSortRecordGenerator.java NodeType.java RealType.java ReferenceType.java ResultTreeType.java RtMethodGenerator.java SlotAllocator.java StringType.java TestGenerator.java Util.java LongType.java
    Committer's log entry: changed de.fub.bytecode to org.apache.bcel

  • Committed by tmiller@apache.org on 02/01/2002
    Modified: java/src/org/apache/xalan/xsltc/compiler/util AttributeSetMethodGenerator.java BooleanType.java ClassGenerator.java CompareGenerator.java FilterGenerator.java IntType.java MatchGenerator.java MethodGenerator.java MethodType.java Type.java VoidType.java
    Committer's log entry: changed de.fub.bytecode to org.apache.bcel

  • Committed by tmiller@apache.org on 02/05/2002
    Modified: java/src/org/apache/xalan/xsltc/runtime TextOutput.java
    Committer's log entry: bug 1520, spec chars in href attributes

  • Committed by tmiller@apache.org on 02/07/2002
    Modified: java/src/org/apache/xalan/xsltc/runtime TextOutput.java
    Committer's log entry: bug 1520, updating href attr spec char handling

  • Committed by tmiller@apache.org on 02/13/2002
    Modified: java/src/org/apache/xalan/xsltc/dom DOMImpl.java
    Committer's log entry: bug fix 6189, ArrayIndexOutOfBoundsException, contrib by Mirko Seifert

  • Committed by tmiller@apache.org on 02/14/2002
    Added: java/src/org/apache/xalan/xsltc javax.xml.transform.TransformerFactory
    Committer's log entry: added a service provide source file to be copied into xsltc.jar (bundled jar)


XSLT 1.0 Conformance and Extensions
 

XSLTC does not yet support the following features of the XSL Transformations (XSLT) Version 1.0:

  • Explicitly set template priorities are ignored (bugzilla 2886)
  • The case-order option to the sort element is not supported, because XSLTC relies on the underlying Java sorting classes (bugzilla 1396).

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:

  • Support for extension elements and external Java functions is incomplete. Currently you can set up an extension function to call a static Java method. For the extension namespace, use
        http://xml.apache.org/xslt/java
    and then within the xsl reference the static method with java:SomeClass.Method().
  • 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.
  • Output can be redirected to a file using the <xsltc:output> element. It takes a file attribute to specify the output file. Attribute value templates can be used within the "file" attribute to construct the name.

Known Problems
 
  • Casting variables: XSLTC requires you to explicitly type cast values returned by variables or expressions, when you use them in tests. Always a good practice, but it may seem like overkill in some in contexts, where other XSLT processors automatically assume or convert to the correct type. For example. unless you cast $country to a string in the following apply-templates, entry nodes whose <country> elements contain a string matching the global $country parameter are NOT selected.

        <xsl:apply-templates select="entry[country=string($country)]"/>
  • XSLTC does not produce the correct output on the XSLTMark Performance Benchmark tests called 'alphabetize' (bugzilla 5573), and 'trend' (bugzilla 5577).
  • XLSTC throws a ClassCastException in method setImportPrecedence(int) of class Stylesheet when 'elements' does not contain only TopLevelElements, thus causing compilation to fail (bugzilla 5964).
  • XSLTC compiler can generate classes with methods longer than 65535 bytes. As a results the compiled translet cannot be run (bugzilla 4516)
  • Using the 'select' attribute versus the template content to assign a value to a variable can lead to inconistent results. For example, you get different results when select="preceding-sibling::*[position() =1]/@x" is used as the attribute of the <xsl:variable> element versus when it is used as the attribute of an <xsl:value-of> element contained within the <xsl:variable> element (bugzilla 6072).
  • Setting the output type to XHTML and including the xmlns="http://www.w3.org/1999/xhtml" attribute in the <html> Literal Result Element, causes XSLTC to disregard the mode attribute within apply-templates (bugzilla 6074).
  • After the first transformation, using a cached template object, the ouput is prematurely terminated after an xsl:comment element. This has been reported to happen only when the stylesheet also includes an xsl:for-each element (bugzilla 6109).
  • XSLTC TRAX API produces an incorrect DOM Structure when using a DOMResult. The org.apache.xalan.xsltc.trax.SAX2DOM class automatically adds a Element with the name "root" to the top of the DOM tree on the startDocument method. On a successful transform call, the node returned from the DOMResult.getNode() method is the document node, with this 'root' element attached as the first child. Xalan and Saxon both have the output document top nodes directly attached below the Document node. Also, the TransformerImpl and SAX2DOM Classes does not respect any node already set in the DOMResult (from bugzilla 6417).

Smart Transformer Switch
 

As part of the TrAX API, a "Smart Transformer Switch" enables automatic switching between Xalan and XSLTC processors within your application. It uses Xalan to create your Transformer objects, and uses XSLTC to create your Templates objects.

To use the switch, you set the TrAX system property, javax.xml.transform.TransformerFactory, to org.apache.xalan.xsltc.trax.SmartTransformerImpl. 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.


Running Demos
 

XSLTC provides demos for using XSLTC as a servlet and as a handler for Brazil (a new and powerful Web techology from Sun labs). To run these demos, download Brazil from sunlabs:

    http://research.sun.com/research/download/index.html

and the java extensions for servlets from Sun:

     http://java.sun.com/products/servlet/download.html

The translet must be specified as a pure class name, accessible through the Brazil handler's classpath. For example:

    translet=mk054

The document must be specified as a valid URL. For example:

    document=http://server/path/to/filename.xml

If the file is local to the Brazil handler, it has to be specified using the "file:filename.xml" format.

NoteYou also need to make the Brazil and javax classes available from your classpath

See also: sample JAXP translets.



Copyright © 2002 The Apache Software Foundation. All Rights Reserved.