Class AbstractTranslet

java.lang.Object
org.apache.xalan.xsltc.runtime.AbstractTranslet
All Implemented Interfaces:
Translet

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 Details

    • _version

      public String _version
    • _method

      public String _method
    • _encoding

      public String _encoding
    • _omitHeader

      public boolean _omitHeader
    • _standalone

      public String _standalone
    • _doctypePublic

      public String _doctypePublic
    • _doctypeSystem

      public String _doctypeSystem
    • _indent

      public boolean _indent
    • _mediaType

      public String _mediaType
    • _cdata

      public Vector _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

      public Hashtable _formatSymbols
      Decimal number format symbol handling
  • Constructor Details

    • AbstractTranslet

      public AbstractTranslet()
  • Method Details

    • printInternalState

      public void printInternalState()
      Debugging
    • 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()).
      Throws:
      TransletException
    • pushParamFrame

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

      public final void popParamFrame()
      Pop the topmost parameter frame.
    • 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
      Specified by:
      addParameter in interface Translet
    • 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 invalid input: '<'xsl:parameter> element's select attribute or element body.
    • clearParameters

      public void clearParameters()
      Clears the parameter stack.
    • getParameter

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

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

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

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

      public final DecimalFormat getDecimalFormat(String name)
      Retrieves a named DecimalFormat object from _formatSymbols hashtable.
    • 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.
    • 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

      public KeyIndex createKeyIndex()
      Creates a KeyIndex object of the desired size - don't want to resize!!!
    • 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 handle 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
    • getKeyIndex

      public KeyIndex getKeyIndex(String name)
      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 interface Translet
      Throws:
      TransletException
    • setKeyIndexDom

      public 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 used
    • 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 SerializationHandler openOutputHandler(String filename, boolean append) throws TransletException
      Multiple output document extension. See compiler/TransletOutput for actual implementation.
      Throws:
      TransletException
    • openOutputHandler

      public SerializationHandler openOutputHandler(String filename) throws TransletException
      Throws:
      TransletException
    • closeOutputHandler

      public void closeOutputHandler(SerializationHandler handler)
    • 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 interface Translet
      Throws:
      TransletException
    • transform

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

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

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

      public void addAuxiliaryClass(Class auxClass)
      Specified by:
      addAuxiliaryClass in interface Translet
    • setAuxiliaryClasses

      public void setAuxiliaryClasses(Hashtable auxClasses)
    • getAuxiliaryClass

      public Class getAuxiliaryClass(String className)
      Specified by:
      getAuxiliaryClass in interface Translet
    • getNamesArray

      public String[] getNamesArray()
      Specified by:
      getNamesArray in interface Translet
    • getUrisArray

      public String[] getUrisArray()
      Specified by:
      getUrisArray in interface Translet
    • getTypesArray

      public int[] getTypesArray()
      Specified by:
      getTypesArray in interface Translet
    • getNamespaceArray

      public String[] getNamespaceArray()
      Specified by:
      getNamespaceArray in interface Translet
    • hasIdCall

      public boolean hasIdCall()
    • getTemplates

      public Templates getTemplates()
    • setTemplates

      public void setTemplates(Templates templates)
    • newDocument

      public Document newDocument(String uri, String qname) throws ParserConfigurationException
      Throws:
      ParserConfigurationException