public class Controller extends Transformer
Modifier and Type | Field and Description |
---|---|
static String |
ANONYMOUS_PRINCIPAL_OUTPUT_URI |
Constructor and Description |
---|
Controller(Configuration config)
Create a Controller and initialise variables.
|
Controller(Configuration config,
Executable executable)
Create a Controller and initialise variables.
|
Modifier and Type | Method and Description |
---|---|
void |
addTraceListener(TraceListener trace)
Adds the specified trace listener to receive trace events from
this instance.
|
void |
addUnavailableOutputDestination(DocumentURI uri)
Add a URI to the set of output destinations that cannot be written to, either because
they have already been written to, or because they have been read
|
void |
allocateGlobalVariables(int numberOfVariables)
Allocate space in the bindery for global variables.
|
SequenceOutputter |
allocateSequenceOutputter(int size)
Allocate a SequenceOutputter for a new output destination.
|
void |
checkImplicitResultTree()
Check whether an XSLT implicit result tree can be written.
|
boolean |
checkUniqueOutputDestination(DocumentURI uri)
Check that an output destination has not been used before, optionally adding
this URI to the set of URIs that have been used.
|
void |
clearDocumentPool()
Clear the document pool.
|
void |
clearParameters()
Reset the parameters to a null list.
|
void |
defineGlobalParameters()
Register the global parameters of the transformation or query.
|
String |
getBaseOutputURI()
Get the base output URI.
|
Bindery |
getBindery()
Get the current bindery.
|
ClassLoader |
getClassLoader()
Get the ClassLoader supplied using the method
setClassLoader(java.lang.ClassLoader) . |
CollectionURIResolver |
getCollectionURIResolver()
Get the CollectionURIResolver used for resolving references to collections.
|
Configuration |
getConfiguration()
Get the Configuration associated with this Controller.
|
Item |
getContextForGlobalVariables()
Get the item used as the context for evaluating global variables.
|
String |
getCookedBaseOutputURI()
Get the base output URI after processing.
|
DateTimeValue |
getCurrentDateTime()
Get the current date and time for this query or transformation.
|
String |
getDefaultCollection()
Get the name of the default collection.
|
DocumentPool |
getDocumentPool()
Get the document pool.
|
ErrorListener |
getErrorListener()
Get the error listener.
|
Executable |
getExecutable()
Get the Executable object.
|
int |
getImplicitTimezone()
Get the implicit timezone for this query or transformation
|
Item |
getInitialContextItem()
Get the initial context item.
|
Mode |
getInitialMode()
Get the initial mode for the transformation
|
String |
getInitialModeName()
Get the name of the initial mode for the transformation
|
String |
getInitialTemplate()
Get the initial template
|
KeyManager |
getKeyManager()
Get the KeyManager.
|
Receiver |
getMessageEmitter()
Get the Receiver used for xsl:message output.
|
TreeModel |
getModel()
Get the tree model that will be used.
|
NamePool |
getNamePool()
Get the name pool in use.
|
Properties |
getOutputProperties()
Get the output properties for the transformation.
|
String |
getOutputProperty(String name)
Get the value of an output property.
|
OutputURIResolver |
getOutputURIResolver()
Get the output URI resolver.
|
Object |
getParameter(String expandedName)
Get a parameter to the transformation.
|
PathMap |
getPathMapForDocumentProjection()
Get the path map used for document projection, if any.
|
Result |
getPrincipalResult()
Get the principal result destination.
|
int |
getRecoveryPolicy()
Get the policy for handling recoverable errors
|
int |
getRememberedNumber(NodeInfo node)
Get the number of a node if it is the last remembered one.
|
RuleManager |
getRuleManager()
Get the Rule Manager.
|
SchemaURIResolver |
getSchemaURIResolver()
Get the SchemaURIResolver used for resolving references to schema
documents.
|
int |
getSchemaValidationMode()
Ask whether source documents loaded using the doc(), document(), and collection()
functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method
should be subjected to schema validation
|
SpaceStrippingRule |
getSpaceStrippingRule() |
URIResolver |
getStandardURIResolver()
Get the fallback URI resolver.
|
Receiver |
getStreamingReceiver(Mode mode,
Result result)
Get a receiver to which the input to this transformation can be supplied
as a stream of events, causing the transformation to be executed in streaming mode.
|
PrintStream |
getTraceFunctionDestination()
Get the destination for output from the fn:trace() function.
|
TraceListener |
getTraceListener()
Get the TraceListener.
|
int |
getTreeModel()
Deprecated.
since 9.2: use
getModel() |
UnparsedTextURIResolver |
getUnparsedTextURIResolver()
Get the URI resolver for the unparsed-text() function.
|
URIResolver |
getURIResolver()
Get the URI resolver.
|
Object |
getUserData(Object key,
String name)
Get user data associated with a key.
|
boolean |
hasThereBeenAnExplicitResultDocument()
Test whether an explicit result tree has been written using xsl:result-document
|
boolean |
isStripSourceTree()
Ask whether the transformation will perform whitespace stripping for supplied source trees as defined
by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet.
|
boolean |
isTracing()
Test whether instruction execution is being traced.
|
boolean |
isUnusedOutputDestination(DocumentURI uri)
Determine whether an output URI is available for use.
|
Iterator |
iterateParameters()
Get an iterator over the names of global parameters that have been defined
|
Builder |
makeBuilder()
Make a builder for the selected tree model.
|
PipelineConfiguration |
makePipelineConfiguration()
Make a PipelineConfiguration based on the properties of this Controller.
|
Stripper |
makeStripper(Receiver next)
Make a Stripper configured to implement the whitespace stripping rules.
|
XPathContextMajor |
newXPathContext()
Make an XPathContext object for expression evaluation.
|
void |
pauseTracing(boolean pause)
Pause or resume tracing.
|
void |
preEvaluateGlobals(XPathContext context)
Pre-evaluate global variables (when debugging/tracing).
|
NodeInfo |
prepareInputTree(Source source)
Prepare an input tree for processing.
|
void |
recoverableError(XPathException err)
Report a recoverable error.
|
void |
registerDocument(DocumentInfo doc,
DocumentURI uri)
Add a document to the document pool, and check that it is suitable for use in this query or
transformation.
|
void |
removeTraceListener(TraceListener trace)
Removes the specified trace listener so that the listener will no longer
receive trace events.
|
void |
removeUnavailableOutputDestination(DocumentURI uri)
Remove a URI from the set of output destinations that cannot be written to or read from.
|
void |
reportFatalError(XPathException err)
Report a fatal error
|
void |
reset()
Reset this
Transformer to its original configuration. |
void |
reuseSequenceOutputter(SequenceOutputter out)
Accept a SequenceOutputter that is now available for reuse
|
void |
setBaseOutputURI(String uri)
Set the base output URI.
|
void |
setClassLoader(ClassLoader loader)
Set a ClassLoader to be used when loading external classes.
|
void |
setCollectionURIResolver(CollectionURIResolver resolver)
Set the CollectionURIResolver used for resolving collection URIs.
|
void |
setCurrentDateTime(DateTimeValue dateTime)
Set the current date and time for this query or transformation.
|
void |
setDefaultCollection(String uri)
Set the name of the default collection.
|
void |
setErrorListener(ErrorListener listener)
Set the error listener.
|
void |
setExecutable(Executable exec)
Associate this Controller with an Executable.
|
void |
setGlobalParameterSet(GlobalParameterSet params)
Set all parameters for the transformation
|
void |
setInitialContextItem(Item item)
Set the initial context item, when running XQuery.
|
void |
setInitialMode(String expandedModeName)
Set the initial mode for the transformation.
|
void |
setInitialTemplate(String expandedName)
Set the initial named template to be used as the entry point.
|
void |
setMessageEmitter(Receiver receiver)
Set the Receiver to be used for xsl:message output.
|
void |
setModel(TreeModel model)
Set the tree model to use.
|
void |
setOutputProperties(Properties properties)
Set the output properties for the transformation.
|
void |
setOutputProperty(String name,
String value)
Set an output property for the transformation.
|
void |
setOutputURIResolver(OutputURIResolver resolver)
Set the URI resolver for secondary output documents.
|
void |
setParameter(String expandedName,
Object value)
Set a parameter for the transformation.
|
void |
setParameter(StructuredQName qName,
Sequence value)
Supply a parameter using Saxon-specific representations of the name and value
|
void |
setPreparedStylesheet(PreparedStylesheet sheet)
Associate this Controller with a compiled stylesheet.
|
void |
setRecoveryPolicy(int policy)
Set the policy for handling recoverable XSLT errors.
|
void |
setRememberedNumber(NodeInfo node,
int number)
Set the last remembered node, for node numbering purposes.
|
void |
setRuleManager(RuleManager r)
Set the RuleManager, used to manage template rules for each mode.
|
void |
setSchemaURIResolver(SchemaURIResolver resolver)
Set the SchemaURIResolver used for resolving references to schema
documents.
|
void |
setSchemaValidationMode(int validationMode)
Say whether source documents loaded using the doc(), document(), and collection()
functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method,
should be subjected to schema validation.
|
void |
setStripSourceTrees(boolean strip)
Say whether the transformation should perform whitespace stripping as defined
by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet
in the case where a source tree is supplied to the transformation as a tree
(typically a DOMSource, or a Saxon NodeInfo).
|
void |
setThereHasBeenAnExplicitResultDocument()
Set that an explicit result tree has been written using xsl:result-document
|
void |
setTraceFunctionDestination(PrintStream stream)
Set the destination for output from the fn:trace() function.
|
void |
setTraceListener(TraceListener listener)
Set a TraceListener, replacing any existing TraceListener
|
void |
setTreeModel(int model)
Deprecated.
since 9.2: use
setModel(net.sf.saxon.om.TreeModel) |
void |
setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
Set an UnparsedTextURIResolver to be used to resolve URIs passed to the XSLT
unparsed-text() function.
|
void |
setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
document(), etc.
|
void |
setUseDocumentProjection(PathMap pathMap)
Indicate whether document projection should be used, and supply the PathMap used to control it.
|
void |
setUserData(Object key,
String name,
Object data)
Set user data associated with a key.
|
void |
transform(Source source,
Result result)
Perform a transformation from a Source document to a Result document.
|
void |
transformDocument(NodeInfo startNode,
Result result)
Transform a source XML document supplied as a tree.
|
void |
transformStream(Source source,
Mode mode,
Result result)
Transform a source XML document supplied as a stream, in streaming mode.
|
void |
warning(String message,
String errorCode)
Report a warning
|
public static final String ANONYMOUS_PRINCIPAL_OUTPUT_URI
public Controller(Configuration config)
config
- The Configuration used by this Controllerpublic Controller(Configuration config, Executable executable)
config
- The Configuration used by this Controllerexecutable
- The executable used by this Controllerpublic void reset()
Reset this Transformer
to its original configuration.
Transformer
is reset to the same state as when it was created with
TransformerFactory.newTransformer()
,
TransformerFactory.newTransformer(javax.xml.transform.Source source)
or
Templates.newTransformer()
.
reset()
is designed to allow the reuse of existing Transformer
s
thus saving resources associated with the creation of new Transformer
s.
The above is from the JAXP specification. With Saxon, it's unlikely that reusing a Transformer will
give any performance benefits over creating a new one. The one case where it might be beneficial is
to reuse the document pool (the set of documents that have been loaded using the doc() or document()
functions). Therefore, this method does not clear the document pool. If you want to clear the document
pool, call the method clearDocumentPool()
as well.
The reset Transformer
is not guaranteed to have the same URIResolver
or ErrorListener
Object
s, e.g. Object.equals(Object obj)
.
It is guaranteed to have a functionally equal URIResolver
and ErrorListener
.
reset
in class Transformer
public Configuration getConfiguration()
public void setInitialMode(String expandedModeName)
expandedModeName
- the name of the initial mode. The mode is
supplied as an expanded QName, that is "localname" if there is no
namespace, or "{uri}localname" otherwise. If the value is null or zero-length,
the initial mode is reset to the unnamed default mode.public String getInitialModeName()
public Mode getInitialMode()
public void setOutputProperties(Properties properties)
SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
properties.setOutputProperties
in class Transformer
properties
- the output properties to be used for the
transformation. If the value is null, the properties are reset to
be the properties of the Templates object (that is, for XSLT 2.0,
the properties set in the unnamed xsl:output object).IllegalArgumentException
- if any of the properties are invalid (other than
properties in a user-defined namespace)SaxonOutputKeys
public Properties getOutputProperties()
SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
properties.getOutputProperties
in class Transformer
SaxonOutputKeys
public void setOutputProperty(String name, String value)
As well as the properties defined in the JAXP OutputKeys class,
Saxon defines an additional set of properties in SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
properties.
As an extension to the JAXP specification, supplying the value "" (a zero-length string) for any parameter has the effect of cancelling any value defined in the stylesheet or query; for example setting doctype-system or doctype-public to "" causes the serializer to be run with these properties taken as absent. This rule does not apply to parameters where "" is a meaningful value, for example cdata-section-elements.
setOutputProperty
in class Transformer
name
- the name of the propertyvalue
- the value of the propertyIllegalArgumentException
- if the property is invalid (except for
properties in a user-defined namespace)SaxonOutputKeys
public String getOutputProperty(String name)
SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
properties.getOutputProperty
in class Transformer
name
- the name of the requested propertySaxonOutputKeys
public void setBaseOutputURI(String uri)
This defaults to the system ID of the Result object for the principal output of the transformation if this is known; if it is not known, it defaults to the current directory.
The base output URI is used for resolving relative URIs in the href
attribute
of the xsl:result-document
instruction.
uri
- the base output URIpublic String getBaseOutputURI()
This returns the value set using the setBaseOutputURI(java.lang.String)
method. If no value has been set
explicitly, then the method returns null if called before the transformation, or the computed
default base output URI if called after the transformation.
The base output URI is used for resolving relative URIs in the href
attribute
of the xsl:result-document
instruction.
public String getCookedBaseOutputURI()
public Result getPrincipalResult()
This method is intended for internal use only. It is typically called by Saxon during the course of a transformation, to discover the result that was supplied in the transform() call.
public boolean checkUniqueOutputDestination(DocumentURI uri)
uri
- the URI to be used as the output destinationpublic void addUnavailableOutputDestination(DocumentURI uri)
uri
- A URI that is not available as an output destinationpublic void removeUnavailableOutputDestination(DocumentURI uri)
uri
- A URI that is being made available as an output destinationpublic boolean isUnusedOutputDestination(DocumentURI uri)
uri
- A uri that the application is proposing to use in the href attribute of
xsl:result-document: if this function returns false, then the xsl:result-document
call will fail saying the URI has already been used.public void checkImplicitResultTree() throws XPathException
XPathException
public void setThereHasBeenAnExplicitResultDocument()
public boolean hasThereBeenAnExplicitResultDocument()
public SequenceOutputter allocateSequenceOutputter(int size)
size
- the estimated size of the output sequencepublic void reuseSequenceOutputter(SequenceOutputter out)
out
- the SequenceOutputter that is available for reusepublic void setInitialTemplate(String expandedName) throws XPathException
setParameter(java.lang.String, java.lang.Object)
are used as the values
of global stylesheet parameters. There is no way to supply values for local parameters
of the initial template.expandedName
- The expanded name of the template in {uri}local format, or null
or a zero-length string to indicate that there should be no initial template.XPathException
- if there is no named template with this namepublic String getInitialTemplate()
public PipelineConfiguration makePipelineConfiguration()
public void setMessageEmitter(Receiver receiver)
Recent versions of the JAXP interface specify that by default the output of xsl:message is sent to the registered ErrorListener. Saxon does not implement this convention. Instead, the output is sent to a default message emitter, which is a slightly customised implementation of the standard Saxon Emitter interface.
This interface can be used to change the way in which Saxon outputs xsl:message output.
It is not necessary to use this interface in order to change the destination
to which messages are written: that can be achieved by obtaining the standard
message emitter and calling its Emitter.setWriter(java.io.Writer)
method.
Although any Receiver
can be supplied as the destination for messages,
applications may find it convenient to implement a subclass of SequenceWriter
,
in which only the abstract write()
method is implemented. This will have the effect that the
write()
method is called to output each message as it is generated, with the Item
that is passed to the write()
method being the document node at the root of an XML document
containing the contents of the message.
This method is intended for use by advanced applications. The Receiver interface itself is subject to change in new Saxon releases.
The supplied Receiver will have its open() method called once at the start of
the transformation, and its close() method will be called once at the end of the
transformation. Each individual call of an xsl:message instruction is wrapped by
calls of startDocument() and endDocument(). If terminate="yes" is specified on the
xsl:message call, the properties argument of the startDocument() call will be set
to the value ReceiverOptions.TERMINATE
.
receiver
- The receiver to receive xsl:message output.public Receiver getMessageEmitter()
setMessageEmitter(net.sf.saxon.event.Receiver)
method, or the
default message emitter otherwise.public void setRecoveryPolicy(int policy)
Since 9.3 this call has no effect unless the error listener in use is a StandardErrorListener
or a subclass thereof. Calling this method then results in a call to the StandardErrorListener
to set the recovery policy, and the action that is taken on calls of the various methods
error(), fatalError(), and warning() is then the responsibility of the ErrorListener itself.
Since 9.2 the policy for handling the most common recoverable error, namely the ambiguous template
match that arises when a node matches more than one match pattern, is a compile-time rather than run-time
setting, and can be controlled using CompilerInfo.setRecoveryPolicy(int)
policy
- the recovery policy to be used. The options are Configuration.RECOVER_SILENTLY
,
Configuration.RECOVER_WITH_WARNINGS
, or Configuration.DO_NOT_RECOVER
.public int getRecoveryPolicy()
public void setErrorListener(ErrorListener listener)
setErrorListener
in class Transformer
listener
- the ErrorListener to be usedpublic ErrorListener getErrorListener()
getErrorListener
in class Transformer
public void recoverableError(XPathException err) throws XPathException
err
- An exception holding information about the errorXPathException
- if the error listener decides not to
recover from the errorpublic void reportFatalError(XPathException err)
err
- the error to be reportedpublic void warning(String message, String errorCode)
message
- the warning messagepublic Executable getExecutable()
public DocumentPool getDocumentPool()
public void clearDocumentPool()
public void setInitialContextItem(Item item)
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method, the
initial context node is set automatically. This method is useful in XQuery,
to define an initial context node for evaluating global variables, and also
in XSLT 2.0, when the transformation is started by invoking a named template.
When an initial context item is set, it also becomes the context item used for
evaluating global variables. The two context items can only be different when the
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method is used to transform a document starting at a node other
than the root.
In XQuery, the two context items are always the same; in XSLT, the context node for evaluating global variables is the root of the tree containing the initial context item.
item
- The initial context item.public Bindery getBindery()
public Item getInitialContextItem()
setInitialContextItem(net.sf.saxon.om.Item)
method, or the
initial context node set implicitly using methods such as transform(javax.xml.transform.Source, javax.xml.transform.Result)
.public Item getContextForGlobalVariables()
public void setURIResolver(URIResolver resolver)
setURIResolver
in class Transformer
resolver
- An object that implements the URIResolver interface, or
null.public URIResolver getURIResolver()
This method changed in Saxon 8.5, to conform to the JAXP specification. If there is no user-specified URIResolver, it now returns null; previously it returned the system default URIResolver.
getURIResolver
in class Transformer
public URIResolver getStandardURIResolver()
public void setOutputURIResolver(OutputURIResolver resolver)
xsl:result-document
In Saxon 9.5, because xsl:result-document is now multi-threaded, the
supplied resolver is cloned each time a new result document is created.
The cloned resolved is therefore able to maintain information about
the specific result document for use when its close() method is called,
without worrying about thread safety.resolver
- An object that implements the OutputURIResolver
interface, or null.public OutputURIResolver getOutputURIResolver()
setOutputURIResolver(net.sf.saxon.lib.OutputURIResolver)
public void setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
resolver
- the unparsed text URI resolver to be used. This replaces any unparsed text
URI resolver previously registered.public UnparsedTextURIResolver getUnparsedTextURIResolver()
setUnparsedTextURIResolver(net.sf.saxon.lib.UnparsedTextURIResolver)
method.public void setSchemaURIResolver(SchemaURIResolver resolver)
resolver
- the resolver for references to schema documentspublic SchemaURIResolver getSchemaURIResolver()
public void setCollectionURIResolver(CollectionURIResolver resolver)
resolver
- the resolver for references to collectionspublic CollectionURIResolver getCollectionURIResolver()
public void setDefaultCollection(String uri)
uri
- the collection URI of the default collection. May be null, to cause
fallback to the collection name registered with the Configuration. The name will be passed
to the collection URI resolver to identify the documents in the collection, unless
the name is http://saxon.sf.net/collection/empty
which always refers
to the empty collection.public String getDefaultCollection()
public int getSchemaValidationMode()
Validation.STRIP
otherwise.public void setSchemaValidationMode(int validationMode)
validationMode
- the validation (or construction) mode to be used for source documents.
One of Validation.STRIP
, Validation.PRESERVE
, Validation.STRICT
,
Validation.LAX
public KeyManager getKeyManager()
public NamePool getNamePool()
public void setTreeModel(int model)
setModel(net.sf.saxon.om.TreeModel)
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method.model
- the required tree model: Builder.LINKED_TREE
,
Builder.TINY_TREE
, or Builder.TINY_TREE_CONDENSED
Builder
public int getTreeModel()
getModel()
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method.Builder.LINKED_TREE
,
Builder.TINY_TREE
, or Builder.TINY_TREE_CONDENSED
Builder
public void setModel(TreeModel model)
model
- typically one of the constants TreeModel.TINY_TREE
,
TreeModel.TINY_TREE_CONDENSED
, or TreeModel.LINKED_TREE
.
It is also possible to use a user-defined tree model.public TreeModel getModel()
TreeModel.TINY_TREE
,
TreeModel.TINY_TREE_CONDENSED
, or TreeModel.LINKED_TREE
.
It is also possible to use a user-defined tree model.public Builder makeBuilder()
public void setStripSourceTrees(boolean strip)
Generally, stripping whitespace speeds up the transformation if it is done while building the source tree, but slows it down if it is applied to a tree that has already been built. So if the same source tree is used as input to a number of transformations, it is better to strip the whitespace once at the time of tree construction, rather than doing it on-the-fly during each transformation.
strip
- true if whitespace is to be stripped from supplied source trees
as defined by xsl:strip-space; false to suppress whitespace strippingpublic boolean isStripSourceTree()
setStripSourceTrees(boolean)
.public Stripper makeStripper(Receiver next)
xsl:strip-space
and xsl:preserve-space
Configuration.setStripsAllWhiteSpace(boolean)
.next
- the Receiver to which the events filtered by this stripper are
to be sent (often a Builder). May be null if the stripper is not being used for filtering
into a Builder or other Receiver.public SpaceStrippingRule getSpaceStrippingRule()
public void registerDocument(DocumentInfo doc, DocumentURI uri) throws XPathException
doc
- the root node of the document to be added. Must not be null.uri
- the document-URI property of this document. If non-null, the document is registered
in the document pool with this as its document URI.XPathException
public void setRuleManager(RuleManager r)
r
- the Rule Managerpublic RuleManager getRuleManager()
public void setTraceListener(TraceListener listener)
This method has no effect unless the stylesheet or query was compiled with tracing enabled.
listener
- the TraceListener to be set. May be null, in which case
trace events will not be reportedpublic TraceListener getTraceListener()
addTraceListener(net.sf.saxon.lib.TraceListener)
. If more than one TraceListener has been added,
this method will return a composite TraceListener. Because the form
this takes is implementation-dependent, this method is not part of the
stable Saxon public API.public final boolean isTracing()
addTraceListener(net.sf.saxon.lib.TraceListener)
method, and (b) tracing has not been temporarily
paused using the pauseTracing(boolean)
method.public final void pauseTracing(boolean pause)
pause
- true if tracing is to pause; false if it is to resumepublic void addTraceListener(TraceListener trace)
Configuration.setTraceListener(net.sf.saxon.lib.TraceListener)
or by setting
the attribute FeatureKeys.TRACE_LISTENER
on the
TransformerFactory. Conversely, if this property has been set in the
Configuration or TransformerFactory, the TraceListener will automatically
be added to every Controller that uses that Configuration.trace
- the trace listener. If null is supplied, the call has no effect.public void removeTraceListener(TraceListener trace)
trace
- the trace listener.public void setTraceFunctionDestination(PrintStream stream)
stream
- the PrintStream to which trace output will be sent. If set to
null, trace output is suppressed entirely. It is the caller's responsibility
to close the stream after use.public PrintStream getTraceFunctionDestination()
public void setPreparedStylesheet(PreparedStylesheet sheet)
sheet
- the compiled stylesheetpublic void setExecutable(Executable exec)
exec
- the Executablepublic void defineGlobalParameters() throws XPathException
setParameter(java.lang.String, java.lang.Object)
. It checks that all required parameters have been supplied, and places
the values of the parameters in the Bindery to make them available for use during the query or
transformation.
This method is intended for internal use onlyXPathException
- if a required parameter is missingpublic void allocateGlobalVariables(int numberOfVariables)
For internal use only.
numberOfVariables
- the number of global variables for which space is requiredpublic Object getUserData(Object key, String name)
key
- an object acting as a key for this user data value. This must be equal
(in the sense of the equals() method) to the key supplied when the data value was
registered using setUserData(java.lang.Object, java.lang.String, java.lang.Object)
.name
- the name of the required propertypublic void setUserData(Object key, String name, Object data)
key
- an object acting as a key for this user data value. This can be any object, for example
a node or a string. If data for the given object and name already exists, it is overwritten.name
- the name of the required propertydata
- the value of the required property. If null is supplied, any existing entry
for the key is removed.public void transform(Source source, Result result) throws TransformerException
transform
in class Transformer
source
- The input for the source tree. May be null if and only if an
initial template has been supplied.result
- The destination for the result tree.XPathException
- if the transformation fails. As a
special case, the method throws a TerminationException (a subclass
of XPathException) if the transformation was terminated using
xsl:message terminate="yes".TransformerException
public NodeInfo prepareInputTree(Source source)
source
- the input tree. Must be either a DOMSource or a NodeInfopublic void transformDocument(NodeInfo startNode, Result result) throws TransformerException
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method, which is part of the JAXP interface. Note that
NodeInfo
implements the JAXP Source
interface, so
it may be supplied directly to the transform() method.startNode
- A Node that identifies the source document to be
transformed and the node where the transformation should start.
May be null if the transformation is to start using an initial template.result
- The output destinationXPathException
- if any dynamic error occursTransformerException
public void transformStream(Source source, Mode mode, Result result) throws TransformerException
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method, which is part of the JAXP interface. Note that
NodeInfo
implements the JAXP Source
interface, so
it may be supplied directly to the transform() method.source
- the principal input document, supplied as a
SAXSource
, StreamSource
, or Transmitter
mode
- the initial mode, which must be a streaming moderesult
- The output destinationXPathException
- if any dynamic error occursTransformerException
public Receiver getStreamingReceiver(Mode mode, Result result) throws TransformerException
transform(javax.xml.transform.Source, javax.xml.transform.Result)
method, which is part of the JAXP interface. Note that
NodeInfo
implements the JAXP Source
interface, so
it may be supplied directly to the transform() method.
SAXSource
, StreamSource
, or Transmitter
mode
- the initial mode, which must be a streaming moderesult
- The output destinationXPathException
- if any dynamic error occursTransformerException
public void preEvaluateGlobals(XPathContext context) throws XPathException
context
- the dynamic context for evaluating the global variablesXPathException
- - should not happen.public void setGlobalParameterSet(GlobalParameterSet params)
public void setParameter(String expandedName, Object value)
Java Class | XPath 2.0 type |
---|---|
String | xs:string |
Boolean | xs:boolean |
Integer | xs:integer |
Long | xs:integer |
Double | xs:double |
Float | xs:float |
BigDecimal | xs:decimal |
BigInteger | xs:integer |
Date | xs:dateTime |
Array or List of any of the above | sequence of the above |
null | empty sequence |
NodeInfo
object, a sequence of nodes
as an array or List of NodeInfo
objects.
In addition, any object that implements the Saxon Sequence
interface
may be supplied, and will be used without conversion.
A node belong to an external object model (such as DOM, JDOM, or XOM) may be supplied provided (a)
that the external object model is registered with the Configuration, and (b) that the node is part
of a document tree that has been registered in the document pool.setParameter
in class Transformer
expandedName
- The name of the parameter in {uri}local formatvalue
- The value object. This must follow the rules above.
Other formats in addition to those listed above may be accepted.public void setParameter(StructuredQName qName, Sequence value)
qName
- The structured representation of the parameter namevalue
- The value of the parameter, or null to remove a previously set valuepublic void clearParameters()
clearParameters
in class Transformer
public Object getParameter(String expandedName)
setParameter(java.lang.String, java.lang.Object)
method. The value
is returned exactly as supplied, that is, before any conversion to an XPath value.getParameter
in class Transformer
expandedName
- the name of the required parameter, in
"{uri}local-name" formatpublic Iterator iterateParameters()
public void setCurrentDateTime(DateTimeValue dateTime) throws XPathException
Note that comparisons of date/time values currently use the implicit timezone taken from the system clock, not from the value supplied here.
dateTime
- the date/time value to be used as the current date and timeIllegalStateException
- if a current date/time has already been
established by calling getCurrentDateTime(), or by a previous call on setCurrentDateTime()XPathException
- if the supplied dateTime contains no timezonepublic DateTimeValue getCurrentDateTime()
public int getImplicitTimezone()
public XPathContextMajor newXPathContext()
public void setRememberedNumber(NodeInfo node, int number)
node
- the node in questionnumber
- the number of this nodepublic int getRememberedNumber(NodeInfo node)
node
- the node for which remembered information is requiredpublic void setUseDocumentProjection(PathMap pathMap)
pathMap
- a path map to be used for projecting source documentspublic PathMap getPathMapForDocumentProjection()
public void setClassLoader(ClassLoader loader)
loader
- the ClassLoader to be used.public ClassLoader getClassLoader()
setClassLoader(java.lang.ClassLoader)
.
If none has been supplied, return null.
This method is for application use, but is experimental and subject to change.Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.