org.apache.xalan.xsltc.compiler
Class Stylesheet

java.lang.Object
  extended by org.apache.xalan.xsltc.compiler.SyntaxTreeNode
      extended by org.apache.xalan.xsltc.compiler.Stylesheet
All Implemented Interfaces:
Constants

public final class Stylesheet
extends SyntaxTreeNode


Field Summary
private  java.util.Vector _allValidTemplates
          Used to cache result of getAllValidTemplates().
private  boolean _callsNodeset
          Flag indicating if nodset() is called.
private  java.lang.String _className
          The name of the class being generated.
private  Mode _defaultMode
          A reference to the default Mode object.
private  java.util.Vector _elementsWithNamespacesUsedDynamically
           
private  java.util.Hashtable _extensions
          Mapping between extension URIs and their prefixes.
private  java.util.Vector _globals
          Contains global variables and parameters defined in the stylesheet.
private  boolean _hasIdCall
          Flag indicating if id() is called.
private  java.lang.Boolean _hasLocalParams
          Used to cache the result returned by hasLocalParams().
 Stylesheet _importedFrom
          Reference to the stylesheet from which this stylesheet was imported (if any).
private  int _importPrecedence
          Import precendence for this stylesheet.
 Stylesheet _includedFrom
          Reference to the stylesheet from which this stylesheet was included (if any).
private  java.util.Vector _includedStylesheets
          Array of all the stylesheets imported or included from this one.
private  java.util.Hashtable _keys
          Mapping between key names and Key objects (needed by Key/IdPattern).
private  Output _lastOutputElement
          A reference to the last xsl:output object found in the styleshet.
private  SourceLoader _loader
          A reference to the SourceLoader set by the user (a URIResolver if the JAXP API is being used).
private  int _minimumDescendantPrecedence
          Minimum precendence of any descendant stylesheet by inclusion or importation.
private  java.util.Hashtable _modes
          Mapping between mode names and Mode instances.
private  boolean _multiDocument
          Flag indicating if multi-document support is needed.
private  QName _name
          Internal name of this stylesheet used as a key into the symbol table.
private  int _nextModeSerial
          Counter to generate unique mode suffixes.
private  boolean _numberFormattingUsed
          Flag indicating if format-number() is called.
private  int _outputMethod
          Output method for this stylesheet (must be set to one of the constants defined below).
private  java.util.Properties _outputProperties
          Output properties for this stylesheet.
private  Stylesheet _parentStylesheet
          A reference to the parent stylesheet or null if topmost.
private  boolean _simplified
          Flag indicating if this is a simplified stylesheets.
private  java.lang.String _systemId
          A URI that represents the system ID for this stylesheet.
private  boolean _templateInlining
          Set to true to enable template inlining optimization.
private  java.util.Vector _templates
          Contains all templates defined in this stylesheet
private  java.lang.String _version
          XSLT version defined in the stylesheet.
static int HTML_OUTPUT
           
static int TEXT_OUTPUT
           
static int UNKNOWN_OUTPUT
           
static int XML_OUTPUT
           
 
Fields inherited from class org.apache.xalan.xsltc.compiler.SyntaxTreeNode
_attributes, _parent, _qname, Dummy, IndentIncrement, UNKNOWN_STYLESHEET_NODE_ID
 
