Package net.sf.saxon.style
Class XSLVariableDeclaration
- java.lang.Object
-
- net.sf.saxon.tree.linked.NodeImpl
-
- net.sf.saxon.tree.linked.ParentNodeImpl
-
- net.sf.saxon.tree.linked.ElementImpl
-
- net.sf.saxon.style.StyleElement
-
- net.sf.saxon.style.XSLGeneralVariable
-
- net.sf.saxon.style.XSLVariableDeclaration
-
- All Implemented Interfaces:
java.io.Serializable,javax.xml.transform.Source,javax.xml.transform.SourceLocator,LocationProvider,SaxonLocator,PullEvent,Container,VariableDeclaration,FingerprintedNode,Item<NodeInfo>,MutableNodeInfo,NamespaceResolver,NodeInfo,ValueRepresentation<NodeInfo>,StylesheetProcedure,InstructionInfo,SiblingCountingNode,org.xml.sax.Locator
- Direct Known Subclasses:
XSLParam,XSLVariable
public abstract class XSLVariableDeclaration extends XSLGeneralVariable implements VariableDeclaration, StylesheetProcedure
Generic class for xsl:variable and xsl:param elements.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Listreferences-
Fields inherited from class net.sf.saxon.style.XSLGeneralVariable
assignable, compiledVariable, constantText, global, implicitlyRequiredParam, redundant, requiredParam, requiredType, select, slotManager, tunnel
-
Fields inherited from class net.sf.saxon.style.StyleElement
ACTION_COMPILE, ACTION_FIXUP, ACTION_OPTIMIZE, ACTION_PROCESS_ATTRIBUTES, ACTION_TYPECHECK, ACTION_VALIDATE, actionsCompleted, defaultCollationName, defaultXPathNamespace, extensionNamespaces, REPORT_ALWAYS, REPORT_IF_INSTANTIATED, REPORT_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE, reportingCircumstances, staticContext, validationError, version, YES_NO
-
Fields inherited from class net.sf.saxon.tree.linked.NodeImpl
NODE_LETTER
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
ALL_NAMESPACES, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
-
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
-
Constructor Summary
Constructors Constructor Description XSLVariableDeclaration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidfixupBinding(Binding binding)Notify all variable references of the Binding instructionvoidfixupReferences()Notify all references to this variable of the data typeGeneralVariablegetCompiledVariable()Get the compiled variableabstract 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(Declaration decl, PrincipalStylesheetModule top)Method supplied by declaration elements to add themselves to a stylesheet-level indexbooleanisDeclaration()Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import).booleanisInstruction()Determine whether this node is an instruction.voidoptimize(Declaration declaration)Optimize the stylesheet constructvoidregisterReference(BindingReference ref)Method called by VariableReference to register the variable reference for subsequent fixupprotected voidsetReferenceCount(GeneralVariable var)Set the number of references to this variable.voidsetSlotNumber(int slot)Allocate a slot number to this variablevoidvalidate(Declaration decl)Check that the variable is not already declared, and allocate a slot number-
Methods inherited from class net.sf.saxon.style.XSLGeneralVariable
allowsAsAttribute, allowsRequired, allowsTunnelAttribute, allowsValue, checkAgainstRequiredType, getConstructType, getReturnedItemType, getVariableDisplayName, getVariableQName, initializeBinding, isAssignable, isGlobal, isRequiredParam, isTunnelParam, mayContainSequenceConstructor, postValidate, prepareAttributes, setRedundant
-
Methods inherited from class net.sf.saxon.style.StyleElement
allocateLocationId, allocatePatternSlots, allocateSlots, bindLocalVariable, bindVariable, checkAttributeValue, checkEmpty, checkSortComesFirst, checkTopLevel, checkUnknownAttribute, compile, compileDeclaration, compileError, compileError, compileError, compileError, compileSequenceConstructor, compileWarning, compileWarning, definesExcludedNamespace, definesExtensionElement, fallbackProcessing, forwardsCompatibleModeIsEnabled, getAttributeSets, getAttributeValue, getColumnNumber, getCommonChildItemType, getContainerGranularity, getContainingSlotManager, getContainingStylesheet, getDefaultCollationName, getDefaultXPathNamespace, getEffectiveVersion, getExecutable, getHostLanguage, getLastChildInstruction, getLineNumber, getLocationProvider, getNamespaceResolver, getObjectName, getPreparedStylesheet, getPrincipalStylesheetModule, getProcessorVersion, getProperties, getProperty, getSchemaType, getStaticContext, getSystemId, getTypeAnnotation, getWithParamInstructions, isActionCompleted, isExcludedNamespace, isExplaining, isExtensionNamespace, isPermittedChild, issueWarning, issueWarning, isTopLevel, isXslt30Processor, makeAttributeValueTemplate, makeExpression, makeExpressionVisitor, makeNamespaceContext, makePattern, makeQName, makeSequenceType, makeSortKeys, makeTraceInstruction, markTailCalls, mayContainFallback, mayContainParam, processAllAttributes, processAttributes, processDefaultCollationAttribute, processDefaultXPathNamespaceAttribute, processExcludedNamespaces, processExtensionElementAttribute, processStandardAttributes, processVersionAttribute, reportAbsence, seesAvuncularVariables, setActionCompleted, setObjectName, setValidationError, substituteFor, typeCheck, typeCheck, undeclaredNamespaceError, validateChildren, validateSubtree, xPath10ModeIsEnabled
-
Methods inherited from class net.sf.saxon.tree.linked.ElementImpl
addAttribute, addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getDocumentRoot, getLineNumber, getNameCode, getNamespaceList, getNodeKind, getPrefixForURI, getRoot, getSchemaType, getSystemId, getTypeAnnotation, getURIForPrefix, gsetAttributeCollection, initialise, isId, isNilled, iteratePrefixes, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setAttributeList, setLocation, setNameCode, setNamespaceDeclarations, setNamespaceList, setSystemId, setTypeAnnotation
-
Methods inherited from class net.sf.saxon.tree.linked.ParentNodeImpl
addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getNumberOfChildren, getRawSequenceNumber, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, insertChildren, insertChildrenAt, removeChild, replaceChildrenAt, setChildren, setRawSequenceNumber
-
Methods inherited from class net.sf.saxon.tree.linked.NodeImpl
atomize, compareOrder, equals, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRawParent, getSiblingPosition, getTypedValue, getURI, insertSiblings, isDeleted, isIdref, isSameNodeInfo, iterateAxis, iterateAxis, newBuilder, replace, setRawParent, setSiblingPosition
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.InstructionInfo
getLineNumber, getSystemId
-
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
-
Methods inherited from interface net.sf.saxon.expr.VariableDeclaration
getVariableQName
-
-
-
-
Method Detail
-
isDeclaration
public boolean isDeclaration()
Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import).- Overrides:
isDeclarationin classStyleElement- Returns:
- true for this element
-
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.- Specified by:
getSlotManagerin interfaceStylesheetProcedure- 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
-
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
-
getRequiredType
public abstract SequenceType getRequiredType()
Get the static type of the variable.- Returns:
- the static type declared for the variable
-
registerReference
public void registerReference(BindingReference ref)
Method called by VariableReference to register the variable reference for subsequent fixup- Specified by:
registerReferencein interfaceVariableDeclaration- Parameters:
ref- the variable reference
-
isInstruction
public boolean isInstruction()
Determine whether this node is an instruction.- Overrides:
isInstructionin classStyleElement- Returns:
- true - it is an instruction (well, it can be, anyway)
-
fixupReferences
public void fixupReferences() throws XPathExceptionNotify all references to this variable of the data type- Overrides:
fixupReferencesin classStyleElement- Throws:
XPathException- if any references cannot be fixed up.
-
validate
public void validate(Declaration decl) throws XPathException
Check that the variable is not already declared, and allocate a slot number- Overrides:
validatein classXSLGeneralVariable- Parameters:
decl-- Throws:
XPathException- if any error is found during validation
-
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
-
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.- Overrides:
setReferenceCountin classXSLGeneralVariable- Parameters:
var- the variable
-
index
protected void index(Declaration decl, PrincipalStylesheetModule top) throws XPathException
Description copied from class:StyleElementMethod supplied by declaration elements to add themselves to a stylesheet-level index- Overrides:
indexin classStyleElement- Parameters:
decl- the Declaration being indexed. (This corresponds to the StyleElement object except in cases where one module is imported several times with different precedence.)top- the outermost XSLStylesheet element- Throws:
XPathException- if any error is encountered
-
optimize
public void optimize(Declaration declaration) throws XPathException
Optimize the stylesheet construct- Specified by:
optimizein interfaceStylesheetProcedure- Parameters:
declaration-- Throws:
XPathException
-
getCompiledVariable
public GeneralVariable getCompiledVariable()
Get the compiled variable- Returns:
- the compiled variable if it has been compiled, or null otherwise
-
-