AbstractTranslet.java revision 331
286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2001-2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * @author Jacek Ambroziak 286N/A * @author Santiago Pericas-Geertsen 286N/A * @author Morten Jorgensen 286N/A * @author G. Todd Miller 286N/A * @author John Howard, JohnH@schemasoft.com 286N/A // These attributes are extracted from the xsl:output element. They also 331N/A //see OutputPropertiesFactory.ORACLE_IS_STANDALONE 286N/A // Initialize Translet version field to base value. A class that extends 286N/A // AbstractTranslet may override this value to a more recent translet 286N/A // version; if it doesn't override the value (because it was compiled 286N/A // before the notion of a translet version was introduced, it will get 286N/A // this default value). 286N/A // The Templates object that is used to create this Translet instance 286N/A // Boolean flag to indicate whether this translet has id functions. 286N/A // TODO - these should only be instanciated when needed 286N/A // Use one empty string instead of constantly instanciating String(""); 286N/A // This is the name of the index used for ID attributes 286N/A /************************************************************************ 286N/A ************************************************************************/ 286N/A * Wrap the initial input DOM in a dom adapter. This adapter is wrapped in 286N/A * a DOM multiplexer if the document() function is used (handled by compiled 286N/A /************************************************************************ 286N/A ************************************************************************/ 286N/A // Parameter's stack: <tt>pbase</tt> and <tt>pframe</tt> are used 286N/A // to denote the current parameter frame. 286N/A * Push a new parameter frame. 286N/A * Pop the topmost parameter frame. 286N/A * Add a new global parameter if not already in the current frame. 286N/A * This needs to get mapped to an instance variable in the class 286N/A * The mapping created so that 286N/A * the global variables in the generated class become 286N/A * http$colon$$flash$$flash$foo$dot$bar$colon$xyz 286N/A * Add a new global or local parameter if not already in the current frame. 286N/A * The 'isDefault' parameter is set to true if the value passed is the 286N/A * default value from the <xsl:parameter> element's select attribute or 286N/A // Local parameters need to be re-evaluated for each iteration 286N/A // Only overwrite if current value is the default value and 286N/A // the new value is _NOT_ the default value. 286N/A // Add new parameter to parameter stack 286N/A * Clears the parameter stack. 286N/A * Get the value of a parameter from the current frame or 286N/A * <tt>null</tt> if undefined. 286N/A /************************************************************************ 286N/A * Message handling - implementation of <xsl:message> 286N/A ************************************************************************/ 286N/A // Holds the translet's message handler - used for <xsl:message>. 286N/A // The deault message handler dumps a string stdout, but anything can be 286N/A // used, such as a dialog box for applets, etc. 286N/A * Set the translet's message handler - must implement MessageHandler 286N/A * Pass a message to the message handler - used by Message class. 286N/A /************************************************************************ 286N/A * Decimal number format symbol handling 286N/A ************************************************************************/ 286N/A // Contains decimal number formatting symbols used by FormatNumberCall 286N/A * Adds a DecimalFormat object to the _formatSymbols hashtable. 286N/A * The entry is created with the input DecimalFormatSymbols. 286N/A // Instanciate hashtable for formatting symbols if needed 286N/A // The name cannot be null - use empty string instead 286N/A // Construct a DecimalFormat object containing the symbols we got 286N/A * Retrieves a named DecimalFormat object from _formatSymbols hashtable. 286N/A // The name cannot be null - use empty string instead 286N/A * Give the translet an opportunity to perform a prepass on the document 286N/A * to extract any information that it can store in an optimized form. 286N/A * Currently, it only extracts information about attributes of type ID. 286N/A * Leverages the Key Class to implement the XSLT id() function. 286N/A * buildIdIndex creates the index (##id) that Key Class uses. 286N/A * The index contains the element node index (int) and Id value (String). 286N/A // If the input source is DOMSource, the KeyIndex table is not 286N/A // built at this time. It will be built later by the lookupId() 286N/A // and containsId() methods of the KeyIndex class. 286N/A // Given a Hashtable of DTM nodes indexed by ID attribute values, 286N/A // loop through the table copying information to a KeyIndex 286N/A // for the mapping from ID attribute value to DTM node 286N/A * After constructing the translet object, this method must be called to 286N/A * perform any version-specific post-initialization that's required. 286N/A // If the version of the translet had just one namesArray, split 286N/A // it into multiple fields. 286N/A // Distinguish attribute and element names. Attribute has 286N/A // @ before local part of name. 286N/A // Was translet compiled using a more recent version of the XSLTC 286N/A // compiler than is known by the AbstractTranslet class? If, so 286N/A // and we've made it this far (which is doubtful), we should give up. 286N/A /************************************************************************ 286N/A * Index(es) for <xsl:key> / key() / id() 286N/A ************************************************************************/ 286N/A // Container for all indexes for xsl:key elements 286N/A * This method is used to pass the largest DOM size to the translet. 286N/A * Needed to make sure that the translet can index the whole DOM. 286N/A * Creates a KeyIndex object of the desired size - don't want to resize!!! 286N/A * @param name is the name of the index (the key or ##id) 286N/A * @param node is the node handle of the node to insert 286N/A * @param value is the value that will look up the node in the given index 286N/A * Create an empty KeyIndex in the DOM case 286N/A * @param name is the name of the index (the key or ##id) 286N/A * @param dom is the DOM 286N/A * Returns the index for a given key (or id). 286N/A * The index implements our internal iterator interface 286N/A // Return an empty key index iterator if none are defined 286N/A // Look up the requested key index 286N/A // Return an empty key index iterator if the requested index not found 286N/A * This method builds key indexes - it is overridden in the compiled 286N/A * translet in cases where the <xsl:key> element is used 286N/A * This method builds key indexes - it is overridden in the compiled 286N/A * translet in cases where the <xsl:key> element is used 286N/A /************************************************************************ 286N/A ************************************************************************/ 286N/A // Hold the DOM cache (if any) used with this translet 286N/A * Sets the DOM cache used for additional documents loaded using the 286N/A * Returns the DOM cache used for this translet. Used by the LoadDocument 286N/A * class (if present) when the document() function is used. 286N/A /************************************************************************ 286N/A * Multiple output document extension. 286N/A ************************************************************************/ 286N/A /************************************************************************ 286N/A ************************************************************************/ 286N/A * Main transform() method - this is overridden by the compiled translet 286N/A * Calls transform() with a given output handler 286N/A * Used by some compiled code as a shortcut for passing strings to the 286N/A //final int length = string.length(); 286N/A * Add's a name of an element whose text contents should be output as CDATA 286N/A * Transfer the output settings to the output post-processor 286N/A // GTM added (see pg 110) 286N/A * Return the state of the services mechanism feature. 286N/A * Set the state of the services mechanism feature. 286N/A /************************************************************************ 286N/A * DOMImplementation caching for basis library 286N/A ************************************************************************/