Fields inherited from interface org.apache.xalan.xsltc.compiler.Constants
ABSOLUTE_ITERATOR, ACC_FINAL, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ADD_ATTRIBUTE, ADD_ATTRIBUTE_SIG, ADD_ITERATOR, ADD_ITERATOR_SIG, ADD_PARAMETER, ADD_PARAMETER_SIG, APPLY_TEMPLATES, ATTR_SET_SIG, ATTRIBUTE_LIST_FIELD, ATTRIBUTE_LIST_IMPL_CLASS, ATTRIBUTE_LIST_IMPL_SIG, ATTRIBUTES_SIG, BASIS_LIBRARY_CLASS, BOOLEAN_CLASS, BOOLEAN_VALUE, BOOLEAN_VALUE_SIG, CACHED_NODE_LIST_ITERATOR_CLASS, CHARACTERS, CHARACTERS_SIG, CHARACTERSW, CHARACTERSW_SIG, CLEAR_ATTRIBUTES, CLEAR_ATTRIBUTES_SIG, COLLATOR_CLASS, COLLATOR_SIG, COMPILER_PACKAGE, CURRENT_NODE_LIST_FILTER, CURRENT_NODE_LIST_FILTER_SIG, CURRENT_NODE_LIST_ITERATOR, CURRENT_NODE_LIST_ITERATOR_SIG, DEFAULT_NODE_COUNTER, DEFAULT_NODE_COUNTER_SIG, DOCUMENT_PNAME, DOM_ADAPTER_CLASS, DOM_ADAPTER_SIG, DOM_FIELD, DOM_IMPL, DOM_IMPL_CLASS, DOM_IMPL_SIG, DOM_INTF, DOM_INTF_SIG, DOM_PNAME, DOUBLE_CLASS, DOUBLE_SIG, DOUBLE_VALUE, DOUBLE_VALUE_SIG, DUP_FILTERED_ITERATOR, EMPTYATTR_FIELD, EMPTYSTRING, ERROR, EXPAND_STYLESHEET_QNAME_REF, EXPAND_STYLESHEET_QNAME_SIG, FALLBACK_CLASS, FATAL, FILTER_INTERFACE, FILTER_INTERFACE_SIG, FILTER_ITERATOR, FILTER_STEP_ITERATOR, FORMAT_SYMBOLS_FIELD, GET_ATTRIBUTE_VALUE, GET_ATTRIBUTE_VALUE_SIG, GET_CHILDREN, GET_CHILDREN_SIG, GET_ELEMENT_VALUE, GET_ELEMENT_VALUE_SIG, GET_ITERATOR_SIG, GET_NODE_NAME, GET_NODE_NAME_SIG, GET_NODE_TYPE, GET_NODE_TYPE_SIG, GET_NODE_VALUE, GET_NODE_VALUE_ITERATOR, GET_NODE_VALUE_ITERATOR_SIG, GET_NODE_VALUE_SIG, GET_PARAMETER, GET_PARAMETER_SIG, GET_PARENT, GET_PARENT_SIG, GET_TYPED_CHILDREN, GET_TYPED_CHILDREN_SIG, GET_UNPARSED_ENTITY_URI, GET_UNPARSED_ENTITY_URI_SIG, HAS_ATTRIBUTE, HAS_ATTRIBUTE_SIG, HASIDCALL_INDEX, HASIDCALL_INDEX_SIG, INT_VALUE, INT_VALUE_SIG, INTEGER_CLASS, INTEGER_SIG, INTERNAL, INVOKE_METHOD, ITERATOR_FIELD_SIG, ITERATOR_PNAME, KEY_INDEX_CLASS, KEY_INDEX_ITERATOR_SIG, KEY_INDEX_SIG, LAST_INDEX, LOAD_DOCUMENT_CLASS, LOCALE_CLASS, LOCALE_SIG, LOOKUP_STYLESHEET_QNAME_NS_REF, LOOKUP_STYLESHEET_QNAME_NS_SIG, MAKE_NODE, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG, MAKE_NODE_LIST_SIG2, MAKE_NODE_SIG, MAKE_NODE_SIG2, MATCHING_ITERATOR, MATH_CLASS, MULTI_DOM_CLASS, MULTI_DOM_SIG, NAMES_INDEX, NAMES_INDEX_SIG, NAMESPACE_FEATURE, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG, NEXT, NEXT_SIG, NEXTID, NODE, NODE_COUNTER, NODE_COUNTER_SIG, NODE_FIELD, NODE_FIELD_SIG, NODE_ITERATOR, NODE_ITERATOR_BASE, NODE_ITERATOR_SIG, NODE_PNAME, NODE_SIG, NODE_SORT_FACTORY, NODE_SORT_FACTORY_SIG, NODE_SORT_RECORD, NODE_SORT_RECORD_SIG, NS_ANCESTORS_INDEX_SIG, NTH_ITERATOR_CLASS, OBJECT_CLASS, OBJECT_SIG, ORDER_ITERATOR, ORDER_ITERATOR_SIG, OUTPUT_BASE, OUTPUT_HANDLER, OUTPUT_HANDLER_SIG, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG, POSITION_INDEX, PREFIX_URIS_ARRAY_SIG, PREFIX_URIS_IDX_SIG, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG, REDIRECT_URI, RESET, RESET_SIG, RTF_INITIAL_SIZE, RUNTIME_NODE_CLASS, RUNTIME_PACKAGE, SAX_IMPL, SAX_IMPL_CLASS, SAX_IMPL_SIG, SET_START_NODE, SET_START_NODE_SIG, SINGLETON_ITERATOR, SORT_ITERATOR, SORT_ITERATOR_SIG, STATIC_CHAR_DATA_FIELD, STATIC_CHAR_DATA_FIELD_SIG, STATIC_NAMES_ARRAY_FIELD, STATIC_NAMESPACE_ARRAY_FIELD, STATIC_NS_ANCESTORS_ARRAY_FIELD, STATIC_PREFIX_URIS_ARRAY_FIELD, STATIC_PREFIX_URIS_IDX_ARRAY_FIELD, STATIC_TYPES_ARRAY_FIELD, STATIC_URIS_ARRAY_FIELD, STEP_ITERATOR_CLASS, STREAM_XML_OUTPUT, STRING, STRING_BUFFER_CLASS, STRING_BUFFER_SIG, STRING_CLASS, STRING_SIG, STRING_TO_INT, STRING_TO_INT_SIG, STRING_TO_REAL, STRING_TO_REAL_SIG, STRING_VALUE_HANDLER, STRING_VALUE_HANDLER_SIG, STRING_WRITER, STRIP_SPACE, STRIP_SPACE_INTF, STRIP_SPACE_PARAMS, STRIP_SPACE_SIG, TRANSLET_CLASS, TRANSLET_FIELD, TRANSLET_FIELD_SIG, TRANSLET_INTF, TRANSLET_INTF_SIG, TRANSLET_OUTPUT_BASE, TRANSLET_OUTPUT_INTERFACE, TRANSLET_OUTPUT_PNAME, TRANSLET_OUTPUT_SIG, TRANSLET_PNAME, TRANSLET_SIG, TRANSLET_URI, TRANSLET_VERSION_INDEX, TRANSLET_VERSION_INDEX_SIG, TYPES_INDEX, TYPES_INDEX_SIG, UNION_ITERATOR_CLASS, UNION_ITERATOR_SIG, UNSUPPORTED, URIS_INDEX, URIS_INDEX_SIG, WARNING, WRITER_SIG, XHTML_URI, XMLNS_PREFIX, XMLNS_STRING, XMLNS_URI, XSLT_PACKAGE, XSLT_URI
 
