org.apache.xalan.xsltc.runtime

Class AbstractTranslet

public abstract class AbstractTranslet extends Object implements Translet

Author: Jacek Ambroziak Santiago Pericas-Geertsen Morten Jorgensen G. Todd Miller John Howard, JohnH@schemasoft.com

Field Summary
static intCURRENT_TRANSLET_VERSION
static intFIRST_TRANSLET_VERSION
static intVER_SPLIT_NAMES_ARRAY
Vector_cdata
String_doctypePublic
String_doctypeSystem
String_encoding
Hashtable_formatSymbols
Decimal number format symbol handling
boolean_indent
int_indentamount
String_mediaType
String_method
boolean_omitHeader
String_standalone
String_version
Method Summary
voidaddAuxiliaryClass(Class auxClass)
voidaddCdataElement(String name)
Add's a name of an element whose text contents should be output as CDATA
voidaddDecimalFormat(String name, DecimalFormatSymbols symbols)
Adds a DecimalFormat object to the _formatSymbols hashtable.
ObjectaddParameter(String name, Object value)
Add a new global parameter if not already in the current frame.
ObjectaddParameter(String name, Object value, boolean isDefault)
Add a new global or local parameter if not already in the current frame.
voidbuildKeyIndex(String name, int node, Object value)
Adds a value to a key/id index
voidbuildKeyIndex(String name, DOM dom)
Create an empty KeyIndex in the DOM case
voidbuildKeys(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
voidcharacters(String string, SerializationHandler handler)
Used by some compiled code as a shortcut for passing strings to the output handler
voidclearParameters()
Clears the parameter stack.
voidcloseOutputHandler(SerializationHandler handler)
KeyIndexcreateKeyIndex()
Creates a KeyIndex object of the desired size - don't want to resize!
voiddisplayMessage(String msg)
Pass a message to the message handler - used by Message class.
ClassgetAuxiliaryClass(String className)
DecimalFormatgetDecimalFormat(String name)
Retrieves a named DecimalFormat object from _formatSymbols hashtable.
DOMCachegetDOMCache()
Returns the DOM cache used for this translet.
KeyIndexgetKeyIndex(String name)
Returns the index for a given key (or id).
String[]getNamesArray()
String[]getNamespaceArray()
ObjectgetParameter(String name)
Get the value of a parameter from the current frame or null if undefined.
TemplatesgetTemplates()
int[]getTypesArray()
String[]getUrisArray()
booleanhasIdCall()
DOMAdaptermakeDOMAdapter(DOM dom)
Wrap the initial input DOM in a dom adapter.
DocumentnewDocument(String uri, String qname)
SerializationHandleropenOutputHandler(String filename, boolean append)
Multiple output document extension.
SerializationHandleropenOutputHandler(String filename)
voidpopParamFrame()
Pop the topmost parameter frame.
voidpostInitialization()
After constructing the translet object, this method must be called to perform any version-specific post-initialization that's required.
voidprepassDocument(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.
voidprintInternalState()
Debugging
voidpushParamFrame()
Push a new parameter frame.
voidsetAuxiliaryClasses(Hashtable auxClasses)
voidsetDOMCache(DOMCache cache)
Sets the DOM cache used for additional documents loaded using the document() function.
voidsetIndexSize(int size)
This method is used to pass the largest DOM size to the translet.
voidsetKeyIndexDom(String name, DOM document)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
voidsetMessageHandler(MessageHandler handler)
Set the translet's message handler - must implement MessageHandler
voidsetTemplates(Templates templates)
abstract voidtransform(DOM document, DTMAxisIterator iterator, SerializationHandler handler)
Main transform() method - this is overridden by the compiled translet
voidtransform(DOM document, SerializationHandler handler)
Calls transform() with a given output handler

Field Detail

CURRENT_TRANSLET_VERSION

public static final int CURRENT_TRANSLET_VERSION

FIRST_TRANSLET_VERSION

public static final int FIRST_TRANSLET_VERSION

VER_SPLIT_NAMES_ARRAY

public static final int VER_SPLIT_NAMES_ARRAY

_cdata

public Vector _cdata

_doctypePublic

public String _doctypePublic

_doctypeSystem

public String _doctypeSystem

_encoding

public String _encoding

_formatSymbols

public Hashtable _formatSymbols
Decimal number format symbol handling

_indent

public boolean _indent

_indentamount

public int _indentamount

_mediaType

public String _mediaType

_method

public String _method

_omitHeader

public boolean _omitHeader

_standalone

public String _standalone

_version

public String _version

Method Detail

addAuxiliaryClass

public void addAuxiliaryClass(Class auxClass)

addCdataElement

public void addCdataElement(String name)
Add's a name of an element whose text contents should be output as CDATA

addDecimalFormat

public void addDecimalFormat(String name, DecimalFormatSymbols symbols)
Adds a DecimalFormat object to the _formatSymbols hashtable. The entry is created with the input DecimalFormatSymbols.

addParameter

public final Object addParameter(String name, Object value)
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

addParameter

public final Object addParameter(String name, Object value, boolean isDefault)
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 element's select attribute or element body.

buildKeyIndex

public void buildKeyIndex(String name, int node, Object value)
Adds a value to a key/id index

Parameters: name is the name of the index (the key or ##id) node is the node id of the node to insert value is the value that will look up the node in the given index

buildKeyIndex

public void buildKeyIndex(String name, DOM dom)
Create an empty KeyIndex in the DOM case

Parameters: name is the name of the index (the key or ##id) dom is the DOM

buildKeys

public void 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 element is used

characters

public final void characters(String string, SerializationHandler handler)
Used by some compiled code as a shortcut for passing strings to the output handler

clearParameters

public void clearParameters()
Clears the parameter stack.

closeOutputHandler

public void closeOutputHandler(SerializationHandler handler)

createKeyIndex

public KeyIndex createKeyIndex()
Creates a KeyIndex object of the desired size - don't want to resize!!!

displayMessage

public final void displayMessage(String msg)
Pass a message to the message handler - used by Message class.

getAuxiliaryClass

public Class getAuxiliaryClass(String className)

getDecimalFormat

public final DecimalFormat getDecimalFormat(String name)
Retrieves a named DecimalFormat object from _formatSymbols hashtable.

getDOMCache

public DOMCache getDOMCache()
Returns the DOM cache used for this translet. Used by the LoadDocument class (if present) when the document() function is used.

getKeyIndex

public KeyIndex getKeyIndex(String name)
Returns the index for a given key (or id). The index implements our internal iterator interface

getNamesArray

public String[] getNamesArray()

getNamespaceArray

public String[] getNamespaceArray()

getParameter

public final Object getParameter(String name)
Get the value of a parameter from the current frame or null if undefined.

getTemplates

public Templates getTemplates()

getTypesArray

public int[] getTypesArray()

getUrisArray

public String[] getUrisArray()

hasIdCall

public boolean hasIdCall()

makeDOMAdapter

public final DOMAdapter makeDOMAdapter(DOM dom)
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()).

newDocument

public Document newDocument(String uri, String qname)

openOutputHandler

public SerializationHandler openOutputHandler(String filename, boolean append)
Multiple output document extension. See compiler/TransletOutput for actual implementation.

openOutputHandler

public SerializationHandler openOutputHandler(String filename)

popParamFrame

public final void popParamFrame()
Pop the topmost parameter frame.

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.

prepassDocument

public 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. Currently, it only extracts information about attributes of type ID.

printInternalState

public void printInternalState()
Debugging

pushParamFrame

public final void pushParamFrame()
Push a new parameter frame.

setAuxiliaryClasses

public void setAuxiliaryClasses(Hashtable auxClasses)

setDOMCache

public void setDOMCache(DOMCache cache)
Sets the DOM cache used for additional documents loaded using the document() function.

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.

setKeyIndexDom

public void setKeyIndexDom(String name, DOM document)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used

setMessageHandler

public final void setMessageHandler(MessageHandler handler)
Set the translet's message handler - must implement MessageHandler

setTemplates

public void setTemplates(Templates templates)

transform

public abstract void transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler)
Main transform() method - this is overridden by the compiled translet

transform

public final void transform(DOM document, SerializationHandler handler)
Calls transform() with a given output handler
Copyright © 2005 Apache XML Project. All Rights Reserved.