The TransformerFactoryImpl, which implements the TRaX TransformerFactory
interface, processes XSLT stylesheets into a Templates object
(a StylesheetRoot).
FEATURE_INCREMENTAL
public static final String FEATURE_INCREMENTAL
Static string to be used for incremental feature
FEATURE_OPTIMIZE
public static final String FEATURE_OPTIMIZE
Static string to be used for optimize feature
FEATURE_SOURCE_LOCATION
public static final String FEATURE_SOURCE_LOCATION
Static string to be used for source_location feature
XSLT_PROPERTIES
public static final String XSLT_PROPERTIES
The path/filename of the property file: XSLTInfo.properties
Maintenance note: see also
org.apache.xpath.functions.FuncSystemProperty.XSLT_PROPERTIES
m_optimize
public static boolean m_optimize
m_source_location
public static boolean m_source_location
Flag set by FEATURE_SOURCE_LOCATION.
This feature specifies whether the transformation phase should
keep track of line and column numbers for the input source
document. Note that this works only when that
information is available from the source -- in other words, if you
pass in a DOM, there's little we can do for you.
The default is false. Setting it true may significantly
increase storage cost per node.
getAssociatedStylesheet
public Source getAssociatedStylesheet(Source source,
String media,
String title,
String charset)
throws TransformerConfigurationException
Get InputSource specification(s) that are associated with the
given document specified in the source param,
via the xml-stylesheet processing instruction
(see http://www.w3.org/TR/xml-stylesheet/), and that matches
the given criteria. Note that it is possible to return several stylesheets
that match the criteria, in which case they are applied as if they were
a list of imports or cascades.
Note that DOM2 has it's own mechanism for discovering stylesheets.
Therefore, there isn't a DOM version of this method.
- getAssociatedStylesheet in interface TransformerFactory
source
- The XML source that is to be searched.media
- The media attribute to be matched. May be null, in which
case the prefered templates will be used (i.e. alternate = no).title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.
- A Source object capable of being used to create a Templates object.
TransformerConfigurationException
-
getAttribute
public Object getAttribute(String name)
throws IllegalArgumentException
Allows the user to retrieve specific attributes on the underlying
implementation.
- getAttribute in interface TransformerFactory
name
- The name of the attribute.
- value The value of the attribute.
getErrorListener
public ErrorListener getErrorListener()
Get the error listener in effect for the TransformerFactory.
- getErrorListener in interface TransformerFactory
- A non-null reference to an error listener.
getFeature
public boolean getFeature(String name)
Look up the value of a feature.
The feature name is any fully-qualified URI. It is
possible for an TransformerFactory to recognize a feature name but
to be unable to return its value; this is especially true
in the case of an adapter for a SAX1 Parser, which has
no way of knowing whether the underlying parser is
validating, for example.
- getFeature in interface TransformerFactory
name
- The feature name, which is a fully-qualified URI.
- The current state of the feature (true or false).
getURIResolver
public URIResolver getURIResolver()
Get the object that will be used to resolve URIs used in
xsl:import, etc. This will be used as the default for the
transformation.
- getURIResolver in interface TransformerFactory
- The URIResolver that was set with setURIResolver.
newTemplates
public Templates newTemplates(Source source)
throws TransformerConfigurationException
Process the source into a Templates object, which is likely
a compiled representation of the source. This Templates object
may then be used concurrently across multiple threads. Creating
a Templates object allows the TransformerFactory to do detailed
performance optimization of transformation instructions, without
penalizing runtime transformation.
- newTemplates in interface TransformerFactory
source
- An object that holds a URL, input stream, etc.
- A Templates object capable of being used for transformation purposes.
TransformerConfigurationException
- May throw this during the parse when it
is constructing the Templates object and fails.
newTransformer
public Transformer newTransformer(Source source)
throws TransformerConfigurationException
Process the source into a Transformer object. Care must
be given to know that this object can not be used concurrently
in multiple threads.
- newTransformer in interface TransformerFactory
source
- An object that holds a URL, input stream, etc.
- A Transformer object capable of
being used for transformation purposes in a single thread.
TransformerConfigurationException
- May throw this during the parse when it
is constructing the Templates object and fails.
setAttribute
public void setAttribute(String name,
Object value)
throws IllegalArgumentException
Allows the user to set specific attributes on the underlying
implementation.
- setAttribute in interface TransformerFactory
name
- The name of the attribute.value
- The value of the attribute; Boolean or String="true"|"false"
setErrorListener
public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
Set an error listener for the TransformerFactory.
- setErrorListener in interface TransformerFactory
listener
- Must be a non-null reference to an ErrorListener.
setFeature
public void setFeature(String name,
boolean value)
setURIResolver
public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
xsl:import, etc. This will be used as the default for the
transformation.
- setURIResolver in interface TransformerFactory
resolver
- An object that implements the URIResolver interface,
or null.