Constructor Summary
Stylesheet()
           
 
Method Summary
private  void addDOMField(ClassGenerator classGen)
           
 void addIncludedStylesheet(Stylesheet child)
           
 int addParam(Param param)
           
protected  void addPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Adds a single prefix mapping to this syntax tree node.
private  void addStaticField(ClassGenerator classGen, java.lang.String type, java.lang.String name)
          Add a static field
protected  void addTemplate(Template template)
           
 int addVariable(Variable global)
           
 boolean callsNodeset()
           
 boolean checkForLoop(java.lang.String systemId)
           
private  void checkOutputMethod()
          Check and set the output method
private  java.lang.String compileBuildKeys(ClassGenerator classGen)
          Compile a buildKeys() method into the output class.
private  void compileConstructor(ClassGenerator classGen, Output output)
          Compile the translet's constructor
private  void compileModes(ClassGenerator classGen)
           
private  void compileStaticInitializer(ClassGenerator classGen)
          Compile the namesArray, urisArray, typesArray, namespaceArray, namespaceAncestorsArray, prefixURIsIdxArray and prefixURIPairsArray into the static initializer.
private  java.lang.String compileTopLevel(ClassGenerator classGen)
          Compile a topLevel() method into the output class.
private  void compileTransform(ClassGenerator classGen)
          Compile transform() into the output class.
 void declareExtensionPrefixes(Parser parser)
           
 void display(int indent)
          Displays the contents of this syntax tree node (to stdout).
