|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.s9api.XsltTransformer
public class XsltTransformer
An XsltTransformer
represents a compiled and loaded stylesheet ready for execution.
The XsltTransformer
holds details of the dynamic evaluation context for the stylesheet.
An XsltTransformer
must not be used concurrently in multiple threads.
It is safe, however, to reuse the object within a single thread to run the same
stylesheet several times. Running the stylesheet does not change the context
that has been established.
An XsltTransformer
is always constructed by running the Load
method of an XsltExecutable
.
An XsltTransformer
is itself a Destination
. This means it is possible to use
one XsltTransformer
as the destination to receive the results of another transformation,
this providing a simple way for transformations to be chained into a pipeline.
Constructor Summary | |
---|---|
protected |
XsltTransformer(Processor processor,
Controller controller)
Protected constructor |
Method Summary | |
---|---|
Destination |
getDestination()
Get the destination that was specified in a previous call of setDestination(net.sf.saxon.s9api.Destination) |
XdmNode |
getInitialContextNode()
Get the initial context node for the transformation, if one has been set |
QName |
getInitialMode()
Get the initial mode for the transformation, if one has been set. |
QName |
getInitialTemplate()
Get the initial named template for the transformation, if one has been set |
MessageListener |
getMessageListener()
Get the MessageListener to be notified whenever the stylesheet evaluates an xsl:message instruction. |
XdmValue |
getParameter(QName name)
Get the value that has been set for a stylesheet parameter |
Receiver |
getReceiver(Configuration config)
Return a Receiver which can be used to supply the principal source document for the transformation. |
Controller |
getUnderlyingController()
Get the underlying Controller used to implement this XsltTransformer. |
void |
setDestination(Destination destination)
Set the destination to be used for the transformation. |
void |
setInitialContextNode(XdmNode node)
Set the initial context node for the transformation. |
void |
setInitialMode(QName modeName)
Set the initial mode for the transformation |
void |
setInitialTemplate(QName templateName)
Set the initial named template for the transformation |
void |
setMessageListener(MessageListener listener)
Set the MessageListener to be notified whenever the stylesheet evaluates an xsl:message instruction. |
void |
setParameter(QName name,
XdmValue value)
Set the value of a stylesheet parameter |
void |
setSource(javax.xml.transform.Source source)
Set the source document for the transformation. |
void |
transform()
Perform the transformation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected XsltTransformer(Processor processor, Controller controller)
processor
- the S9API processorcontroller
- the Saxon controller objectMethod Detail |
---|
public void setInitialTemplate(QName templateName) throws SaxonApiException
templateName
- the name of the initial template, or null to indicate
that there should be no initial named template
SaxonApiException
- if there is no named template with this namepublic QName getInitialTemplate()
public void setInitialMode(QName modeName)
modeName
- the name of the initial mode, or null to indicate the default
(unnamed) modepublic QName getInitialMode()
public void setSource(javax.xml.transform.Source source) throws SaxonApiException
source
- the principal source document for the transformation
SaxonApiException
public void setInitialContextNode(XdmNode node)
This is ignored in the case where the XsltTransformer
is used as the
Destination
of another process. In that case the initial context node will always
be the document node of the document that is being streamed to this destination.
node
- the initial context node, or null if there is to be no initial context nodepublic XdmNode getInitialContextNode()
XdmNode
instance as was supplied, but it will be an XdmNode object that represents
the same underlying node.public void setParameter(QName name, XdmValue value)
name
- the name of the stylesheet parameter, as a QNamevalue
- the value of the stylesheet parameter, or null to clear a previously set valuepublic XdmValue getParameter(QName name)
name
- the parameter whose name is required
public void setDestination(Destination destination)
This method can be used to chain transformations into a pipeline, by using one
XsltTransformer
as the destination of another
destination
- the destination to be usedpublic Destination getDestination()
setDestination(net.sf.saxon.s9api.Destination)
public void setMessageListener(MessageListener listener)
xsl:message
instruction. If no MessageListener is nominated,
the output of xsl:message
instructions will be serialized and sent
to the standard error stream.
listener
- the MessageListener to be usedpublic MessageListener getMessageListener()
xsl:message
instruction. If no MessageListener has been nominated,
return null
public void transform() throws SaxonApiException
SaxonApiException
- if any dynamic error occurs during the transformation
java.lang.IllegalStateException
- if no destination has been suppliedpublic Receiver getReceiver(Configuration config) throws SaxonApiException
Saxon calls this method to obtain a Receiver, to which it then sends
a sequence of events representing the content of an XML document. This method is provided so that
XsltTransformer
implements Destination
, allowing one transformation
to receive the results of another in a pipeline.
Before calling this method, the setDestination(net.sf.saxon.s9api.Destination)
method must be called to supply a destination
for the transformation.
Note that when an XsltTransformer
is used as a Destination
, the initial
context node set on that XsltTransformer
is ignored.
getReceiver
in interface Destination
config
- The Saxon configuration. This is supplied so that the destination can
use information from the configuration (for example, a reference to the name pool)
to construct or configure the returned Receiver.
SaxonApiException
- if the Receiver cannot be created
java.lang.IllegalStateException
- if no Destination has been suppliedpublic Controller getUnderlyingController()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |