net.sf.saxon.style

Class XSLGeneralVariable

public abstract class XSLGeneralVariable extends StyleElement

This class defines common behaviour across xsl:variable, xsl:param, and xsl:with-param
Field Summary
protected booleanassignable
protected GeneralVariablecompiledVariable
protected StringconstantText
protected booleanglobal
protected booleanimplicitlyRequiredParam
protected booleanredundant
protected booleanrequiredParam
protected SequenceTyperequiredType
protected Expressionselect
protected SlotManagerslotManager
protected booleantunnel
Method Summary
protected booleanallowsAsAttribute()
protected booleanallowsRequired()
protected booleanallowsTunnelAttribute()
protected booleanallowsValue()
voidcheckAgainstRequiredType(SequenceType required)
Check the supplied select expression against the required type.
intgetConstructType()
Get the type of construct.
protected ItemTypegetReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction).
StringgetVariableDisplayName()
Get the display name of the variable.
StructuredQNamegetVariableQName()
Get the QName of the variable
protected voidinitializeInstruction(Executable exec, GeneralVariable var)
Initialize - common code called from the compile() method of all subclasses
booleanisAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element.
booleanisGlobal()
Test whether this is a global variable or parameter
booleanisRequiredParam()
Test whether this is a required parameter (required="yes")
booleanisTunnelParam()
Test whether this is a tunnel parameter (tunnel="yes")
booleanmayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body
voidpostValidate()
Hook to allow additional validation of a parent element immediately after its children have been validated.
voidprepareAttributes()
voidsetRedundant()
Mark this global variable as redundant.
protected voidsetReferenceCount(GeneralVariable var)
voidvalidate()

Field Detail

assignable

protected boolean assignable

compiledVariable

protected GeneralVariable compiledVariable

constantText

protected String constantText

global

protected boolean global

implicitlyRequiredParam

protected boolean implicitlyRequiredParam

redundant

protected boolean redundant

requiredParam

protected boolean requiredParam

requiredType

protected SequenceType requiredType

select

protected Expression select

slotManager

protected SlotManager slotManager

tunnel

protected boolean tunnel

Method Detail

allowsAsAttribute

protected boolean allowsAsAttribute()

allowsRequired

protected boolean allowsRequired()

allowsTunnelAttribute

protected boolean allowsTunnelAttribute()

allowsValue

protected boolean allowsValue()

checkAgainstRequiredType

public void checkAgainstRequiredType(SequenceType required)
Check the supplied select expression against the required type.

Parameters: required The type required by the variable declaration, or in the case of xsl:with-param, the signature of the called template

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

getReturnedItemType

protected ItemType getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction).

Returns: the item type returned. This is null for a variable: we are not interested in the type of the variable, but in what the xsl:variable constributes to the result of the sequence constructor it is part of.

getVariableDisplayName

public String getVariableDisplayName()
Get the display name of the variable.

Returns: the lexical QName

getVariableQName

public StructuredQName getVariableQName()
Get the QName of the variable

Returns: the name as a structured QName, or a dummy name if the variable has no name attribute or has an invalid name attribute

initializeInstruction

protected void initializeInstruction(Executable exec, GeneralVariable var)
Initialize - common code called from the compile() method of all subclasses

Parameters: exec the executable var the representation of the variable declaration in the compiled executable

isAssignable

public boolean isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element.

Returns: true if the extra attribute saxon:assignable="yes" is present.

isGlobal

public boolean isGlobal()
Test whether this is a global variable or parameter

Returns: true if this is global

isRequiredParam

public boolean isRequiredParam()
Test whether this is a required parameter (required="yes")

Returns: true if this is a required parameter

isTunnelParam

public boolean isTunnelParam()
Test whether this is a tunnel parameter (tunnel="yes")

Returns: true if this is a tunnel parameter

mayContainSequenceConstructor

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

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

postValidate

public void postValidate()
Hook to allow additional validation of a parent element immediately after its children have been validated.

prepareAttributes

public void prepareAttributes()

setRedundant

public void setRedundant()
Mark this global variable as redundant. This is done before prepareAttributes is called.

setReferenceCount

protected void setReferenceCount(GeneralVariable var)

validate

public void validate()