net.sf.saxon.style

Class XSLGeneralVariable

Implemented Interfaces:
Locator, Container, Locator, Serializable, Source, SourceLocator, FingerprintedNode, InstructionInfo, Item, LocationProvider, NamespaceResolver, NodeInfo, PullEvent, SaxonLocator, ValueRepresentation
Known Direct Subclasses:
SaxonAssign, SQLColumn, XSLVariableDeclaration, XSLWithParam

public abstract class XSLGeneralVariable
extends StyleElement

This class defines common behaviour across xsl:variable, xsl:param, and xsl:with-param

Field Summary

protected boolean
assignable
protected String
constantText
protected boolean
global
protected boolean
implicitlyRequiredParam
protected boolean
redundant
protected boolean
requiredParam
protected SequenceType
requiredType
protected Expression
select
protected SlotManager
slotManager
protected boolean
tunnel

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

protected boolean
allowsAsAttribute()
protected boolean
allowsRequired()
protected boolean
allowsTunnelAttribute()
protected boolean
allowsValue()
protected void
checkAgainstRequiredType(SequenceType required)
Check the supplied select expression against the required type.
int
getConstructType()
Get the type of construct.
protected ItemType
getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction).
String
getVariableDisplayName()
Get the display name of the variable.
StructuredQName
getVariableQName()
Get the QName of the variable
protected void
initializeInstruction(Executable exec, GeneralVariable var)
Initialize - common code called from the compile() method of all subclasses
boolean
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element.
boolean
isGlobal()
Test whether this is a global variable or parameter
boolean
isRequiredParam()
Test whether this is a required parameter (required="yes")
boolean
isTunnelParam()
Test whether this is a tunnel parameter (tunnel="yes")
boolean
mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body
void
prepareAttributes()
void
setRedundant()
Mark this global variable as redundant.
protected void
setReferenceCount(GeneralVariable var)
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

Field Details

assignable

protected boolean assignable

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 Details

allowsAsAttribute

protected boolean allowsAsAttribute()

allowsRequired

protected boolean allowsRequired()

allowsTunnelAttribute

protected boolean allowsTunnelAttribute()

allowsValue

protected boolean allowsValue()

checkAgainstRequiredType

protected void checkAgainstRequiredType(SequenceType required)
            throws XPathException
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()
Specified by:
getConstructType in interface InstructionInfo
Overrides:
getConstructType in interface StyleElement

getReturnedItemType

protected ItemType getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction).
Overrides:
getReturnedItemType in interface StyleElement
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)
            throws XPathException
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
Overrides:
mayContainSequenceConstructor in interface StyleElement
Returns:
true: yes, it may contain a template-body

prepareAttributes

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

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