Package org.apache.xalan.xsltc.runtime
Class AbstractTranslet
java.lang.Object
org.apache.xalan.xsltc.runtime.AbstractTranslet
- All Implemented Interfaces:
Translet
- Author:
- Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen, G. Todd Miller, John Howard, JohnH@schemasoft.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionDecimal number format symbol handlingboolean
int
boolean
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAuxiliaryClass
(Class auxClass) void
addCdataElement
(String name) Add's a name of an element whose text contents should be output as CDATAvoid
addDecimalFormat
(String name, DecimalFormatSymbols symbols) Adds a DecimalFormat object to the _formatSymbols hashtable.final Object
addParameter
(String name, Object value) Add a new global parameter if not already in the current frame.final Object
addParameter
(String name, Object value, boolean isDefault) Add a new global or local parameter if not already in the current frame.void
buildKeyIndex
(String name, int node, Object value) Adds a value to a key/id indexvoid
buildKeyIndex
(String name, DOM dom) Create an empty KeyIndex in the DOM casevoid
buildKeys
(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root) This method builds key indexes - it is overridden in the compiled translet in cases where the invalid input: '<'xsl:key> element is usedfinal void
characters
(String string, SerializationHandler handler) Used by some compiled code as a shortcut for passing strings to the output handlervoid
Clears the parameter stack.void
closeOutputHandler
(SerializationHandler handler) Creates a KeyIndex object of the desired size - don't want to resize!!!final void
displayMessage
(String msg) Pass a message to the message handler - used by Message class.getAuxiliaryClass
(String className) final DecimalFormat
getDecimalFormat
(String name) Retrieves a named DecimalFormat object from _formatSymbols hashtable.Returns the DOM cache used for this translet.getKeyIndex
(String name) Returns the index for a given key (or id).String[]
String[]
final Object
getParameter
(String name) Get the value of a parameter from the current frame or null if undefined.int[]
String[]
boolean
final DOMAdapter
makeDOMAdapter
(DOM dom) Wrap the initial input DOM in a dom adapter.newDocument
(String uri, String qname) openOutputHandler
(String filename) openOutputHandler
(String filename, boolean append) Multiple output document extension.final void
Pop the topmost parameter frame.final void
After constructing the translet object, this method must be called to perform any version-specific post-initialization that's required.final void
prepassDocument
(DOM document) Give the translet an opportunity to perform a prepass on the document to extract any information that it can store in an optimized form.void
Debuggingfinal void
Push a new parameter frame.void
setAuxiliaryClasses
(Hashtable auxClasses) void
setDOMCache
(DOMCache cache) Sets the DOM cache used for additional documents loaded using the document() function.void
setIndexSize
(int size) This method is used to pass the largest DOM size to the translet.void
setKeyIndexDom
(String name, DOM document) This method builds key indexes - it is overridden in the compiled translet in cases where the invalid input: '<'xsl:key> element is usedfinal void
setMessageHandler
(MessageHandler handler) Set the translet's message handler - must implement MessageHandlervoid
setTemplates
(Templates templates) abstract void
transform
(DOM document, DTMAxisIterator iterator, SerializationHandler handler) Main transform() method - this is overridden by the compiled transletfinal void
transform
(DOM document, SerializationHandler handler) Calls transform() with a given output handler
-
Field Details
-
_version
-
_method
-
_encoding
-
_omitHeader
public boolean _omitHeader -
_standalone
-
_doctypePublic
-
_doctypeSystem
-
_indent
public boolean _indent -
_mediaType
-
_cdata
-
_indentamount
public int _indentamount -
FIRST_TRANSLET_VERSION
public static final int FIRST_TRANSLET_VERSION- See Also:
-
VER_SPLIT_NAMES_ARRAY
public static final int VER_SPLIT_NAMES_ARRAY- See Also:
-
CURRENT_TRANSLET_VERSION
public static final int CURRENT_TRANSLET_VERSION- See Also:
-
_formatSymbols
Decimal number format symbol handling
-
-
Constructor Details
-
AbstractTranslet
public AbstractTranslet()
-
-
Method Details
-
printInternalState
public void printInternalState()Debugging -
makeDOMAdapter
Wrap the initial input DOM in a dom adapter. This adapter is wrapped in a DOM multiplexer if the document() function is used (handled by compiled code in the translet - see compiler/Stylesheet.compileTransform()).- Throws:
TransletException
-
pushParamFrame
public final void pushParamFrame()Push a new parameter frame. -
popParamFrame
public final void popParamFrame()Pop the topmost parameter frame. -
addParameter
Add a new global parameter if not already in the current frame. To setParameters of the form {http://foo.bar}xyz This needs to get mapped to an instance variable in the class The mapping created so that the global variables in the generated class become http$colon$$flash$$flash$foo$dot$bar$colon$xyz- Specified by:
addParameter
in interfaceTranslet
-
addParameter
Add a new global or local parameter if not already in the current frame. The 'isDefault' parameter is set to true if the value passed is the default value from the invalid input: '<'xsl:parameter> element's select attribute or element body. -
clearParameters
public void clearParameters()Clears the parameter stack. -
getParameter
Get the value of a parameter from the current frame or null if undefined. -
setMessageHandler
Set the translet's message handler - must implement MessageHandler -
displayMessage
Pass a message to the message handler - used by Message class. -
addDecimalFormat
Adds a DecimalFormat object to the _formatSymbols hashtable. The entry is created with the input DecimalFormatSymbols. -
getDecimalFormat
Retrieves a named DecimalFormat object from _formatSymbols hashtable. -
prepassDocument
Give the translet an opportunity to perform a prepass on the document to extract any information that it can store in an optimized form. Currently, it only extracts information about attributes of type ID. -
postInitialization
public final void postInitialization()After constructing the translet object, this method must be called to perform any version-specific post-initialization that's required. -
setIndexSize
public void setIndexSize(int size) This method is used to pass the largest DOM size to the translet. Needed to make sure that the translet can index the whole DOM. -
createKeyIndex
Creates a KeyIndex object of the desired size - don't want to resize!!! -
buildKeyIndex
Adds a value to a key/id index- Parameters:
name
- is the name of the index (the key or ##id)node
- is the node handle of the node to insertvalue
- is the value that will look up the node in the given index
-
buildKeyIndex
Create an empty KeyIndex in the DOM case- Parameters:
name
- is the name of the index (the key or ##id)dom
- is the DOM
-
getKeyIndex
Returns the index for a given key (or id). The index implements our internal iterator interface -
buildKeys
public void buildKeys(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root) throws TransletException This method builds key indexes - it is overridden in the compiled translet in cases where the invalid input: '<'xsl:key> element is used- Specified by:
buildKeys
in interfaceTranslet
- Throws:
TransletException
-
setKeyIndexDom
This method builds key indexes - it is overridden in the compiled translet in cases where the invalid input: '<'xsl:key> element is used -
setDOMCache
Sets the DOM cache used for additional documents loaded using the document() function. -
getDOMCache
Returns the DOM cache used for this translet. Used by the LoadDocument class (if present) when the document() function is used. -
openOutputHandler
public SerializationHandler openOutputHandler(String filename, boolean append) throws TransletException Multiple output document extension. See compiler/TransletOutput for actual implementation.- Throws:
TransletException
-
openOutputHandler
- Throws:
TransletException
-
closeOutputHandler
-
transform
public abstract void transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler) throws TransletException Main transform() method - this is overridden by the compiled translet- Specified by:
transform
in interfaceTranslet
- Throws:
TransletException
-
transform
Calls transform() with a given output handler- Specified by:
transform
in interfaceTranslet
- Throws:
TransletException
-
characters
Used by some compiled code as a shortcut for passing strings to the output handler- Throws:
TransletException
-
addCdataElement
Add's a name of an element whose text contents should be output as CDATA -
addAuxiliaryClass
- Specified by:
addAuxiliaryClass
in interfaceTranslet
-
setAuxiliaryClasses
-
getAuxiliaryClass
- Specified by:
getAuxiliaryClass
in interfaceTranslet
-
getNamesArray
- Specified by:
getNamesArray
in interfaceTranslet
-
getUrisArray
- Specified by:
getUrisArray
in interfaceTranslet
-
getTypesArray
public int[] getTypesArray()- Specified by:
getTypesArray
in interfaceTranslet
-
getNamespaceArray
- Specified by:
getNamespaceArray
in interfaceTranslet
-
hasIdCall
public boolean hasIdCall() -
getTemplates
-
setTemplates
-
newDocument
- Throws:
ParserConfigurationException
-