org.apache.xalan.templates
Class AVT

java.lang.Object
  extended by org.apache.xalan.templates.AVT
All Implemented Interfaces:
java.io.Serializable, XSLTVisitable

public class AVT
extends java.lang.Object
implements java.io.Serializable, XSLTVisitable

Class to hold an Attribute Value Template.

See Also:
Serialized Form

Field Summary
private static int INIT_BUFFER_CHUNK_BITS
          INIT_BUFFER_CHUNK_BITS is used to set initial size of of the char m_array in FastStringBuffer if USE_OBJECT_POOL == false.
private  java.lang.String m_name
          The name of the attribute.
private  java.util.Vector m_parts
          If the AVT is complex, hold a Vector of AVTParts.
private  java.lang.String m_rawName
          The name of the attribute.
private  java.lang.String m_simpleString
          If the AVT is not complex, just hold the simple string.
private  java.lang.String m_uri
          The namespace URI of the owning attribute.
(package private) static long serialVersionUID
           
private static boolean USE_OBJECT_POOL
          We are not going to use the object pool if USE_OBJECT_POOL == false.
 
Constructor Summary
AVT(StylesheetHandler handler, java.lang.String uri, java.lang.String name, java.lang.String rawName, java.lang.String stringedValue, ElemTemplateElement owner)
          Construct an AVT by parsing the string, and either constructing a vector of AVTParts, or simply hold on to the string if the AVT is simple.
 
Method Summary
 void callVisitors(XSLTVisitor visitor)
          This will traverse the heararchy, calling the visitor for each member.
 boolean canTraverseOutsideSubtree()
          Tell if this expression or it's subexpressions can traverse outside the current subtree.
 java.lang.String evaluate(XPathContext xctxt, int context, PrefixResolver nsNode)
          Evaluate the AVT and return a String.
 void fixupVariables(java.util.Vector vars, int globalsSize)
          This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.
private  FastStringBuffer getBuffer()
           
 java.lang.String getName()
          Get the local name of the attribute.
 java.lang.String getRawName()
          Get the raw name of the attribute, with the prefix unprocessed.
 java.lang.String getSimpleString()
          Get the AVT as the original string.
 java.lang.String getURI()
          Get the namespace URI of the attribute.
 boolean isContextInsensitive()
          Test whether the AVT is insensitive to the context in which it is being evaluated.
 boolean isSimple()
          Returns true if this AVT is simple
 void setName(java.lang.String name)
          Set the local name of the attribute.
 void setRawName(java.lang.String rawName)
          Get the raw name of the attribute, with the prefix unprocessed.
 void setURI(java.lang.String uri)
          Get the namespace URI of the attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

USE_OBJECT_POOL

private static final boolean USE_OBJECT_POOL
We are not going to use the object pool if USE_OBJECT_POOL == false.

See Also:
Constant Field Values

INIT_BUFFER_CHUNK_BITS

private static final int INIT_BUFFER_CHUNK_BITS
INIT_BUFFER_CHUNK_BITS is used to set initial size of of the char m_array in FastStringBuffer if USE_OBJECT_POOL == false. size = 2^ INIT_BUFFER_CHUNK_BITS, INIT_BUFFER_CHUNK_BITS = 7 corresponds size = 256.

See Also:
Constant Field Values

m_simpleString

private java.lang.String m_simpleString
If the AVT is not complex, just hold the simple string.


m_parts

private java.util.Vector m_parts
If the AVT is complex, hold a Vector of AVTParts.


m_rawName

private java.lang.String m_rawName
The name of the attribute.


m_name

private java.lang.String m_name
The name of the attribute.


m_uri

private java.lang.String m_uri
The namespace URI of the owning attribute.

Constructor Detail

AVT

public AVT(StylesheetHandler handler,
           java.lang.String uri,
           java.lang.String name,
           java.lang.String rawName,
           java.lang.String stringedValue,
           ElemTemplateElement owner)
    throws javax.xml.transform.TransformerException
Construct an AVT by parsing the string, and either constructing a vector of AVTParts, or simply hold on to the string if the AVT is simple.

Parameters:
handler - non-null reference to StylesheetHandler that is constructing.
uri - non-null reference to URI, "" if null namespace.
name - non-null reference to name string.
rawName - prefixed name.
stringedValue - non-null raw string value.
Throws:
javax.xml.transform.TransformerException
Method Detail

getRawName

public java.lang.String getRawName()
Get the raw name of the attribute, with the prefix unprocessed.

Returns:
non-null reference to prefixed name.

setRawName

public void setRawName(java.lang.String rawName)
Get the raw name of the attribute, with the prefix unprocessed.

Parameters:
rawName - non-null reference to prefixed name.

getName

public java.lang.String getName()
Get the local name of the attribute.

Returns:
non-null reference to name string.

setName

public void setName(java.lang.String name)
Set the local name of the attribute.

Parameters:
name - non-null reference to name string.

getURI

public java.lang.String getURI()
Get the namespace URI of the attribute.

Returns:
non-null reference to URI, "" if null namespace.

setURI

public void setURI(java.lang.String uri)
Get the namespace URI of the attribute.

Parameters:
uri - non-null reference to URI, "" if null namespace.

getSimpleString

public java.lang.String getSimpleString()
Get the AVT as the original string.

Returns:
The AVT as the original string

evaluate

public java.lang.String evaluate(XPathContext xctxt,
                                 int context,
                                 PrefixResolver nsNode)
                          throws javax.xml.transform.TransformerException
Evaluate the AVT and return a String.

Parameters:
xctxt - Te XPathContext to use to evaluate this.
context - The current source tree context.
nsNode - The current namespace context (stylesheet tree context).
Returns:
The AVT evaluated as a string
Throws:
javax.xml.transform.TransformerException

isContextInsensitive

public boolean isContextInsensitive()
Test whether the AVT is insensitive to the context in which it is being evaluated. This is intended to facilitate compilation of templates, by allowing simple AVTs to be converted back into strings. Currently the only case we recognize is simple strings. ADDED 9/5/2000 to support compilation experiment

Returns:
True if the m_simpleString member of this AVT is not null

canTraverseOutsideSubtree

public boolean canTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree.

Returns:
true if traversal outside the context node's subtree can occur.

fixupVariables

public void fixupVariables(java.util.Vector vars,
                           int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.

Parameters:
vars - List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).

callVisitors

public void callVisitors(XSLTVisitor visitor)
Description copied from interface: XSLTVisitable
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

Specified by:
callVisitors in interface XSLTVisitable
Parameters:
visitor - The visitor whose appropriate method will be called.
See Also:
XSLTVisitable.callVisitors(XSLTVisitor)

isSimple

public boolean isSimple()
Returns true if this AVT is simple


getBuffer

private final FastStringBuffer getBuffer()