Class TransformerImpl
- All Implemented Interfaces:
Runnable,DTMWSFilter,SerializerTrace,ExtensionsProvider
public class TransformerImpl extends Transformer implements Runnable, DTMWSFilter, ExtensionsProvider, SerializerTrace
Transformer interface, and is the core
representation of the transformation execution.-
Field Summary
Fields inherited from interface org.apache.xml.dtm.DTMWSFilter
INHERIT, NOTSTRIP, STRIPFields inherited from interface org.apache.xml.serializer.SerializerTrace
EVENTTYPE_CDATA, EVENTTYPE_CHARACTERS, EVENTTYPE_COMMENT, EVENTTYPE_ENDDOCUMENT, EVENTTYPE_ENDELEMENT, EVENTTYPE_ENTITYREF, EVENTTYPE_IGNORABLEWHITESPACE, EVENTTYPE_OUTPUT_CHARACTERS, EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS, EVENTTYPE_PI, EVENTTYPE_STARTDOCUMENT, EVENTTYPE_STARTELEMENT -
Constructor Summary
Constructors Constructor Description TransformerImpl(StylesheetRoot stylesheet)Construct a TransformerImpl. -
Method Summary
Modifier and Type Method Description booleanapplyTemplateToNode(ElemTemplateElement xslInstruction, ElemTemplate template, int child)Given an element and mode, find the corresponding template and process the contents.voidclearParameters()Reset the parameters to a null list.SerializationHandlercreateSerializationHandler(Result outputTarget)Create a result ContentHandler from a Result object, based on the current OutputProperties.SerializationHandlercreateSerializationHandler(Result outputTarget, OutputProperties format)Create a ContentHandler from a Result object and an OutputProperties.booleancurrentFuncResultSeen()Determines whether an EXSLTfunc:resultinstruction has been executed for the currently active EXSLTfunc:function.booleancurrentTemplateRuleIsNull()Tell if the current template rule is null, i.e.booleanelementAvailable(String ns, String elemName)Is the extension element available?voidexecuteChildTemplates(ElemTemplateElement elem, boolean shouldAddAttrs)Execute each of the children of a template element.voidexecuteChildTemplates(ElemTemplateElement elem, Node context, QName mode, ContentHandler handler)Execute each of the children of a template element.voidexecuteChildTemplates(ElemTemplateElement elem, ContentHandler handler)Execute each of the children of a template element.ObjectextFunction(String ns, String funcName, Vector argVec, Object methodKey)Execute the extension function.ObjectextFunction(FuncExtFunction extFunction, Vector argVec)Execute the extension function.voidfireGenerateEvent(int eventType)Fire off startDocument, endDocument events.voidfireGenerateEvent(int eventType, char[] ch, int start, int length)Fire off characters, cdate events.voidfireGenerateEvent(int eventType, String data)Fire off comment and entity ref events.voidfireGenerateEvent(int eventType, String name, String data)Fire off processingInstruction events.voidfireGenerateEvent(int eventType, String name, Attributes atts)Fire off startElement, endElement events.booleanfunctionAvailable(String ns, String funcName)Is the extension function available?ContentHandlergetContentHandler()Get the content event handler.DTMIteratorgetContextNodeList()Get the current context node list.CountersTablegetCountersTable()Get the table of counters, for optimized xsl:number support.ElemTemplateElementgetCurrentElement()Retrieves the current ElemTemplateElement that is being executed.intgetCurrentNode()This method retrieves the current context node in the source tree.ElemTemplategetCurrentTemplate()This method retrieves the xsl:template that is in effect, which may be a matched template or a named template.ObjectStackgetCurrentTemplateElements()Get the count of how many elements are active.intgetCurrentTemplateElementsCount()Get the count of how many elements are active.ErrorListenergetErrorListener()Get the current error event handler.ExceptiongetExceptionThrown()Get the exception thrown by the secondary thread (normally the transform thread).ExtensionsTablegetExtensionsTable()Get the extensions table object.booleangetFeature(String name)Look up the value of a feature.booleangetIncremental()ContentHandlergetInputContentHandler()Get a SAX2 ContentHandler for the input.ContentHandlergetInputContentHandler(boolean doDocFrag)Get a SAX2 ContentHandler for the input.KeyManagergetKeyManager()Get the KeyManager object.intgetMatchedNode()Retrieves the node in the source tree that matched the template obtained via getMatchedTemplate().ElemTemplategetMatchedTemplate()This method retrieves the xsl:template that was matched.QNamegetMode()NEEDSDOC Method getMode NEEDSDOC (getMode) @returnMsgMgrgetMsgMgr()Return the message manager.booleangetOptimize()OutputPropertiesgetOutputFormat()Get the output properties used for the transformation.PropertiesgetOutputProperties()Get a copy of the output properties for the transformation.StringgetOutputProperty(String qnameString)Get an output property that is in effect for the transformation.StringgetOutputPropertyNoDefault(String qnameString)Get the value of a property, without using the default properties.ObjectgetParameter(String name)Get a parameter that was explicitly set with setParameter or setParameters.booleangetQuietConflictWarnings()Get quietConflictWarnings property.SerializationHandlergetResultTreeHandler()Get the SerializationHandler object.SerializationHandlergetSerializationHandler()Get the SerializationHandler object.shortgetShouldStripSpace(int elementHandle, DTM dtm)Test whether whitespace-only text nodes are visible in the logical view ofDTM.booleangetSource_location()StylesheetRootgetStylesheet()Get the current stylesheet for this processor.TransformergetTransformer()Get the TrAX Transformer object in effect.ThreadgetTransformThread()Get the thread that the transform process is on.URIResolvergetURIResolver()Get an object that will be used to resolve URIs used in document(), etc.XPathContextgetXPathContext()Get the XPath context associated with this transformer.booleanhasTraceListeners()Tell if trace listeners are present.booleanhasTransformThreadErrorCatcher()Return true if the transform was initiated from the transform method, otherwise it was probably done from a pure parse events.voidinit(ToXMLSAXHandler h, Transformer transformer, ContentHandler realHandler)Initializer method.booleanisRecursiveAttrSet(ElemAttributeSet attrSet)Check to see if this is a recursive attribute definition.ObjectpopCurrentFuncResult()Pops the result of the currently active EXSLTfunc:function.voidpopCurrentMatched()Pop the elements that were pushed via pushPairCurrentMatched.voidpopCurrentTemplateRuleIsNull()Push true if the current template rule is null, false otherwise.voidpopElemAttributeSet()Pop the current executing attribute set.voidpopElemTemplateElement()Pop the current template element.voidpopMode()NEEDSDOC Method popModeVectorprocessSortKeys(ElemForEach foreach, int sourceNodeContext)Get the keys for the xsl:sort elements.voidpushCurrentFuncResult(Object val)Push a funcion result for the currently active EXSLTfunc:function.voidpushCurrentTemplateRuleIsNull(boolean b)Push true if the current template rule is null, false otherwise.voidpushElemAttributeSet(ElemAttributeSet attrSet)Push an executing attribute set, so we can check for recursive attribute definitions.voidpushElemTemplateElement(ElemTemplateElement elem)Push the current template element.protected voidpushGlobalVars(int contextNode)Internal -- push the global variables from the Stylesheet onto the context's runtime variable stack.voidpushMode(QName mode)NEEDSDOC Method pushMode NEEDSDOC @param modevoidpushPairCurrentMatched(ElemTemplateElement template, int child)Push both the current xsl:template or xsl:for-each onto the stack, along with the child node that was matched.voidreset()Reset the state.voidrun()Run the transform thread.voidrunTransformThread()Called by this.transform() if isParserEventsOnMain()==false.voidrunTransformThread(int priority)Called by SourceTreeHandler to start the transformation in a separate thread NEEDSDOC @param prioritystatic voidrunTransformThread(Runnable runnable)Called by CoRoutineSAXParser.voidsetBaseURLOfSource(String base)Get the base URL of the source.voidsetContentHandler(ContentHandler handler)Set the content event handler.voidsetCurrentElement(ElemTemplateElement e)Set the top of the current template elements stack.voidsetErrorListener(ErrorListener listener)Set the error event listener.voidsetExceptionThrown(Exception e)Set the exception thrown by the secondary thread (normally the transform thread).voidsetOutputFormat(OutputProperties oformat)Set the output properties for the transformation.voidsetOutputProperties(Properties oformat)Set the output properties for the transformation.voidsetOutputProperty(String name, String value)This method is used to set or override the value of the effective xsl:output attribute values specified in the stylesheet.voidsetParameter(String name, Object value)Set a parameter for the transformation.voidsetParameter(String name, String namespace, Object value)Set a parameter for the templates.voidsetParameters(Properties params)Set a bag of parameters for the transformation.voidsetSerializationHandler(SerializationHandler xoh)voidsetSourceTreeDocForThread(int doc)This is just a way to set the document for run().voidsetStylesheet(StylesheetRoot stylesheetRoot)Set the stylesheet for this processor.voidsetTransformThread(Thread t)Get the thread that the transform process is on.voidsetURIResolver(URIResolver resolver)Set an object that will be used to resolve URIs used in document(), etc.voidsetXPathContext(XPathContext xcontext)Set the execution context for XPath.voidtransform(Source source)Process the source tree to SAX parse events.voidtransform(Source source, boolean shouldRelease)Process the source tree to SAX parse events.voidtransform(Source xmlSource, Result outputTarget)Process the source tree to the output result.voidtransform(Source xmlSource, Result outputTarget, boolean shouldRelease)Process the source tree to the output result.voidtransformNode(int node)Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature.voidtransformNode(int node, Result outputTarget)Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature.inttransformToGlobalRTF(ElemTemplateElement templateParent)Given a stylesheet element, create a result tree fragment from it's contents.inttransformToRTF(ElemTemplateElement templateParent)Given a stylesheet element, create a result tree fragment from it's contents.StringtransformToString(ElemTemplateElement elem)Take the contents of a template element, process it, and convert it to a string.voidwaitTransformThread()Used by SourceTreeHandler to wait until the transform completes
-
Constructor Details
-
TransformerImpl
Construct a TransformerImpl.- Parameters:
stylesheet- The root of the stylesheet tree.
-
-
Method Details
-
getExtensionsTable
Get the extensions table object.- Returns:
- The extensions table.
-
functionAvailable
Description copied from interface:ExtensionsProviderIs the extension function available?- Specified by:
functionAvailablein interfaceExtensionsProvider- Throws:
TransformerException
-
elementAvailable
Description copied from interface:ExtensionsProviderIs the extension element available?- Specified by:
elementAvailablein interfaceExtensionsProvider- Throws:
TransformerException
-
extFunction
public Object extFunction(String ns, String funcName, Vector argVec, Object methodKey) throws TransformerExceptionDescription copied from interface:ExtensionsProviderExecute the extension function.- Specified by:
extFunctionin interfaceExtensionsProvider- Throws:
TransformerException
-
extFunction
Description copied from interface:ExtensionsProviderExecute the extension function.- Specified by:
extFunctionin interfaceExtensionsProvider- Throws:
TransformerException
-
reset
public void reset()Reset the state. This needs to be called after a process() call is invoked, if the processor is to be used again.- Overrides:
resetin classTransformer
-
getTransformThread
Get the thread that the transform process is on.- Returns:
- The thread that the transform process is on, or null.
-
setTransformThread
Get the thread that the transform process is on.- Parameters:
t- The transform thread, may be null.
-
hasTransformThreadErrorCatcher
public boolean hasTransformThreadErrorCatcher()Return true if the transform was initiated from the transform method, otherwise it was probably done from a pure parse events. NEEDSDOC ($objectName$) @return -
transform
Process the source tree to SAX parse events.- Parameters:
source- The input for the source tree.- Throws:
TransformerException
-
transform
Process the source tree to SAX parse events.- Parameters:
source- The input for the source tree.shouldRelease- Flag indicating whether to release DTMManager.- Throws:
TransformerException
-
setBaseURLOfSource
Get the base URL of the source. NEEDSDOC @param base -
getOutputProperty
Get an output property that is in effect for the transformation. The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet. NEEDSDOC @param qnameString- Specified by:
getOutputPropertyin classTransformer- Parameters:
qnameString- A non-null String that specifies an output property name, which may be namespace qualified.- Returns:
- The string value of the output property, or null if no property was found.
- Throws:
IllegalArgumentException- If the property is not supported.- See Also:
OutputKeys
-
getOutputPropertyNoDefault
Get the value of a property, without using the default properties. This can be used to test if a property has been explicitly set by the stylesheet or user. NEEDSDOC @param qnameString- Returns:
- The value of the property, or null if not found.
- Throws:
IllegalArgumentException- If the property is not supported, and is not namespaced.
-
setOutputProperty
This method is used to set or override the value of the effective xsl:output attribute values specified in the stylesheet.The recognized standard output properties are:
- cdata-section-elements
- doctype-system
- doctype-public
- indent
- media-type
- method
- omit-xml-declaration
- standalone
- version
For example:
tran.setOutputProperty("standalone", "yes");In the case of the cdata-section-elements property, the value should be a whitespace separated list of element names. The element name is the local name of the element, if it is in no namespace, or, the URI in braces followed immediately by the local name if the element is in that namespace. For example:
tran.setOutputProperty( "cdata-section-elements", "elem1 {http://example.uri}elem2 elem3");The recognized Xalan extension elements are:
- content-handler
- entities
- indent-amount
- line-separator
- omit-meta-tag
- use-url-escaping
These must be in the extension namespace of "http://xml.apache.org/xalan". This is accomplished by putting the namespace URI in braces before the property name, for example:
tran.setOutputProperty( "{http://xml.apache.org/xalan}line-separator" , "\n");- Specified by:
setOutputPropertyin classTransformer- Parameters:
name- The property name.value- The requested value for the property.- Throws:
IllegalArgumentException- if the property name is not legal.- See Also:
OutputKeys
-
setOutputProperties
Set the output properties for the transformation. These properties will override properties set in the templates with xsl:output.If argument to this function is null, any properties previously set will be removed.
- Specified by:
setOutputPropertiesin classTransformer- Parameters:
oformat- A set of output properties that will be used to override any of the same properties in effect for the transformation.- Throws:
IllegalArgumentException- if any of the argument keys are not recognized and are not namespace qualified.- See Also:
OutputKeys,Properties
-
getOutputProperties
Get a copy of the output properties for the transformation. These properties will override properties set in the templates with xsl:output.Note that mutation of the Properties object returned will not effect the properties that the transformation contains.
- Specified by:
getOutputPropertiesin classTransformer- Returns:
- A copy of the set of output properties in effect for the next transformation. NEEDSDOC ($objectName$) @return
- See Also:
OutputKeys,Properties, XSL Transformations (XSLT) Version 1.0
-
createSerializationHandler
public SerializationHandler createSerializationHandler(Result outputTarget) throws TransformerExceptionCreate a result ContentHandler from a Result object, based on the current OutputProperties.- Parameters:
outputTarget- Where the transform result should go, should not be null.- Returns:
- A valid ContentHandler that will create the result tree when it is fed SAX events.
- Throws:
TransformerException
-
createSerializationHandler
public SerializationHandler createSerializationHandler(Result outputTarget, OutputProperties format) throws TransformerExceptionCreate a ContentHandler from a Result object and an OutputProperties.- Parameters:
outputTarget- Where the transform result should go, should not be null.format- The OutputProperties object that will contain instructions on how to serialize the output.- Returns:
- A valid ContentHandler that will create the result tree when it is fed SAX events.
- Throws:
TransformerException
-
transform
Process the source tree to the output result.- Specified by:
transformin classTransformer- Parameters:
xmlSource- The input for the source tree.outputTarget- The output source target.- Throws:
TransformerException
-
transform
public void transform(Source xmlSource, Result outputTarget, boolean shouldRelease) throws TransformerExceptionProcess the source tree to the output result.- Parameters:
xmlSource- The input for the source tree.outputTarget- The output source target.shouldRelease- Flag indicating whether to release DTMManager.- Throws:
TransformerException
-
transformNode
Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature. %REVIEW% Do we need a Node version of this?- Parameters:
node- The input source node, which can be any valid DTM node.outputTarget- The output source target.- Throws:
TransformerException
-
transformNode
Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature. %REVIEW% Do we need a Node version of this?- Parameters:
node- The input source node, which can be any valid DTM node.- Throws:
TransformerException
-
getInputContentHandler
Get a SAX2 ContentHandler for the input.- Returns:
- A valid ContentHandler, which should never be null, as long as getFeature("http://xml.org/trax/features/sax/input") returns true.
-
getInputContentHandler
Get a SAX2 ContentHandler for the input.- Parameters:
doDocFrag- true if a DocumentFragment should be created as the root, rather than a Document.- Returns:
- A valid ContentHandler, which should never be null, as long as getFeature("http://xml.org/trax/features/sax/input") returns true.
-
setOutputFormat
Set the output properties for the transformation. These properties will override properties set in the templates with xsl:output.- Parameters:
oformat- A valid OutputProperties object (which will not be mutated), or null.
-
getOutputFormat
Get the output properties used for the transformation.- Returns:
- the output format that was set by the user, otherwise the output format from the stylesheet.
-
setParameter
Set a parameter for the templates.- Parameters:
name- The name of the parameter.namespace- The namespace of the parameter.value- The value object. This can be any valid Java object -- it's up to the processor to provide the proper coersion to the object, or simply pass it on for use in extensions.
-
setParameter
Set a parameter for the transformation.- Specified by:
setParameterin classTransformer- Parameters:
name- The name of the parameter, which may have a namespace URI.value- The value object. This can be any valid Java object -- it's up to the processor to provide the proper coersion to the object, or simply pass it on for use in extensions.
-
getParameter
Get a parameter that was explicitly set with setParameter or setParameters. NEEDSDOC @param name- Specified by:
getParameterin classTransformer- Parameters:
name- ofObjectto get- Returns:
- A parameter that has been set with setParameter or setParameters, *not* all the xsl:params on the stylesheet (which require a transformation Source to be evaluated).
-
setParameters
Set a bag of parameters for the transformation. Note that these will not be additive, they will replace the existing set of parameters. NEEDSDOC @param params -
clearParameters
public void clearParameters()Reset the parameters to a null list.- Specified by:
clearParametersin classTransformer
-
pushGlobalVars
Internal -- push the global variables from the Stylesheet onto the context's runtime variable stack.If we encounter a variable that is already defined in the variable stack, we ignore it. This is because the second variable definition will be at a lower import precedence. Presumably, global"variables at the same import precedence with the same name will have been caught during the recompose process.
However, if we encounter a parameter that is already defined in the variable stack, we need to see if this is a parameter whose value was supplied by a setParameter call. If so, we need to "receive" the one already in the stack, ignoring this one. If it is just an earlier xsl:param or xsl:variable definition, we ignore it using the same reasoning as explained above for the variable.
- Parameters:
contextNode- The root of the source tree, can't be null.- Throws:
TransformerException
-
setURIResolver
Set an object that will be used to resolve URIs used in document(), etc.- Specified by:
setURIResolverin classTransformer- Parameters:
resolver- An object that implements the URIResolver interface, or null.
-
getURIResolver
Get an object that will be used to resolve URIs used in document(), etc.- Specified by:
getURIResolverin classTransformer- Returns:
- An object that implements the URIResolver interface, or null.
-
setContentHandler
Set the content event handler. NEEDSDOC @param handler- Throws:
NullPointerException- If the handler is null.- See Also:
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
-
getContentHandler
Get the content event handler.- Returns:
- The current content handler, or null if none was set.
- See Also:
XMLReader.getContentHandler()
-
transformToRTF
Given a stylesheet element, create a result tree fragment from it's contents. The fragment will be built within the shared RTF DTM system used as a variable stack.- Parameters:
templateParent- The template element that holds the fragment.- Returns:
- the NodeHandle for the root node of the resulting RTF.
- Throws:
TransformerException
-
transformToGlobalRTF
Given a stylesheet element, create a result tree fragment from it's contents. The fragment will also use the shared DTM system, but will obtain its space from the global variable pool rather than the dynamic variable stack. This allows late binding of XUnresolvedVariables without the risk that their content will be discarded when the variable stack is popped.- Parameters:
templateParent- The template element that holds the fragment.- Returns:
- the NodeHandle for the root node of the resulting RTF.
- Throws:
TransformerException
-
transformToString
Take the contents of a template element, process it, and convert it to a string.- Parameters:
elem- The parent element whose children will be output as a string.- Returns:
- The stringized result of executing the elements children.
- Throws:
TransformerException
-
applyTemplateToNode
public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, ElemTemplate template, int child) throws TransformerExceptionGiven an element and mode, find the corresponding template and process the contents.- Parameters:
xslInstruction- The calling element.template- The template to use if xsl:for-each, current template for apply-imports, or null.child- The source context node.- Returns:
- true if applied a template, false if not.
- Throws:
TransformerException
-
executeChildTemplates
public void executeChildTemplates(ElemTemplateElement elem, Node context, QName mode, ContentHandler handler) throws TransformerExceptionExecute each of the children of a template element. This method is only for extension use.- Parameters:
elem- The ElemTemplateElement that contains the children that should execute. NEEDSDOC @param contextmode- The current mode.handler- The ContentHandler to where the result events should be fed.- Throws:
TransformerException
-
executeChildTemplates
public void executeChildTemplates(ElemTemplateElement elem, boolean shouldAddAttrs) throws TransformerExceptionExecute each of the children of a template element.- Parameters:
elem- The ElemTemplateElement that contains the children that should execute.shouldAddAttrs- true if xsl:attributes should be executed.- Throws:
TransformerException
-
executeChildTemplates
public void executeChildTemplates(ElemTemplateElement elem, ContentHandler handler) throws TransformerExceptionExecute each of the children of a template element.- Parameters:
elem- The ElemTemplateElement that contains the children that should execute.handler- The ContentHandler to where the result events should be fed.- Throws:
TransformerException
-
processSortKeys
public Vector processSortKeys(ElemForEach foreach, int sourceNodeContext) throws TransformerExceptionGet the keys for the xsl:sort elements. Note: Should this go into ElemForEach?- Parameters:
foreach- Valid ElemForEach element, not null.sourceNodeContext- The current node context in the source tree, needed to evaluate the Attribute Value Templates.- Returns:
- A Vector of NodeSortKeys, or null.
- Throws:
TransformerException
-
getCurrentTemplateElementsCount
public int getCurrentTemplateElementsCount()Get the count of how many elements are active.- Returns:
- The number of active elements on the currentTemplateElements stack.
-
getCurrentTemplateElements
Get the count of how many elements are active.- Returns:
- The number of active elements on the currentTemplateElements stack.
-
pushElemTemplateElement
Push the current template element.- Parameters:
elem- The current ElemTemplateElement (may be null, and then set via setCurrentElement).
-
popElemTemplateElement
public void popElemTemplateElement()Pop the current template element. -
setCurrentElement
Set the top of the current template elements stack.- Parameters:
e- The current ElemTemplateElement about to be executed.
-
getCurrentElement
Retrieves the current ElemTemplateElement that is being executed.- Returns:
- The current ElemTemplateElement that is executing, should not normally be null.
-
getCurrentNode
public int getCurrentNode()This method retrieves the current context node in the source tree.- Returns:
- The current context node (should never be null?).
-
getCurrentTemplate
This method retrieves the xsl:template that is in effect, which may be a matched template or a named template.Please note that the ElemTemplate returned may be a default template, and thus may not have a template defined in the stylesheet.
- Returns:
- The current xsl:template, should not be null.
-
pushPairCurrentMatched
Push both the current xsl:template or xsl:for-each onto the stack, along with the child node that was matched. (Note: should this only be used for xsl:templates?? -sb)- Parameters:
template- xsl:template or xsl:for-each.child- The child that was matched.
-
popCurrentMatched
public void popCurrentMatched()Pop the elements that were pushed via pushPairCurrentMatched. -
getMatchedTemplate
This method retrieves the xsl:template that was matched. Note that this may not be the same thing as the current template (which may be from getCurrentElement()), since a named template may be in effect.- Returns:
- The pushed template that was pushed via pushPairCurrentMatched.
-
getMatchedNode
public int getMatchedNode()Retrieves the node in the source tree that matched the template obtained via getMatchedTemplate().- Returns:
- The matched node that corresponds to the match attribute of the current xsl:template.
-
getContextNodeList
Get the current context node list.- Returns:
- A reset clone of the context node list.
-
getTransformer
Get the TrAX Transformer object in effect.- Returns:
- This object.
-
setStylesheet
Set the stylesheet for this processor. If this is set, then the process calls that take only the input .xml will use this instead of looking for a stylesheet PI. Also, setting the stylesheet is needed if you are going to use the processor as a SAX ContentHandler.- Parameters:
stylesheetRoot- A non-null StylesheetRoot object, or null if you wish to clear the stylesheet reference.
-
getStylesheet
Get the current stylesheet for this processor.- Returns:
- The stylesheet that is associated with this transformer.
-
getQuietConflictWarnings
public boolean getQuietConflictWarnings()Get quietConflictWarnings property. If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream.- Returns:
- True if this transformer should not report template match conflicts.
-
setXPathContext
Set the execution context for XPath.- Parameters:
xcontext- A non-null reference to the XPathContext associated with this transformer.
-
getXPathContext
Get the XPath context associated with this transformer.- Returns:
- The XPathContext reference, never null.
-
getResultTreeHandler
Get the SerializationHandler object.- Returns:
- The current SerializationHandler, which may not be the main result tree manager.
-
getSerializationHandler
Get the SerializationHandler object.- Returns:
- The current SerializationHandler, which may not be the main result tree manager.
-
getKeyManager
Get the KeyManager object.- Returns:
- A reference to the KeyManager object, which should never be null.
-
isRecursiveAttrSet
Check to see if this is a recursive attribute definition.- Parameters:
attrSet- A non-null ElemAttributeSet reference.- Returns:
- true if the attribute set is recursive.
-
pushElemAttributeSet
Push an executing attribute set, so we can check for recursive attribute definitions.- Parameters:
attrSet- A non-null ElemAttributeSet reference.
-
popElemAttributeSet
public void popElemAttributeSet()Pop the current executing attribute set. -
getCountersTable
Get the table of counters, for optimized xsl:number support.- Returns:
- The CountersTable, never null.
-
currentTemplateRuleIsNull
public boolean currentTemplateRuleIsNull()Tell if the current template rule is null, i.e. if we are directly within an apply-templates. Used for xsl:apply-imports.- Returns:
- True if the current template rule is null.
-
pushCurrentTemplateRuleIsNull
public void pushCurrentTemplateRuleIsNull(boolean b)Push true if the current template rule is null, false otherwise.- Parameters:
b- True if the we are executing an xsl:for-each (or xsl:call-template?).
-
popCurrentTemplateRuleIsNull
public void popCurrentTemplateRuleIsNull()Push true if the current template rule is null, false otherwise. -
pushCurrentFuncResult
Push a funcion result for the currently active EXSLTfunc:function.- Parameters:
val- the result of executing an EXSLTfunc:resultinstruction for the currentfunc:function.
-
popCurrentFuncResult
Pops the result of the currently active EXSLTfunc:function.- Returns:
- the value of the
func:function
-
currentFuncResultSeen
public boolean currentFuncResultSeen()Determines whether an EXSLTfunc:resultinstruction has been executed for the currently active EXSLTfunc:function.- Returns:
trueif and only if afunc:resultinstruction has been executed
-
getMsgMgr
Return the message manager.- Returns:
- The message manager, never null.
-
setErrorListener
Set the error event listener.- Specified by:
setErrorListenerin classTransformer- Parameters:
listener- The new error listener.- Throws:
IllegalArgumentException- if
-
getErrorListener
Get the current error event handler.- Specified by:
getErrorListenerin classTransformer- Returns:
- The current error handler, which should never be null.
-
getFeature
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.
Open issues:
Should getFeature be changed to hasFeature?
- Keith Visco writes: Should getFeature be changed to hasFeature? It returns a boolean which indicated whether the "state" of feature is "true or false". I assume this means whether or not a feature is supported? I know SAX is using "getFeature", but to me "hasFeature" is cleaner.
- Parameters:
name- The feature name, which is a fully-qualified URI.- Returns:
- The current state of the feature (true or false).
- Throws:
SAXNotRecognizedException- When the TransformerFactory does not recognize the feature name.SAXNotSupportedException- When the TransformerFactory recognizes the feature name but cannot determine its value at this time.SAXNotRecognizedExceptionSAXNotSupportedException
-
getMode
NEEDSDOC Method getMode NEEDSDOC (getMode) @return -
pushMode
NEEDSDOC Method pushMode NEEDSDOC @param mode -
popMode
public void popMode()NEEDSDOC Method popMode -
runTransformThread
public void runTransformThread(int priority)Called by SourceTreeHandler to start the transformation in a separate thread NEEDSDOC @param priority -
runTransformThread
public void runTransformThread()Called by this.transform() if isParserEventsOnMain()==false. Similar with runTransformThread(), but no priority is set and setTransformThread is not set. -
runTransformThread
Called by CoRoutineSAXParser. Launches the CoroutineSAXParser in a thread, and prepares it to invoke the parser from that thread upon request. -
waitTransformThread
Used by SourceTreeHandler to wait until the transform completes- Throws:
SAXException
-
getExceptionThrown
Get the exception thrown by the secondary thread (normally the transform thread).- Returns:
- The thrown exception, or null if no exception was thrown.
-
setExceptionThrown
Set the exception thrown by the secondary thread (normally the transform thread).- Parameters:
e- The thrown exception, or null if no exception was thrown.
-
setSourceTreeDocForThread
public void setSourceTreeDocForThread(int doc)This is just a way to set the document for run().- Parameters:
doc- A non-null reference to the root of the tree to be transformed.
-
run
public void run()Run the transform thread. -
getShouldStripSpace
Test whether whitespace-only text nodes are visible in the logical view ofDTM. Normally, this function will be called by the implementation ofDTM; it is not normally called directly from user code.- Specified by:
getShouldStripSpacein interfaceDTMWSFilter- Parameters:
elementHandle- int Handle of the element.- Returns:
- one of NOTSTRIP, STRIP, or INHERIT.
-
init
Initializer method.- Parameters:
transformer- non-null transformer instancerealHandler- Content Handler instance
-
setSerializationHandler
-
fireGenerateEvent
public void fireGenerateEvent(int eventType, char[] ch, int start, int length)Fire off characters, cdate events.- Specified by:
fireGenerateEventin interfaceSerializerTrace- Parameters:
eventType- One of the EVENTTYPE_XXX constants.ch- The char array from the SAX event.start- The start offset to be used in the char array.length- The end offset to be used in the chara array.- See Also:
SerializerTrace.fireGenerateEvent(int, char[], int, int)
-
fireGenerateEvent
Fire off startElement, endElement events.- Specified by:
fireGenerateEventin interfaceSerializerTrace- Parameters:
eventType- One of the EVENTTYPE_XXX constants.name- The name of the element.atts- The SAX attribute list.- See Also:
SerializerTrace.fireGenerateEvent(int, String, Attributes)
-
fireGenerateEvent
Fire off processingInstruction events.- Specified by:
fireGenerateEventin interfaceSerializerTrace- Parameters:
eventType- One of the EVENTTYPE_XXX constants.name- The name of the processing instruction.data- The processing instruction data.
-
fireGenerateEvent
Fire off comment and entity ref events.- Specified by:
fireGenerateEventin interfaceSerializerTrace- Parameters:
eventType- One of the EVENTTYPE_XXX constants.data- The comment or entity ref data.- See Also:
SerializerTrace.fireGenerateEvent(int, String)
-
fireGenerateEvent
public void fireGenerateEvent(int eventType)Fire off startDocument, endDocument events.- Specified by:
fireGenerateEventin interfaceSerializerTrace- Parameters:
eventType- One of the EVENTTYPE_XXX constants.- See Also:
SerializerTrace.fireGenerateEvent(int)
-
hasTraceListeners
public boolean hasTraceListeners()Description copied from interface:SerializerTraceTell if trace listeners are present.- Specified by:
hasTraceListenersin interfaceSerializerTrace- Returns:
- True if there are trace listeners
- See Also:
SerializerTrace.hasTraceListeners()
-
getIncremental
public boolean getIncremental()- Returns:
- Incremental flag
-
getOptimize
public boolean getOptimize()- Returns:
- Optimization flag
-
getSource_location
public boolean getSource_location()- Returns:
- Source location flag
-