addTraceListener
public void addTraceListener(TraceListener trace)
Adds the specified trace listener to receive trace events from
this instance.
Must be called before the invocation of the render method.
trace
- the trace listener.
applyImports
public void applyImports(Context c,
Mode mode,
int min,
int max,
ParameterSet params)
throws TransformerException
Apply a template imported from the stylesheet containing the current template
applyTemplates
public void applyTemplates(Context c,
Expression select,
Mode mode,
ParameterSet parameters)
throws TransformerException
ApplyTemplates to process selected nodes using the handlers registered for a particular
mode.
select
- A node-set expression (or more accurately a node-list)
that determines which nodes are selected.
Note: if the nodes are to be sorted, the select Expression will take care of this.mode
- Identifies the processing mode. It should match the mode defined when the
element handler was registered using setHandler with a mode parameter. Set this parameter to
null to invoke the default mode.parameters
- A ParameterSet containing the parameters to the handler/template being invoked.
Specify null if there are no parameters.
changeOutputDestination
public void changeOutputDestination(Properties props,
Result result)
throws TransformerException
Set a new output destination, supplying the output format details.
This affects all further output until resetOutputDestination() is called. Note that
it is the caller's responsibility to close the Writer after use.
result
- Details of the new output destination
changeToTextOutputDestination
public void changeToTextOutputDestination(StringBuffer buffer)
Set a simple StringBuffer output destination. Used during calls to
xsl:attribute, xsl:comment, xsl:processing-instruction
clearDocumentPool
public void clearDocumentPool()
Clear the document pool. This is sometimes useful when using the same Transformer
for a sequence of transformations, but it isn't done automatically, because when
the transformations use common look-up documents, the caching is beneficial.
clearParameters
public void clearParameters()
Reset the parameters to a null list.
compare
public int compare(NodeInfo n1,
NodeInfo n2)
Compare the position of two nodes in document order
- compare in interface NodeOrderComparer
n1
- The first noden2
- The second node
- <0 if the first node is first in document order; >0 if
the second node comes first in document order; 0 if the two parameters
identify the same node
disableWhitespaceStripping
public void disableWhitespaceStripping(boolean disable)
Disable whitespace stripping
getBindery
public Bindery getBindery()
Get the current bindery
getDocumentPool
public DocumentPool getDocumentPool()
Get the document pool. This is used only for source documents, not for stylesheet modules
getErrorListener
public ErrorListener getErrorListener()
Get the error listener
getKeyManager
public KeyManager getKeyManager()
Get the KeyManager
getMessageEmitter
public Emitter getMessageEmitter()
Get the Emitter used for xsl:message output
getNamePool
public NamePool getNamePool()
Get the name pool in use
getOutputProperties
public Properties getOutputProperties()
Get the output properties for the transformation.
getOutputProperty
public String getOutputProperty(String name)
Get the value of an output property
getOutputter
public Outputter getOutputter()
Get the current outputter
getParameter
public Object getParameter(String expandedName)
Get a parameter to the transformation
getRecoveryPolicy
public int getRecoveryPolicy()
Get the policy for handling recoverable errors
getStandardURIResolver
public URIResolver getStandardURIResolver()
Get the fallback URI resolver.
- the the system-defined URIResolver
getTreeModel
public int getTreeModel()
Get the tree model in use
getURIResolver
public URIResolver getURIResolver()
Get the primary URI resolver.
- the user-supplied URI resolver if there is one, or the system-defined one
otherwise (Note, this isn't quite as JAXP specifies it).
getUserData
public Object getUserData(NodeInfo node,
String name)
Get the named user data property for the node
- The value of the named user data property.
Returns null if no property of that name has been set using setUserData()
for this NodeInfo object.
isLineNumbering
public boolean isLineNumbering()
Determine whether line numbering is enabled
isTracing
public final boolean isTracing()
isWhitespaceStrippingDisabled
public boolean isWhitespaceStrippingDisabled()
Determine if whitespace stripping is disabled
makeBuilder
public Builder makeBuilder()
Make a builder for the selected tree model
makeContext
public Context makeContext(NodeInfo node)
Create a new context with a given node as the current node and the only node in the current
node list.
makeMessageEmitter
public Emitter makeMessageEmitter()
throws TransformerException
Make an Emitter to be used for xsl:message output
pauseTracing
public void pauseTracing(boolean pause)
removeTraceListener
public void removeTraceListener(TraceListener trace)
Removes the specified trace listener so that the next invocation
of the render method will not send trace events to the listener.
trace
- the trace listener.
reportRecoverableError
public void reportRecoverableError(String message,
SourceLocator location)
throws TransformerException
Report a recoverable error
reportRecoverableError
public void reportRecoverableError(TransformerException err)
throws TransformerException
Report a recoverable error
resetOutputDestination
public void resetOutputDestination(Outputter outputter)
throws TransformerException
Close the current outputter, and revert to the previous outputter.
outputter
- The outputter to revert to
run
public void run(NodeInfo node)
throws TransformerException
Process a Document.
This method is intended for use when performing a pure Java transformation,
without a stylesheet. Where there is an XSLT stylesheet, use transformDocument()
or transform() instead: those methods set up information from the stylesheet before calling
run().
The process starts by calling the registered node
handler to process the supplied node. Note that the same document can be processed
any number of times, typically with different node handlers for each pass. The NodeInfo
will typically be the root of a tree built using com.icl.saxon.om.Builder.
setDiagnosticName
public void setDiagnosticName(String name)
Set a diagnostic name for this transformation (accessible through toString())
setErrorListener
public void setErrorListener(ErrorListener listener)
Set the error listener
setLineNumbering
public void setLineNumbering(boolean onOrOff)
Set line numbering (of the source document) on or off
setMessageEmitter
public void setMessageEmitter(Emitter emitter)
Set the Emitter to be used for xsl:message output
setNamePool
public void setNamePool(NamePool pool)
Set the name pool to be used
setOutputProperties
public void setOutputProperties(Properties properties)
Set the output properties for the transformation. These
properties will override properties set in the templates
with xsl:output.
setOutputProperty
public void setOutputProperty(String name,
String value)
Set an output property for the transformation.
setParameter
public void setParameter(String expandedName,
Object value)
Set a parameter for the transformation.
setParams
public void setParams(ParameterSet params)
Set parameters supplied externally (typically, on the command line).
(non-TRAX method retained for backwards compatibility)
params
- A ParameterSet containing the (name, value) pairs.
setPreparedStyleSheet
public void setPreparedStyleSheet(PreparedStyleSheet sheet)
Associate this Controller with a compiled stylesheet
setRecoveryPolicy
public void setRecoveryPolicy(int policy)
Set the policy for handling recoverable errors
setRuleManager
public void setRuleManager(RuleManager r)
setTraceListener
public void setTraceListener(TraceListener trace)
setTreeModel
public void setTreeModel(int model)
Set the tree data model to use
setURIResolver
public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
document(), etc.
resolver
- An object that implements the URIResolver interface,
or null.
setUserData
public void setUserData(NodeInfo node,
String name,
Object data)
Set a user data property for a node.
name
- The name of the user data property to be set. Any existing user data property
of the same name will be overwritten.
toString
public String toString()
transform
public void transform(Source source,
Result result)
throws TransformerException
Process the source tree to SAX parse events.
source
- The input for the source tree.result
- The destination for the result tree.
transformDocument
public void transformDocument(NodeInfo startNode,
Result result)
throws TransformerException
Render a source XML document supplied as a tree.
A new output destination should be created for each source document,
by using setOutputDetails().
startNode
- A Node that identifies the source document to be transformed and the
node where the transformation should startresult
- The output destination
usesPreviewMode
protected boolean usesPreviewMode()
Does this transformation use preview mode?