private  void extensionURI(java.lang.String prefixes, SymbolTable stable)
          Store extension URIs
 java.util.Vector getAllValidTemplates()
           
 java.lang.String getClassName()
           
 int getImportPrecedence()
          Get the import precedence of this element.
 Output getLastOutputElement()
           
 int getMinimumDescendantPrecedence()
          Get the minimum of the precedence of this stylesheet, any stylesheet imported by this stylesheet and any include/import descendant of this stylesheet.
 Mode getMode(QName modeName)
           
 java.lang.String getNamespace(java.lang.String prefix)
           
 int getOutputMethod()
          Return the output method
 java.util.Properties getOutputProperties()
           
 Stylesheet getParentStylesheet()
           
 SourceLoader getSourceLoader()
           
 java.lang.String getSystemId()
           
 boolean getTemplateInlining()
           
 java.util.Vector getTemplates()
           
 boolean hasGlobals()
          Returns true if this stylesheet has global vars or params.
 boolean hasLocalParams()
          Returns true if at least one template in the stylesheet has params defined.
 boolean isExtension(java.lang.String uri)
           
 boolean isMultiDocument()
           
 boolean isSimplified()
           
private  QName makeStylesheetName(java.lang.String prefix)
           
 void numberFormattingUsed()
           
 void parseContents(Parser parser)
          Parse the version and uri fields of the stylesheet and add an entry to the symbol table mapping the name __stylesheet_ to an instance of this class.
 void parseOwnChildren(Parser parser)
          Parse all direct children of the element.
private  void peepHoleOptimization(MethodGenerator methodGen)
          Peephole optimization: Remove sequences of [ALOAD, POP].
 void processModes()
           
private  java.util.Vector resolveDependencies(java.util.Vector input)
          This method returns a vector with variables/params and keys in the order in which they are to be compiled for initialization.
 void setCallsNodeset(boolean flag)
           
 void setHasIdCall(boolean flag)
           
 void setImportingStylesheet(Stylesheet parent)
           
 void setImportPrecedence(int precedence)
           
 void setIncludingStylesheet(Stylesheet parent)
           
 void setMultiDocument(boolean flag)
           
 void setOutputProperties(java.util.Properties props)
           
 void setOutputProperty(java.lang.String key, java.lang.String value)
           
 void setParentStylesheet(Stylesheet parent)
           
 void setParser(Parser parser)
          Set this node's parser.
 void setSimplified()
           
 void setSourceLoader(SourceLoader loader)
           
 void setSystemId(java.lang.String systemId)
           
 void setTemplateInlining(boolean flag)
           
 void translate()
          Translate the stylesheet into JVM bytecodes.
 void translate(ClassGenerator classGen, MethodGenerator methodGen)
          Translate the stylesheet into JVM bytecodes.
 Type typeCheck(SymbolTable stable)
          Type check all the children of this node.
 
Methods inherited from class org.apache.xalan.xsltc.compiler.SyntaxTreeNode
addAttribute, addElement, compileResultTree, contextDependent, dependentContents, displayContents, elementAt, elementCount, elements, getAttribute, getAttribute, getAttributes, getContents, getLineNumber, getNodeIDForStylesheetNSLookup, getParent, getParser, getPrefixMapping, getQName, getStylesheet, getSymbolTable, getTemplate, getXSLTC, hasAttribute, hasContents, indent, isDummy, lastChild, lookupNamespace, lookupPrefix, parseChildren, removeElement, reportError, reportWarning, setAttributes, setFirstElement, setLineNumber, setParent, setPrefixMapping, setQName, setQName, translateContents, typeCheckContents, updateScope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_version

private java.lang.String _version
XSLT version defined in the stylesheet.


_name

