org.apache.xalan.extensions
Class ExtensionHandlerExsltFunction

java.lang.Object
  extended byorg.apache.xalan.extensions.ExtensionHandler
      extended byorg.apache.xalan.extensions.ExtensionHandlerExsltFunction

public class ExtensionHandlerExsltFunction
extends ExtensionHandler

Execute EXSLT functions, determine the availability of EXSLT functions, and the availability of an EXSLT result element.


Field Summary
private  String m_namespace
           
private  StylesheetRoot m_stylesheet
           
private static QName RESULTQNAME
           
 
Fields inherited from class org.apache.xalan.extensions.ExtensionHandler
m_namespaceUri, m_scriptLang
 
Constructor Summary
ExtensionHandlerExsltFunction(String ns, StylesheetRoot stylesheet)
          Constructor called from ElemExsltFunction runtimeInit().
 
Method Summary
private  boolean ancestorIsFunction(ElemTemplateElement child)
          Determine whether the func:result element is within a func:function element.
 Object callFunction(String funcName, Vector args, Object methodKey, ExpressionContext exprContext)
          Execute the EXSLT function and return the result value.
 ElemExsltFunction getFunction(String funcName)
          Get the ElemExsltFunction element associated with the function.
 boolean isElementAvailable(String elemName)
          If an element-available() call applies to an EXSLT result element within an EXSLT function element, return true.
 boolean isFunctionAvailable(String funcName)
          Does the EXSLT function exist?
 void processElement(String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey)
          Required by ExtensionHandler (an abstract method).
 
Methods inherited from class org.apache.xalan.extensions.ExtensionHandler
getClassForName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_namespace

private String m_namespace

m_stylesheet

private StylesheetRoot m_stylesheet

RESULTQNAME

private static final QName RESULTQNAME
Constructor Detail

ExtensionHandlerExsltFunction

public ExtensionHandlerExsltFunction(String ns,
                                     StylesheetRoot stylesheet)
Constructor called from ElemExsltFunction runtimeInit().

Method Detail

processElement

public void processElement(String localPart,
                           ElemTemplateElement element,
                           TransformerImpl transformer,
                           Stylesheet stylesheetTree,
                           Object methodKey)
                    throws javax.xml.transform.TransformerException,
                           IOException
Required by ExtensionHandler (an abstract method). No-op.

Specified by:
processElement in class ExtensionHandler
Parameters:
localPart - Element name's local part.
element - The extension element being processed.
transformer - Handle to TransformerImpl.
stylesheetTree - The compiled stylesheet tree.
methodKey - A key that uniquely identifies this class and method call.
Throws:
javax.xml.transform.TransformerException - if parsing trouble
IOException - if loading trouble

getFunction

public ElemExsltFunction getFunction(String funcName)
Get the ElemExsltFunction element associated with the function.

Parameters:
funcName - Local name of the function.
Returns:
the ElemExsltFunction element associated with the function, null if none exists.

isFunctionAvailable

public boolean isFunctionAvailable(String funcName)
Does the EXSLT function exist?

Specified by:
isFunctionAvailable in class ExtensionHandler
Parameters:
funcName - Local name of the function.
Returns:
true if the function exists.

isElementAvailable

public boolean isElementAvailable(String elemName)
If an element-available() call applies to an EXSLT result element within an EXSLT function element, return true. Note: The EXSLT function element is a template-level element, and element-available() returns false for it.

Specified by:
isElementAvailable in class ExtensionHandler
Parameters:
elemName - Name of element to check
Returns:
true if the function is available.

ancestorIsFunction

private boolean ancestorIsFunction(ElemTemplateElement child)
Determine whether the func:result element is within a func:function element. If not, it is illegal.


callFunction

public Object callFunction(String funcName,
                           Vector args,
                           Object methodKey,
                           ExpressionContext exprContext)
                    throws javax.xml.transform.TransformerException
Execute the EXSLT function and return the result value.

Specified by:
callFunction in class ExtensionHandler
Parameters:
funcName - Name of the EXSLT function.
args - The arguments of the function call.
methodKey - Not used.
exprContext - Used to get the XPathContext.
Returns:
the return value of the function evaluation.
Throws:
javax.xml.transform.TransformerException