XSLT Processor Attributes

Some XSLT processors provide non-standard, custom attributes that control their behavior. Like features, these are also named via URIs. For example, Xalan-J 2.3 defines these three attributes:


By default, Xalan rewrites stylesheets in an attempt to optimize them (similar to the behavior of an optimizing compiler for Java or other languages). This can confuse tools that need direct access to the stylesheet such as XSLT profilers and debuggers. If you’re using such a tool with Xalan, you should set this attribute to false.


Setting this feature to true allows Xalan to begin producing output before it has finished processing the entire input document. This may cause problems if an error is detected late in the process, but it shouldn’t be a big problem in fully debugged and tested environments.


Setting this to true tells Xalan to provide a JAXP SourceLocator a program can use to determine the location (line numbers, column numbers, system IDs, and public IDs) of individual nodes during the transform. However, it engenders a substantial performance hit so it’s turned off by default.

Other processors define their own attributes. Although TrAX is designed as a generic API, it does let you access such custom features with these two methods:

public abstract void setAttribute(String name Object value) throws IllegalArgumentException;
public abstract Object getAttribute(String name) throws IllegalArgumentException;

For example, this code tries to turn on incremental output:

TransformerFactory xformFactory 
 = TransformerFactory.newInstance();
try {
   "http://apache.org/xalan/features/incremental", Boolean.TRUE);
catch (IllegalArgumentException e) { 
  // This XSLT processor does not support the
  // http://apache.org/xalan/features/incremental attribute,
  // but we can still use the processor anyway

Previous | Next | Top | Cafe con Leche

Copyright 2000-2003 Elliotte Rusty Harold
Last Modified January 13, 2003