private QName _name
Internal name of this stylesheet used as a key into the symbol table.


_systemId

private java.lang.String _systemId
A URI that represents the system ID for this stylesheet.


_parentStylesheet

private Stylesheet _parentStylesheet
A reference to the parent stylesheet or null if topmost.


_globals

private java.util.Vector _globals
Contains global variables and parameters defined in the stylesheet.


_hasLocalParams

private java.lang.Boolean _hasLocalParams
Used to cache the result returned by hasLocalParams().


_className

private java.lang.String _className
The name of the class being generated.


_templates

private final java.util.Vector _templates
Contains all templates defined in this stylesheet


_allValidTemplates

private java.util.Vector _allValidTemplates
Used to cache result of getAllValidTemplates(). Only set in top-level stylesheets that include/import other stylesheets.


_elementsWithNamespacesUsedDynamically

private java.util.Vector _elementsWithNamespacesUsedDynamically

_nextModeSerial

private int _nextModeSerial
Counter to generate unique mode suffixes.


_modes

private final java.util.Hashtable _modes
Mapping between mode names and Mode instances.


_defaultMode

private Mode _defaultMode
A reference to the default Mode object.


_extensions

private final java.util.Hashtable _extensions
Mapping between extension URIs and their prefixes.


_importedFrom

public Stylesheet _importedFrom
Reference to the stylesheet from which this stylesheet was imported (if any).


_includedFrom

public Stylesheet _includedFrom
Reference to the stylesheet from which this stylesheet was included (if any).


_includedStylesheets

private java.util.Vector _includedStylesheets
Array of all the stylesheets imported or included from this one.


_importPrecedence

private int _importPrecedence
Import precendence for this stylesheet.


_minimumDescendantPrecedence

private int _minimumDescendantPrecedence
Minimum precendence of any descendant stylesheet by inclusion or importation.


_keys

private java.util.Hashtable _keys
Mapping between key names and Key objects (needed by Key/IdPattern).


_loader

private SourceLoader _loader
A reference to the SourceLoader set by the user (a URIResolver if the JAXP API is being used).


_numberFormattingUsed

private boolean _numberFormattingUsed
Flag indicating if format-number() is called.


_simplified

private boolean _simplified
Flag indicating if this is a simplified stylesheets. A template matching on "/" must be added in this case.


_multiDocument

private boolean _multiDocument
Flag indicating if multi-document support is needed.


_callsNodeset

private boolean _callsNodeset
Flag indicating if nodset() is called.


_hasIdCall

private boolean _hasIdCall
Flag indicating if id() is called.


_templateInlining

private boolean _templateInlining
Set to true to enable template inlining optimization.

See Also:
XSLTC._templateInlining

_lastOutputElement

private Output _lastOutputElement
A reference to the last xsl:output object found in the styleshet.


_outputProperties

private java.util.Properties _outputProperties
Output properties for this stylesheet.


_outputMethod

private int _outputMethod
Output method for this stylesheet (must be set to one of the constants defined below).


UNKNOWN_OUTPUT

public static final int UNKNOWN_OUTPUT
See Also:
Constant Field Values

XML_OUTPUT

public static final int XML_OUTPUT
See Also:
Constant Field Values

HTML_OUTPUT

public static final int HTML_OUTPUT
See Also:
Constant Field Values

TEXT_OUTPUT

public static final int TEXT_OUTPUT
See Also:
Constant Field Values
Constructor Detail

Stylesheet

public Stylesheet()
Method Detail

getOutputMethod

public int getOutputMethod()
Return the output method


checkOutputMethod

private void checkOutputMethod()
Check and set the output method


getTemplateInlining

public boolean getTemplateInlining()

setTemplateInlining

public void setTemplateInlining(boolean flag)

isSimplified

public boolean isSimplified()

setSimplified

public void setSimplified()

setHasIdCall

public void setHasIdCall(boolean flag)

setOutputProperty

public void setOutputProperty(java.lang.String key,
                              java.lang.String value)

setOutputProperties

public void setOutputProperties(java.util.Properties props)

getOutputProperties

