org.apache.xalan.xsltc.runtime
Class AbstractTranslet

java.lang.Object
  |
  +--org.apache.xalan.xsltc.runtime.AbstractTranslet

public abstract class AbstractTranslet
extends java.lang.Object
implements Translet


Field Summary
 Hashtable _cdata
           
 java.lang.String _doctypePublic
           
 java.lang.String _doctypeSystem
           
 java.lang.String _encoding
           
 Hashtable _formatSymbols
          Decimal number format symbol handling
 boolean _indent
           
 java.lang.String _mediaType
           
 java.lang.String _method
           
 boolean _omitHeader
           
 java.lang.String _standalone
           
 Hashtable _unparsedEntities
          Unparsed entity URI handling - implements unparsed-entity-uri()
 java.lang.String _version
           
 
Constructor Summary
AbstractTranslet()
           
 
Method Summary
 void addAuxiliaryClass(java.lang.Class auxClass)
           
 void addCdataElement(java.lang.String name)
          Add's a name of an element whose text contents should be output as CDATA
 void addDecimalFormat(java.lang.String name, java.text.DecimalFormatSymbols symbols)
          Adds a DecimalFormat object to the _formatSymbols hashtable.
 java.lang.Object addParameter(java.lang.String name, java.lang.Object value)
          Add a new global parameter if not already in the current frame.
 java.lang.Object addParameter(java.lang.String name, java.lang.Object value, boolean isDefault)
          Add a new global or local parameter if not already in the current frame.
 void addUnparsedEntity(java.lang.String name, java.lang.String uri)
          Add an unparsed entity URI.
 void addVariable(int vindex, java.lang.Object value)
          Set the value of a variable in the current frame.
 void buildKeyIndex(java.lang.String name, int node, java.lang.Object value)
          Adds a value to a key/id index
 void buildKeys(DOM document, NodeIterator iterator, TransletOutputHandler handler, int root)
          This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
 void characters(java.lang.String string, TransletOutputHandler handler)
          Used by some compiled code as a shortcut for passing strings to the output handler
 void clearParameters()
          Clears the parameter stack.
 void closeOutputHandler(TransletOutputHandler handler)
           
 KeyIndex createKeyIndex()
          Creates a KeyIndex object of the desired size - don't want to resize!!!
 void displayMessage(java.lang.String msg)
          Pass a message to the message handler - used by Message class.
 java.lang.Class getAuxiliaryClass(java.lang.String className)
           
 java.text.DecimalFormat getDecimalFormat(java.lang.String name)
          Retrieves a named DecimalFormat object from _formatSymbols hashtable.
 DOMCache getDOMCache()
          Returns the DOM cache used for this translet.
 KeyIndex getKeyIndex(java.lang.String name)
          Returns the index for a given key (or id).
 java.lang.Object getParameter(java.lang.String name)
          Get the value of a parameter from the current frame or null if undefined.
 java.lang.String getUnparsedEntity(java.lang.String name)
          Get the value of an unparsed entity URI.
 java.lang.Object getVariable(int vindex)
          Get the value of a variable given its index.
 DOMAdapter makeDOMAdapter(DOM dom)
          Wrap the initial input DOM in a dom adapter.
 TransletOutputHandler openOutputHandler(java.lang.String filename)
          Multiple output document extension.
 void popParamFrame()
          Pop the topmost parameter frame.
 void popVarFrame()
          Pop the topmost variable frame.
 void pushParamFrame()
          Push a new parameter frame.
 void pushVarFrame(int frameSize)
          Push a new variable frame.
 void setDOMCache(DOMCache cache)
          Sets the DOM cache used for additional documents loaded using the document() function.
 void setDTDMonitor(DTDMonitor monitor)
          The DTD monitor used by the DOM builder scans the input document DTD for unparsed entity URIs.
 void setIndexSize(int size)
          This method is used to pass the largest DOM size to the translet.
 void setMessageHandler(MessageHandler handler)
          Set the translet's message handler - must implement MessageHandler
 void setUnparsedEntityURIs(Hashtable table)
          Add an unparsed entity URI.
