net.sf.saxon.style

Class XSLFunction

public class XSLFunction extends StyleElement implements StylesheetProcedure

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.
Field Summary
Listreferences
Method Summary
Expressioncompile(Executable exec)
Compile the function definition to create an executable representation
voidfixupReferences()
Notify all references to this function of the data type.
UserFunctiongetCompiledFunction()
Get the compiled function
intgetConstructType()
Get the type of construct.
intgetNumberOfArguments()
Get the number of arguments declared by this function (that is, its arity).
StructuredQNamegetObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.
SequenceTypegetResultType()
Get the type of value returned by this function
SlotManagergetSlotManager()
Get associated Procedure (for details of stack frame).
booleanisOverriding()
Is override="yes"?
protected booleanisPermittedChild(StyleElement child)
Specify that xsl:param is a permitted child
protected booleanmayContainParam(String attName)
booleanmayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body.
voidoptimize()
voidprepareAttributes()
voidregisterReference(UserFunctionCall ref)
Method called by UserFunctionCall to register the function call for subsequent fixup.
voidsetParameterDefinitions(UserFunction fn)
Set the definitions of the parameters in the compiled function, as an array.
voidvalidate()

Field Detail

references

List references

Method Detail

compile

public Expression compile(Executable exec)
Compile the function definition to create an executable representation

Returns: an Instruction, or null. The instruction returned is actually rather irrelevant; the compile() method has the side-effect of binding all references to the function to the executable representation (a UserFunction object)

Throws: XPathException

fixupReferences

public void fixupReferences()
Notify all references to this function of the data type.

Throws: XPathException

getCompiledFunction

public UserFunction getCompiledFunction()
Get the compiled function

Returns: the object representing the compiled user-written function

getConstructType

public int getConstructType()
Get the type of construct. This will be a constant in class Location. This method is part of the InstructionInfo interface

getNumberOfArguments

public int getNumberOfArguments()
Get the number of arguments declared by this function (that is, its arity).

Returns: the arity of the function

getObjectName

public StructuredQName getObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically. If there is no name, the value will be -1.

getResultType

public SequenceType getResultType()
Get the type of value returned by this function

Returns: the declared result type, or the inferred result type if this is more precise

getSlotManager

public SlotManager getSlotManager()
Get associated Procedure (for details of stack frame).

Returns: the associated Procedure object

isOverriding

public boolean isOverriding()
Is override="yes"?.

Returns: true if override="yes" was specified, otherwise false

isPermittedChild

protected boolean isPermittedChild(StyleElement child)
Specify that xsl:param is a permitted child

mayContainParam

protected boolean mayContainParam(String attName)

mayContainSequenceConstructor

public boolean mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body.

Returns: true: yes, it may contain a general template-body

optimize

public void optimize()

prepareAttributes

public void prepareAttributes()

registerReference

public void registerReference(UserFunctionCall ref)
Method called by UserFunctionCall to register the function call for subsequent fixup.

Parameters: ref the UserFunctionCall to be registered

setParameterDefinitions

public void setParameterDefinitions(UserFunction fn)
Set the definitions of the parameters in the compiled function, as an array.

Parameters: fn the compiled object representing the user-written function

validate

public void validate()