net.sf.saxon.style

Class XSLFunction

Implemented Interfaces:
Locator, Container, Locator, Serializable, Source, SourceLocator, FingerprintedNode, InstructionInfo, Item, LocationProvider, NamespaceResolver, NodeInfo, PullEvent, SaxonLocator, StylesheetProcedure, ValueRepresentation

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

Fields inherited from class net.sf.saxon.style.StyleElement

REPORT_ALWAYS, REPORT_IF_INSTANTIATED, REPORT_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE, defaultCollationName, defaultXPathNamespace, extensionNamespaces, reportingCircumstances, staticContext, validationError, version

Fields inherited from class net.sf.saxon.tree.ElementWithAttributes

attributeList, namespaceList

Fields inherited from class net.sf.saxon.tree.ElementImpl

nameCode, root

Fields inherited from class net.sf.saxon.tree.ParentNodeImpl

sequence

Fields inherited from class net.sf.saxon.tree.NodeImpl

NODE_LETTER, index, parent

Fields inherited from interface net.sf.saxon.om.NodeInfo

ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES

Fields inherited from interface net.sf.saxon.om.ValueRepresentation

EMPTY_VALUE_ARRAY

Method Summary

Expression
compile(Executable exec)
Compile the function definition to create an executable representation
void
fixupReferences()
Notify all references to this function of the data type.
UserFunction
getCompiledFunction()
Get the compiled function
int
getConstructType()
Get the type of construct.
int
getNumberOfArguments()
Get the number of arguments declared by this function (that is, its arity).
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.
SequenceType
getResultType()
Get the type of value returned by this function
SlotManager
getSlotManager()
Get associated Procedure (for details of stack frame).
boolean
isOverriding()
Is override="yes"?.
protected boolean
isPermittedChild(StyleElement child)
Specify that xsl:param is a permitted child
boolean
mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body.
void
prepareAttributes()
void
registerReference(UserFunctionCall ref)
Method called by UserFunctionCall to register the function call for subsequent fixup.
void
setParameterDefinitions(UserFunction fn)
Set the definitions of the parameters in the compiled function, as an array.
void
validate()

Methods inherited from class net.sf.saxon.style.StyleElement

allocateLocationId, allocatePatternSlots, allocateSlots, backwardsCompatibleModeIsEnabled, bindVariable, checkEmpty, checkSortComesFirst, checkTopLevel, checkUnknownAttribute, checkWithinTemplate, compile, compileError, compileError, compileError, compileSequenceConstructor, compileWarning, definesExcludedNamespace, definesExtensionElement, fallbackProcessing, fixupReferences, forwardsCompatibleModeIsEnabled, getAllStylesheetFunctions, getAttributeSets, getAttributeValue, getCommonChildItemType, getConstructType, getContainingSlotManager, getContainingStylesheet, getDefaultCollationName, getDefaultXPathNamespace, getExecutable, getHostLanguage, getLastChildInstruction, getLineNumber, getLineNumber, getLocationProvider, getNamespaceResolver, getObjectName, getObjectName, getPrecedence, getPreparedStylesheet, getPrincipalStylesheet, getProperties, getProperty, getReturnedItemType, getSchemaType, getStaticContext, getStylesheetFunction, getSystemId, getTypeAnnotation, getVersion, getWithParamInstructions, isExcludedNamespace, isExplaining, isExtensionNamespace, isInstruction, isPermittedChild, isTopLevel, issueWarning, issueWarning, makeAttributeValueTemplate, makeExpression, makeExpressionVisitor, makeNamespaceContext, makePattern, makeQName, makeSequenceType, makeSortKeys, makeTraceInstruction, markTailCalls, mayContainFallback, mayContainSequenceConstructor, postValidate, prepareAttributes, processAllAttributes, processAttributes, processDefaultCollationAttribute, processDefaultXPathNamespaceAttribute, processExcludedNamespaces, processExtensionElementAttribute, processVersionAttribute, replaceSubExpression, reportAbsence, setLineNumber, setObjectName, setValidationError, substituteFor, typeCheck, typeCheck, undeclaredNamespaceError, validate, validateChildren, validateSubtree

Methods inherited from class net.sf.saxon.tree.ElementWithAttributes

copy, getAttributeList, getAttributeValue, getDeclaredNamespaces, getInScopeNamespaceCodes, getPrefixForURI, getURICodeForPrefix, getURIForPrefix, initialise, iteratePrefixes, setNamespaceDeclarations

Methods inherited from class net.sf.saxon.tree.ElementImpl

copy, generateId, getAttributeList, getBaseURI, getDeclaredNamespaces, getDocumentRoot, getLineNumber, getNameCode, getNodeKind, getRoot, getSystemId, initialise, setLineNumber, setNameCode, setSystemId

Methods inherited from class net.sf.saxon.tree.ParentNodeImpl

addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, useChildrenArray

Methods inherited from class net.sf.saxon.tree.NodeImpl

atomize, compareOrder, equals, generateId, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getFirstChild, getLastChild, getLineNumber, getLocalPart, getNameCode, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRoot, getSequenceNumber, getStringValueCS, getSystemId, getTypeAnnotation, getTypedValue, getURI, hasChildNodes, hashCode, isSameNodeInfo, iterateAxis, iterateAxis, setSystemId

Method Details

compile

public Expression compile(Executable exec)
            throws XPathException
Compile the function definition to create an executable representation
Overrides:
compile in interface StyleElement
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()
            throws XPathException
Notify all references to this function of the data type.
Overrides:
fixupReferences in interface StyleElement
Throws:
XPathException -

getCompiledFunction

public UserFunction getCompiledFunction()
Get the compiled function
Returns:
the object representing the compiled user-written function

getConstructType

public int getConstructType()
Specified by:
getConstructType in interface InstructionInfo
Overrides:
getConstructType in interface StyleElement

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.
Overrides:
getObjectName in interface StyleElement

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).
Specified by:
getSlotManager in interface StylesheetProcedure
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
Overrides:
isPermittedChild in interface StyleElement

mayContainSequenceConstructor

public boolean mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body.
Overrides:
mayContainSequenceConstructor in interface StyleElement
Returns:
true: yes, it may contain a general template-body

prepareAttributes

public void prepareAttributes()
            throws XPathException
Overrides:
prepareAttributes in interface StyleElement

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()
            throws XPathException
Overrides:
validate in interface StyleElement