public java.util.Properties getOutputProperties()

getLastOutputElement

public Output getLastOutputElement()

setMultiDocument

public void setMultiDocument(boolean flag)

isMultiDocument

public boolean isMultiDocument()

setCallsNodeset

public void setCallsNodeset(boolean flag)

callsNodeset

public boolean callsNodeset()

numberFormattingUsed

public void numberFormattingUsed()

setImportPrecedence

public void setImportPrecedence(int precedence)

getImportPrecedence

public int getImportPrecedence()
Description copied from class: SyntaxTreeNode
Get the import precedence of this element. The import precedence equals the import precedence of the stylesheet in which this element occured.

Overrides:
getImportPrecedence in class SyntaxTreeNode
Returns:
The import precedence of this syntax tree node.

getMinimumDescendantPrecedence

public int getMinimumDescendantPrecedence()
Get the minimum of the precedence of this stylesheet, any stylesheet imported by this stylesheet and any include/import descendant of this stylesheet.


checkForLoop

public boolean checkForLoop(java.lang.String systemId)

setParser

public void setParser(Parser parser)
Description copied from class: SyntaxTreeNode
Set this node's parser. The parser (the XSLT parser) gives this syntax tree node access to the symbol table and XPath parser.

Overrides:
setParser in class SyntaxTreeNode
Parameters:
parser - The XSLT parser.

setParentStylesheet

public void setParentStylesheet(Stylesheet parent)

getParentStylesheet

public Stylesheet getParentStylesheet()

setImportingStylesheet

public void setImportingStylesheet(Stylesheet parent)

setIncludingStylesheet

public void setIncludingStylesheet(Stylesheet parent)

addIncludedStylesheet

public void addIncludedStylesheet(Stylesheet child)

setSystemId

public void setSystemId(java.lang.String systemId)

getSystemId

public java.lang.String getSystemId()

setSourceLoader

public void setSourceLoader(SourceLoader loader)

getSourceLoader

public SourceLoader getSourceLoader()

makeStylesheetName

private QName makeStylesheetName(java.lang.String prefix)

hasGlobals

public boolean hasGlobals()
Returns true if this stylesheet has global vars or params.


hasLocalParams

public boolean hasLocalParams()
Returns true if at least one template in the stylesheet has params defined. Uses the variable _hasLocalParams to cache the result.


addPrefixMapping

protected void addPrefixMapping(java.lang.String prefix,
                                java.lang.String uri)
Adds a single prefix mapping to this syntax tree node.

Overrides:
addPrefixMapping in class SyntaxTreeNode
Parameters:
prefix - Namespace prefix.
uri - Namespace URI.

extensionURI

private void extensionURI(java.lang.String prefixes,
                          SymbolTable stable)
Store extension URIs


isExtension

public boolean isExtension(java.lang.String uri)

declareExtensionPrefixes

public void declareExtensionPrefixes(Parser parser)

parseContents

public void parseContents(Parser parser)
Parse the version and uri fields of the stylesheet and add an entry to the symbol table mapping the name __stylesheet_ to an instance of this class.

Overrides:
parseContents in class SyntaxTreeNode
Parameters:
parser - reference to the XSLT parser

parseOwnChildren

public final void parseOwnChildren(Parser parser)
Parse all direct children of the element.


processModes

public void processModes()

compileModes

private void compileModes(ClassGenerator classGen)

getMode

public Mode getMode(QName modeName)

typeCheck

public Type typeCheck(SymbolTable stable)
               throws TypeCheckError
Type check all the children of this node.

Specified by:
typeCheck in class SyntaxTreeNode
Parameters:
stable - The compiler/parser's symbol table
Throws:
TypeCheckError

translate

public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen)
Translate the stylesheet into JVM bytecodes.

Specified by:
translate in class SyntaxTreeNode
Parameters:
classGen - BCEL Java class generator
methodGen - BCEL Java method generator

addDOMField

private void addDOMField(ClassGenerator classGen)

addStaticField

private void addStaticField(ClassGenerator classGen,
                            java.lang.String type,
                            java.lang.String name)
