net.sf.saxon.instruct
Class FunctionInstr

java.lang.Object
  extended bynet.sf.saxon.instruct.Instruction
      extended bynet.sf.saxon.instruct.FunctionInstr
All Implemented Interfaces:
CallableFunction, InstructionInfo, Serializable, SourceLocator

public final class FunctionInstr
extends Instruction
implements CallableFunction, InstructionInfo

Handler for xsl:function elements in stylesheet (XSLT 2.0).
Attributes:
name gives the name of the function saxon:memo-function=yes|no indicates whether it acts as a memo function.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.instruct.Instruction
children
 
Constructor Summary
FunctionInstr()
          A FunctionInstr is constructed in two stages.
 
Method Summary
 Value call(Value[] actualArgs, Controller controller)
          Call this function
 String getFunctionName()
           
 String getInstructionName()
          Get the name of the instruction.
 int getLineNumber()
          Get the line number of the instruction in the source stylesheet module.
 HashMap getProperties()
          Get all the properties of the instruction.
 Object getProperty(String propertyName)
          Get the value of a particular property of the instruction.
 String getSystemId()
          Get the system identifier (URI) of the source stylesheet module containing the instruction.
 void initialize(Sequence body, String baseURI, String displayName, boolean memoFunction)
           
 TailCall processLeavingTail(XPathContext context)
          Dummy processLeavingTail() method
 void setInstructionDetails(Controller controller, NamePool namePool, InstructionDetails details)
          Get the name of this instruction for diagnostic and tracing purposes
 void setLineNumber(int lineNumber)
           
 
Methods inherited from class net.sf.saxon.instruct.Instruction
assembleParams, assembleTunnelParams, getChildren, getColumnNumber, getInstructionDetails, getPublicId, getResultType, getSystemId, process, processChildren, processChildrenLeavingTail, recoverableError, setChildren, setSourceLocation, styleError, styleError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionInstr

public FunctionInstr()
A FunctionInstr is constructed in two stages. The object is created as soon as the corresponding xsl:function object is created, so that XPath expressions can be constructed containing a reference to this FunctionInstr. The details of the FunctionInstr are supplied later, when the function is compiled.

Method Detail

initialize

public void initialize(Sequence body,
                       String baseURI,
                       String displayName,
                       boolean memoFunction)

setLineNumber

public void setLineNumber(int lineNumber)

getLineNumber

public int getLineNumber()
Description copied from interface: InstructionInfo
Get the line number of the instruction in the source stylesheet module. If this is not known, or if the instruction is an artificial one that does not relate to anything in the source code, the value returned may be -1.

Specified by:
getLineNumber in interface InstructionInfo
Overrides:
getLineNumber in class Instruction
Returns:
the line number of the instruction

getSystemId

public String getSystemId()
Description copied from interface: InstructionInfo
Get the system identifier (URI) of the source stylesheet module containing the instruction. This will generally be an absolute URI. If the system identifier is not known, the method may return null. In some cases, for example where XML external entities are used, the correct system identifier is not always retained.

Specified by:
getSystemId in interface InstructionInfo
Overrides:
getSystemId in class Instruction

getProperty

public Object getProperty(String propertyName)
Description copied from interface: InstructionInfo
Get the value of a particular property of the instruction. Properties of XSLT instructions are generally known by the name of the stylesheet attribute that defines them.

Specified by:
getProperty in interface InstructionInfo
Parameters:
propertyName - The name of the required property
Returns:
The value of the requested property, or null if the property is not available

getProperties

public HashMap getProperties()
Description copied from interface: InstructionInfo
Get all the properties of the instruction. Properties of XSLT instructions are generally known by the name of the stylesheet attribute that defines them.

Specified by:
getProperties in interface InstructionInfo
Returns:
a HashMap containing all the properties of this instruction.

setInstructionDetails

public void setInstructionDetails(Controller controller,
                                  NamePool namePool,
                                  InstructionDetails details)
Get the name of this instruction for diagnostic and tracing purposes

Specified by:
setInstructionDetails in class Instruction
Returns:
the string "xsl:function"

getInstructionName

public String getInstructionName()
Description copied from interface: InstructionInfo
Get the name of the instruction. This will normally be the name of an XSLT instruction, a literal result element, or an extension element. The name is passed in a form suitable for display to the user: it will generally be a QName, but this is not guaranteed. Some instructions may be internally generated by the Saxon compiler, in which case the name might not relate to anything obvious in the source stylesheet

Specified by:
getInstructionName in interface InstructionInfo
Overrides:
getInstructionName in class Instruction

getFunctionName

public String getFunctionName()
Specified by:
getFunctionName in interface CallableFunction

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
Dummy processLeavingTail() method

Specified by:
processLeavingTail in class Instruction
Parameters:
context - The dynamic context of the transformation, giving access to the current node, the current variables, etc.
Returns:
null if the instruction has completed execution; or a TailCall indicating a function call or template call that is delegated to the caller, to be made after the stack has been unwound so as to save stack space.

call

public Value call(Value[] actualArgs,
                  Controller controller)
           throws TransformerException
Call this function

Specified by:
call in interface CallableFunction
Throws:
TransformerException