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

Overview

Downloads
Getting Started

FAQs

Sample Apps
Command Line
Usage Patterns

C++ API

Extensions

Release Notes

Bug reporting

Questions
 

Answers
 
Where do I go to learn about XSLT?
 

The definitive sources are the W3C XSLT and XPath recommendations: W3C Recommendation 16 November 1999 XSL Transformations (XSLT) Version 1.0 and XML Path Language (XPath) Version 1.0.

For general questions not specific to Xalan-C++, see Dave Pawson's XSL Frequently Asked Questions and Michael Kay's XSLT Programmer's Reference.

For a brief listing of tutorials, discussion forums, and other materials, see Getting up to speed with XSLT.


Which version of Xerces should I be using?
 

The Xalan-C++ release notes includes information about the Xerces-C++ release with which the Xalan-C++ release has been coordinated and tested. See Status


Are the XSLTEngineImpl (XSLT processor) and StylesheetRoot (compiled stylesheet) objects thread-safe?
 

The XSLTEngineImpl stores running state information, so it is not thread-safe. If you want to use the XSLTEngineImpl to perform multiple simultaneous transformations, create a separate instance for each transformation. If you want to perform multiple serial transformations with a single XSLTEngineImpl object, call the XSLTEngineImpl reset() method after each transformation. You may want to serialize access to this object, so it can't accidently start another transformation while a transformation is in progress.

StylesheetRoot objects, on the other hand, are thread-safe. A single StylesheetRoot object may be called concurrently from multiple threads. Keep in mind, however, that the StylesheetRoot uses an XSLTEgineImpl to store running state information for each transformation, so you must call the XSLTEngineImpl reset() method and the StylesheetExecutionDefault reset() method between each transformation.

For more detail, see CompileStylesheet.


What can I do to speed up transformations?
 

To maximize performance, here are some suggestions for you to keep in mind as you set up your applications:

  • Use a compiled stylesheet when you expect to use the stylesheet more than once.

  • Set up your stylesheets to function efficiently.

    • Don't use "//" (descendant axes) patterns near the root of a large document.

    • Use xsl:key elements and the key() function as an efficient way to retrieve node sets.

    • Where possible, use pattern matching rather than xsl:if or xsl:when statements.

    • xsl:for-each is fast because it does not require pattern matching.

    • Keep in mind that xsl:sort prevents incremental processing.

    • When you create variables, <xsl:variable name="fooElem" select="foo"/> is usually faster than <xsl:variable name="fooElem"><xsl:value-of-select="foo"/></xsl:variable>.

    • Be careful using the last() function.

    • The use of index predicates within match patterns can be expensive.


Can I validate an XSL stylesheet?
 

An XSL stylesheet is an XML document, so it can have a DOCTYPE and be subject to validation, but you probably will have to write a custom DTD for the purpose.

The XSLT Recommendation includes a DTD Fragment for XSL Stylesheets with some indications of what you need to do to create a complete DTD for a given stylesheet. Keep in mind that stylesheets can include literal result elements and produce output that is not valid XML.

You can use the xsl:stylesheet doctype defined in xsl-html40s.dtd for stylesheets that generate HTML.




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