Add a static field


translate

public void translate()
Translate the stylesheet into JVM bytecodes.


compileStaticInitializer

private void compileStaticInitializer(ClassGenerator classGen)

Compile the namesArray, urisArray, typesArray, namespaceArray, namespaceAncestorsArray, prefixURIsIdxArray and prefixURIPairsArray into the static initializer. They are read-only from the translet. All translet instances can share a single copy of this informtion.

The namespaceAncestorsArray, prefixURIsIdxArray and prefixURIPairsArray contain namespace information accessible from the stylesheet:

namespaceAncestorsArray
Array indexed by integer stylesheet node IDs containing node IDs of the nearest ancestor node in the stylesheet with namespace declarations or -1 if there is no such ancestor. There can be more than one disjoint tree of nodes - one for each stylesheet module
prefixURIsIdxArray
Array indexed by integer stylesheet node IDs containing the index into prefixURIPairsArray of the first namespace prefix declared for the node. The values are stored in ascending order, so the next value in this array (if any) can be used to find the last such prefix-URI pair
prefixURIPairsArray
Array of pairs of namespace prefixes and URIs. A zero-length string represents the default namespace if it appears as a prefix and a namespace undeclaration if it appears as a URI.

For this stylesheet


 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   <xsl:template match="/">
     <xsl:for-each select="*" xmlns:foo="foouri">
       <xsl:element name="{n}" xmlns:foo="baruri">
     </xsl:for-each>
     <out xmlns="lumpit"/>
     <xsl:element name="{n}" xmlns="foouri"/>
     <xsl:element name="{n}" namespace="{ns}" xmlns="limpit"/gt;
   </xsl:template>
 </xsl:stylesheet>
 
there will be four stylesheet nodes whose namespace information is needed, and


compileConstructor

private void compileConstructor(ClassGenerator classGen,
                                Output output)
Compile the translet's constructor


compileTopLevel

private java.lang.String compileTopLevel(ClassGenerator classGen)
Compile a topLevel() method into the output class. This method is called from transform() to handle all non-template top-level elements. Returns the signature of the topLevel() method. Global variables/params and keys are first sorted to resolve dependencies between them. The XSLT 1.0 spec does not allow a key to depend on a variable. However, for compatibility with Xalan interpretive, that type of dependency is allowed. Note also that the buildKeys() method is still generated as it is used by the LoadDocument class, but it no longer called from transform().


resolveDependencies

private java.util.Vector resolveDependencies(java.util.Vector input)
This method returns a vector with variables/params and keys in the order in which they are to be compiled for initialization. The order is determined by analyzing the dependencies between them. The XSLT 1.0 spec does not allow a key to depend on a variable. However, for compatibility with Xalan interpretive, that type of dependency is allowed and, therefore, consider to determine the partial order.


compileBuildKeys

private java.lang.String compileBuildKeys(ClassGenerator classGen)
Compile a buildKeys() method into the output class. Note that keys for the input document are created in topLevel(), not in this method. However, we still need this method to create keys for documents loaded via the XPath document() function.


compileTransform

private void compileTransform(ClassGenerator classGen)
Compile transform() into the output class. This method is used to initialize global variables and global parameters. The current node is set to be the document's root node.


peepHoleOptimization

private void peepHoleOptimization(MethodGenerator methodGen)
Peephole optimization: Remove sequences of [ALOAD, POP].


addParam

public int addParam(Param param)

addVariable

public int addVariable(Variable global)

display

public void display(int indent)
Description copied from class: SyntaxTreeNode
Displays the contents of this syntax tree node (to stdout). This method is intended for debugging _only_, and should be overridden by all syntax tree node implementations.

Overrides:
display in class SyntaxTreeNode
Parameters:
indent - Indentation level for syntax tree levels.

getNamespace

public java.lang.String getNamespace(java.lang.String prefix)

getClassName

public java.lang.String getClassName()

getTemplates

public java.util.Vector getTemplates()

getAllValidTemplates

public java.util.Vector getAllValidTemplates()

addTemplate

protected void addTemplate(Template template)