abstract  void transform(DOM document, NodeIterator iterator, TransletOutputHandler handler)
          Main transform() method - this is overridden by the compiled translet
 void transform(DOM document, TransletOutputHandler handler)
          Calls transform() with a given output handler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_version

public java.lang.String _version

_method

public java.lang.String _method

_encoding

public java.lang.String _encoding

_omitHeader

public boolean _omitHeader

_standalone

public java.lang.String _standalone

_doctypePublic

public java.lang.String _doctypePublic

_doctypeSystem

public java.lang.String _doctypeSystem

_indent

public boolean _indent

_mediaType

public java.lang.String _mediaType

_cdata

public Hashtable _cdata

_formatSymbols

public Hashtable _formatSymbols
Decimal number format symbol handling

_unparsedEntities

public Hashtable _unparsedEntities
Unparsed entity URI handling - implements unparsed-entity-uri()
Constructor Detail

AbstractTranslet

public AbstractTranslet()
Method Detail

makeDOMAdapter

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

pushParamFrame

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

popParamFrame

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

addParameter

public final java.lang.Object addParameter(java.lang.String name,
                                           java.lang.Object value)
Add a new global parameter if not already in the current frame.
Specified by:
addParameter in interface Translet

addParameter

public final java.lang.Object addParameter(java.lang.String name,
                                           java.lang.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.

clearParameters

public void clearParameters()
Clears the parameter stack.

getParameter

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

pushVarFrame

public final void pushVarFrame(int frameSize)
Push a new variable frame.

popVarFrame

public final void popVarFrame()
Pop the topmost variable frame.

getVariable

public final java.lang.Object getVariable(int vindex)
Get the value of a variable given its index.

addVariable

public final void addVariable(int vindex,
                              java.lang.Object value)
Set the value of a variable in the current frame.

setMessageHandler

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

displayMessage

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

addDecimalFormat

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

getDecimalFormat

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

getUnparsedEntity

public final java.lang.String getUnparsedEntity(java.lang.String name)
Get the value of an unparsed entity URI. This method is used by the compiler/UnparsedEntityUriCall class.

addUnparsedEntity

public final void addUnparsedEntity(java.lang.String name,
                                    java.lang.String uri)
Add an unparsed entity URI. The URI/value pairs are passed from the DOM builder to the translet.

setUnparsedEntityURIs

public final void setUnparsedEntityURIs(Hashtable table)
Add an unparsed entity URI. The URI/value pairs are passed from the DOM builder to the translet.

setDTDMonitor

public final void setDTDMonitor(DTDMonitor monitor)
The DTD monitor used by the DOM builder scans the input document DTD for unparsed entity URIs. These are passed to the translet using this method.

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

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

buildKeyIndex

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

getKeyIndex

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

buildKeys

public void buildKeys(DOM document,
                      NodeIterator iterator,
                      TransletOutputHandler handler,
                      int root)
               throws TransletException
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
Specified by:
buildKeys in interface Translet

setDOMCache

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

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.

openOutputHandler

public TransletOutputHandler openOutputHandler(java.lang.String filename)
                                        throws TransletException
Multiple output document extension. See compiler/TransletOutput for actual implementation.

closeOutputHandler

public void closeOutputHandler(TransletOutputHandler handler)

transform

public abstract void transform(DOM document,
                               NodeIterator iterator,
                               TransletOutputHandler handler)
                        throws TransletException
Main transform() method - this is overridden by the compiled translet
Specified by:
transform in interface Translet

transform

public final void transform(DOM document,
                            TransletOutputHandler handler)
                     throws TransletException
Calls transform() with a given output handler
Specified by:
transform in interface Translet

characters

public final void characters(java.lang.String string,
                             TransletOutputHandler handler)
                      throws TransletException
Used by some compiled code as a shortcut for passing strings to the output handler

addCdataElement

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

addAuxiliaryClass

public void addAuxiliaryClass(java.lang.Class auxClass)
Specified by:
addAuxiliaryClass in interface Translet

getAuxiliaryClass

public java.lang.Class getAuxiliaryClass(java.lang.String className)
Specified by:
getAuxiliaryClass in interface Translet


Copyright © 2001 Apache XML Project. All Rights Reserved.