net.sf.saxon.style

Class XSLVariableDeclaration

public abstract class XSLVariableDeclaration extends XSLGeneralVariable implements VariableDeclaration, StylesheetProcedure

Generic class for xsl:variable and xsl:param elements.
Field Summary
protected Listreferences
Method Summary
protected voidfixupBinding(Binding binding)
Notify all variable references of the Binding instruction
voidfixupReferences()
Notify all references to this variable of the data type
GeneralVariablegetCompiledVariable()
Get the compiled variable
abstract SequenceTypegetRequiredType()
Get the static type of the variable.
SlotManagergetSlotManager()
Get the SlotManager associated with this stylesheet construct.
intgetSlotNumber()
Get the slot number allocated to this variable (its position in the stackframe)
protected voidindex(XSLStylesheet top)
booleanisInstruction()
Determine whether this node is an instruction.
voidoptimize()
Optimize the stylesheet construct
voidregisterReference(BindingReference ref)
Method called by VariableReference to register the variable reference for subsequent fixup
protected voidsetReferenceCount(GeneralVariable var)
Set the number of references to this variable.
voidsetSlotNumber(int slot)
Allocate a slot number to this variable
voidvalidate()
Check that the variable is not already declared, and allocate a slot number

Field Detail

references

protected List references

Method Detail

fixupBinding

protected void fixupBinding(Binding binding)
Notify all variable references of the Binding instruction

Parameters: binding the Binding that represents this variable declaration in the executable code tree

fixupReferences

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

getCompiledVariable

public GeneralVariable getCompiledVariable()
Get the compiled variable

Returns: the compiled variable if it has been compiled, or null otherwise

getRequiredType

public abstract SequenceType getRequiredType()
Get the static type of the variable.

Returns: the static type declared for the variable

getSlotManager

public SlotManager getSlotManager()
Get the SlotManager associated with this stylesheet construct. The SlotManager contains the information needed to manage the local stack frames used by run-time instances of the code.

Returns: the associated SlotManager object

getSlotNumber

public int getSlotNumber()
Get the slot number allocated to this variable (its position in the stackframe)

Returns: the allocated slot number

index

protected void index(XSLStylesheet top)

isInstruction

public boolean isInstruction()
Determine whether this node is an instruction.

Returns: true - it is an instruction (well, it can be, anyway)

optimize

public void optimize()
Optimize the stylesheet construct

registerReference

public void registerReference(BindingReference ref)
Method called by VariableReference to register the variable reference for subsequent fixup

setReferenceCount

protected void setReferenceCount(GeneralVariable var)
Set the number of references to this variable. This code is invoked only for a global variable, and only if there is at least one reference.

Parameters: var the variable

setSlotNumber

public void setSlotNumber(int slot)
Allocate a slot number to this variable

Parameters: slot the position of the variable on the local stack frame

validate

public void validate()
Check that the variable is not already declared, and allocate a slot number