Package net.sf.saxon.style
Class StyleElement
- 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
-
- All Implemented Interfaces:
Iterable<NodeInfo>,Source,SourceLocator,Location,GroundedValue<NodeInfo>,Item<NodeInfo>,MutableNodeInfo,NamespaceResolver,NodeInfo,Sequence<NodeInfo>,SteppingNode<NodeImpl>,SiblingCountingNode,Locator
- Direct Known Subclasses:
AbsentExtensionElement,ExtensionInstruction,LiteralResultElement,XSLAcceptExpose,XSLAccumulator,XSLAccumulatorRule,XSLAnalyzeString,XSLApplyImports,XSLApplyTemplates,XSLAssert,XSLAttributeSet,XSLBreakOrContinue,XSLCallTemplate,XSLCatch,XSLCharacterMap,XSLChoose,XSLContextItem,XSLCopy,XSLCopyOf,XSLDecimalFormat,XSLDocument,XSLElement,XSLEvaluate,XSLFallback,XSLForEach,XSLForEachGroup,XSLFork,XSLFunction,XSLGeneralIncorporate,XSLGeneralVariable,XSLGlobalVariable,XSLIf,XSLImportSchema,XSLIterate,XSLKey,XSLLeafNodeConstructor,XSLMap,XSLMapEntry,XSLMatchingSubstring,XSLMerge,XSLMergeAction,XSLMergeSource,XSLMessage,XSLMode,XSLModuleRoot,XSLNamespaceAlias,XSLNextMatch,XSLNumber,XSLOnCompletion,XSLOtherwise,XSLOutput,XSLOutputCharacter,XSLOverride,XSLPerformSort,XSLPreserveSpace,XSLResultDocument,XSLSequence,XSLSortOrMergeKey,XSLSourceDocument,XSLTemplate,XSLTry,XSLUsePackage,XSLWhen,XSLWherePopulated
public abstract class StyleElement extends ElementImpl
Abstract superclass for all element nodes in the stylesheet.Note: this class implements Locator. The element retains information about its own location in the stylesheet, which is useful when an XSLT static error is found.
-
-
Field Summary
Fields Modifier and Type Field Description static intACTION_COMPILEstatic intACTION_FIXUPstatic intACTION_OPTIMIZEstatic intACTION_PROCESS_ATTRIBUTESstatic intACTION_TYPECHECKstatic intACTION_VALIDATEprotected intactionsCompletedprotected StringdefaultCollationNameprotected StructuredQNamedefaultModeprotected StringdefaultXPathNamespaceprotected booleanexpandTextprotected String[]extensionNamespacesstatic intIGNORED_INSTRUCTIONstatic intREPORT_ALWAYSstatic intREPORT_DYNAMICALLY_UNLESS_FALLBACK_AVAILABLEstatic intREPORT_IF_INSTANTIATEDstatic intREPORT_STATICALLY_UNLESS_FALLBACK_AVAILABLEstatic intREPORT_UNLESS_FORWARDS_COMPATIBLEprotected intreportingCircumstancesprotected ExpressionContextstaticContextprotected XPathExceptionvalidationErrorprotected intversionprotected static String[]YES_NO-
Fields inherited from class net.sf.saxon.tree.linked.NodeImpl
NODE_LETTER
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
IS_DTD_TYPE, IS_NILLED
-
-
Constructor Summary
Constructors Constructor Description StyleElement()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidallocateLocalSlots(Expression exp)Allocate slots in the local stack frame to range variables used in an XPath expressionprotected LocationallocateLocation()Allocate a locationSourceBindingbindLocalVariable(StructuredQName qName)Bind a variable reference used in this element to the compiled form of the XSLVariable element in which it is declared, considering only local variables and paramsSourceBindingbindVariable(StructuredQName qName)Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declaredbooleanchangesRetainedStaticContext()Ask whether this instruction requires a different retained static context from the containing (parent) instruction.protected voidcheckAttributeValue(String name, String value, boolean avt, String[] allowed)Check the value of an attribute, as supplied staticallyvoidcheckEmpty()Convenience method to check that the stylesheet element is emptyprotected voidcheckSortComesFirst(boolean sortRequired)Check that among the children of this element, any xsl:sort elements precede any other elementsvoidcheckTopLevel(String errorCode, boolean allowOverride)Convenience method to check that the stylesheet element is at the top level (that is, as a child of xsl:stylesheet or xsl:transform)protected voidcheckUnknownAttribute(NodeName nc)Check whether an unknown attribute is permitted.Expressioncompile(Compilation compilation, ComponentDeclaration decl)Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.voidcompileContentValueTemplate(TextImpl node, List<Expression> contents)Compile a content value text node.voidcompileDeclaration(Compilation compilation, ComponentDeclaration decl)Compile a declaration in the stylesheet tree for use at run-time.voidcompileError(String message)Report a static error in the stylesheetvoidcompileError(String message, String errorCode)Compile time error, specifying an error codevoidcompileError(String message, String errorCode, Location loc)voidcompileError(String message, StructuredQName errorCode)Compile time error, specifying an error codevoidcompileError(XPathException error)Report an error with diagnostic informationvoidcompileErrorInAttribute(String message, String errorCode, String attributeName)Compile time error, specifying an error code and the name of the attribute that is in error.ExpressioncompileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, boolean includeParams)Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.ExpressioncompileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, SequenceIterator iter, boolean includeParams)Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.voidcompileWarning(String message, String errorCode)voidcompileWarning(String message, StructuredQName errorCode)protected booleandefinesExcludedNamespace(String uri)Check whether this node excludes a particular namespace from the result.protected booleandefinesExtensionElement(String uri)Check whether a particular extension element namespace is defined on this node.protected ExpressionfallbackProcessing(Compilation exec, ComponentDeclaration decl, StyleElement instruction)Perform fallback processing.StyleElementfindAncestorElement(int fingerprint)Get the first ancestor element in the stylesheet tree that has a given name, supplied by fingerprint.StringCollatorfindCollation(String name, String baseURI)Find a named collation.voidfixupReferences()Fix up references from XPath expressions.booleanforwardsCompatibleModeIsEnabled()Determine whether forwards-compatible mode is enabled for this elementprotected StringgenerateId()StringgetAttributeValue(String clarkName)Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).StringgetBaseURI()Get the base URI of the element, which acts as the static base URI for XPath expressions defined on this element.SourceBindinggetBindingInformation(StructuredQName name)Ask whether this element contains a binding for a variable with a given name; and if it does, return the source binding informationCompilationgetCompilation()ConfigurationgetConfiguration()Get the configurationintgetConstructType()Get the type of construct.StylesheetPackagegetContainingPackage()Get the containing package (the principal stylesheet module of the package in which this XSLT element appears)SlotManagergetContainingSlotManager()Get the SlotManager for the containing Procedure definitionXSLModuleRootgetContainingStylesheet()Get the containing XSLStylesheet or XSLPackage elementVisibilitygetDeclaredVisibility()Get the visibility of the component.protected StringgetDefaultCollationName()Get the default collation for this stylesheet element.StructuredQNamegetDefaultMode()Get the default mode for this stylesheet element.intgetDefaultValidation()Get the effective value of the default-validation attributeStringgetDefaultXPathNamespace()Get the default XPath namespace for elements and typesintgetEffectiveVersion()Get the numeric value of the version number appearing as an attribute on this element, or inherited from its ancestorsStringgetEffectiveVersionAsString()Get the effective version in a form suitable for display (for example "1.0" or "2.0")protected StyleElementgetLastChildInstruction()Find the last child instruction of this instruction.NamespaceResolvergetNamespaceResolver()Get the namespace context of the instruction.StructuredQNamegetObjectName()Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.ComponentgetOverriddenComponent()Get the component that this declaration overrides, or null if this is not an overriding declarationStylesheetPackagegetPackageData()PrincipalStylesheetModulegetPrincipalStylesheetModule()Get the principal stylesheet module of the package in which this XSLT element appearsIterator<String>getProperties()Get an iterator over all the properties available.ObjectgetProperty(String name)Get the value of a particular property of the instruction.SchemaTypegetSchemaType(String typeAtt)Get the Schema type definition for a type named in the stylesheet (in a "type" attribute).ExpressionContextgetStaticContext()Get the static context for expressions on this elementExpressionContextgetStaticContext(StructuredQName attributeName)SimpleTypegetTypeAnnotation(SchemaType schemaType)Get the type annotation to use for a given schema typeprotected StructuredQName[]getUsedAttributeSets(String use)Get the list of attribute-set names associated with this element.StylesheetPackagegetUsedPackage()Assuming this is an xsl:use-package element, find the package to which it refers.VisibilitygetVisibility()Get the visibility of the component.WithParam[]getWithParamInstructions(Expression parent, Compilation compilation, ComponentDeclaration decl, boolean tunnel)Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match).ActorgetXslOriginal(int componentKind)Check that a reference to xsl:original appears within an xsl:override element, and that the name of the containing component matches the name of a component in the used stylesheet package; return the component in that package with matching symbolic nameprotected SourceBindinghasImplicitBinding(StructuredQName name)Ask whether this particular element implicitly binds a given variable (used for xsl:accumulator-rule)voidindex(ComponentDeclaration decl, PrincipalStylesheetModule top)Method supplied by declaration elements to add themselves to a stylesheet-level indexprotected VisibilityinterpretVisibilityValue(String s, String flags)Process the value of the visibility attribute (XSLT 3.0).protected voidinvalidAttribute(String attributeName, String allowedValues)booleanisActionCompleted(int action)Ask if an action on this StyleElement has been completedbooleanisConstructingComplexContent()Ask whether this is an instruction that is known to be constructing nodes which will become children of a parent document or element node, and will not have an independent existence of their own.booleanisDeclaration()Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import).booleanisExcludedNamespace(String uri)Check whether a namespace uri defines an namespace excluded from the result.booleanisExpandingText()Ask whether content value templates are available within this elementbooleanisExtensionNamespace(String uri)Check whether a namespace uri defines an extension element.booleanisInstruction()Ask whether this node is an instruction.(package private) static booleanisNo(String s)protected booleanisPermittedChild(StyleElement child)Check whether a given child is permitted for this element.booleanisSchemaAware()Ask whether the code is compiled in schema-aware modeprotected voidissueWarning(String message, SourceLocator locator)Report a warning to the error listenerprotected voidissueWarning(XPathException error)Report a warning to the error listenerbooleanisTopLevel()Test whether this is a top-level elementprotected booleanisWithinDeclaredStreamableConstruct()(package private) static booleanisYes(String s)protected ExpressionmakeAttributeValueTemplate(String expression, int attIndex)Make an attribute value template in the context of this stylesheet elementExpressionmakeExpression(String expression, int attIndex)Compile an XPath expression in the context of this stylesheet elementExpressionVisitormakeExpressionVisitor()Make an expression visitorSequenceTypemakeExtendedSequenceType(String sequenceType)SavedNamespaceContextmakeNamespaceContext()Make a NamespaceContext object representing the list of in-scope namespaces.PatternmakePattern(String pattern, String attributeName)Make a pattern in the context of this stylesheet elementStructuredQNamemakeQName(String lexicalQName)Make a structured QName, using this Element as the context for namespace resolution.RetainedStaticContextmakeRetainedStaticContext()SequenceTypemakeSequenceType(String sequenceType)Process an attribute whose value is a SequenceTypeSortKeyDefinitionListmakeSortKeys(Compilation compilation, ComponentDeclaration decl)Construct sort keys for a SortedIteratorprotected static ExpressionmakeTraceInstruction(StyleElement source, Expression child)Create a trace instruction to wrap a real instructionprotected booleanmarkTailCalls()Mark tail-recursive calls on templates and functions.protected booleanmayContainFallback()Determine whether this type of element is allowed to contain an xsl:fallback instruction.protected booleanmayContainParam()Determine whether this type of element is allowed to contain an xsl:param elementprotected booleanmayContainSequenceConstructor()Determine whether this type of element is allowed to contain a sequence constructorvoidpostValidate()Hook to allow additional validation of a parent element immediately after its children have been validated.protected abstract voidprepareAttributes()Set the attribute list for the element.voidprocessAllAttributes()Process the attributes of this element and all its childrenprotected voidprocessAttributes()Process the attribute list for the element.booleanprocessBooleanAttribute(String name, String value)Process an attribute whose value is yes, no, true, false, 1, or 0; returning true or false.protected voidprocessDefaultCollationAttribute()Process the [xsl:]default-collation attribute if there is one.protected voidprocessDefaultMode()Process the [xsl:]default-mode attribute if there is oneprotected voidprocessDefaultValidationAttribute(String ns)Process the [xsl:]expand-text attribute if there is oneprotected voidprocessDefaultXPathNamespaceAttribute(String ns)Process the [xsl:]xpath-default-namespace attribute if there is oneprotected voidprocessExcludedNamespaces(String ns)Process the [xsl:]exclude-result-prefixes attribute if there is oneprotected voidprocessExpandTextAttribute(String ns)Process the [xsl:]expand-text attribute if there is one (and if XSLT 3.0 is enabled)protected voidprocessExtensionElementAttribute(String ns)Process the [xsl:]extension-element-prefixes attribute if there is onevoidprocessStandardAttributes(String namespace)Process the standard attributes such as[xsl:]expand-text.(package private) booleanprocessStreamableAtt(String streamableAtt)protected voidprocessVersionAttribute(String ns)Process the [xsl:]version attribute if there is onevoidreportAbsence(String attribute)Convenience method to report the absence of a mandatory attributeprotected booleanseesAvuncularVariables()Ask whether variables declared in an "uncle" element are visible.voidsetActionCompleted(int action)Say that an action on this StyleElement has been completedvoidsetCompilation(Compilation compilation)voidsetIgnoreInstruction()voidsetObjectName(StructuredQName qName)Set the object name, for example the name of a function, variable, or template declared on this elementvoidsetValidationError(TransformerException reason, int circumstances)Set a validation error.voidsubstituteFor(StyleElement temp)Make this node a substitute for a temporary one previously added to the tree.ExpressiontypeCheck(String name, Expression exp)Type-check an expression.PatterntypeCheck(String name, Pattern pattern)Type-check a pattern.protected voidundeclaredNamespaceError(String prefix, String errorCode, String attributeName)voidvalidate(ComponentDeclaration decl)Check that the stylesheet element is valid.protected voidvalidateChildren(ComponentDeclaration decl, boolean excludeStylesheet)Validate the children of this node, recursively.voidvalidateSubtree(ComponentDeclaration decl, boolean excludeStylesheet)Recursive walk through the stylesheet to validate all nodesprotected intvalidateValidationAttribute(String value)Validate the value of the [xsl:]validation attributebooleanxPath10ModeIsEnabled()Determine whether 1.0-compatible mode is enabled for this element-
Methods inherited from class net.sf.saxon.tree.linked.ElementImpl
addAttribute, addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getLineNumber, getNamespaceList, getNodeKind, getNodeName, getRoot, getSchemaType, getSystemId, getURIForPrefix, gsetAttributeCollection, initialise, isId, isIdref, isInScopeNamespace, isNilled, iteratePrefixes, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setAttributeList, setLocation, setNamespaceDeclarations, setNamespaceList, setNilled, setNodeName, setSystemId, setTypeAnnotation
-
Methods inherited from class net.sf.saxon.tree.linked.ParentNodeImpl
addChild, compact, getFirstChild, getLastChild, getNthChild, getNumberOfChildren, getRawSequenceNumber, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, insertChildren, insertChildrenAt, iterateChildren, removeChild, replaceChildrenAt, setChildren, setRawSequenceNumber
-
Methods inherited from class net.sf.saxon.tree.linked.NodeImpl
atomize, compareOrder, effectiveBooleanValue, equals, getDisplayName, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getRawParent, getSiblingPosition, getSuccessorElement, getTreeInfo, getURI, hasFingerprint, head, insertSiblings, isDeleted, iterate, iterateAxis, iterateAxis, newBuilder, replace, saveLocation, setRawParent, setSiblingPosition
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, itemAt, iterator, reduce, subsequence
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
equals, getGenre, getPublicId, hashCode, isSameNodeInfo, isStreamed, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Field Detail
-
extensionNamespaces
protected String[] extensionNamespaces
-
version
protected int version
-
staticContext
protected ExpressionContext staticContext
-
validationError
protected XPathException validationError
-
reportingCircumstances
protected int reportingCircumstances
-
defaultXPathNamespace
protected String defaultXPathNamespace
-
defaultCollationName
protected String defaultCollationName
-
defaultMode
protected StructuredQName defaultMode
-
expandText
protected boolean expandText
-
REPORT_ALWAYS
public static final int REPORT_ALWAYS
- See Also:
- Constant Field Values
-
REPORT_UNLESS_FORWARDS_COMPATIBLE
public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE
- See Also:
- Constant Field Values
-
REPORT_IF_INSTANTIATED
public static final int REPORT_IF_INSTANTIATED
- See Also:
- Constant Field Values
-
REPORT_STATICALLY_UNLESS_FALLBACK_AVAILABLE
public static final int REPORT_STATICALLY_UNLESS_FALLBACK_AVAILABLE
- See Also:
- Constant Field Values
-
REPORT_DYNAMICALLY_UNLESS_FALLBACK_AVAILABLE
public static final int REPORT_DYNAMICALLY_UNLESS_FALLBACK_AVAILABLE
- See Also:
- Constant Field Values
-
IGNORED_INSTRUCTION
public static final int IGNORED_INSTRUCTION
- See Also:
- Constant Field Values
-
actionsCompleted
protected int actionsCompleted
-
ACTION_VALIDATE
public static final int ACTION_VALIDATE
- See Also:
- Constant Field Values
-
ACTION_COMPILE
public static final int ACTION_COMPILE
- See Also:
- Constant Field Values
-
ACTION_TYPECHECK
public static final int ACTION_TYPECHECK
- See Also:
- Constant Field Values
-
ACTION_OPTIMIZE
public static final int ACTION_OPTIMIZE
- See Also:
- Constant Field Values
-
ACTION_FIXUP
public static final int ACTION_FIXUP
- See Also:
- Constant Field Values
-
ACTION_PROCESS_ATTRIBUTES
public static final int ACTION_PROCESS_ATTRIBUTES
- See Also:
- Constant Field Values
-
YES_NO
protected static final String[] YES_NO
-
-
Method Detail
-
getCompilation
public Compilation getCompilation()
-
setCompilation
public void setCompilation(Compilation compilation)
-
getPackageData
public StylesheetPackage getPackageData()
-
getConfiguration
public Configuration getConfiguration()
Description copied from class:NodeImplGet the configuration- Specified by:
getConfigurationin interfaceNodeInfo- Overrides:
getConfigurationin classNodeImpl- Returns:
- the Configuration to which the tree belongs. The default implementation invokes
getTreeInfo().getConfiguration().
-
getStaticContext
public ExpressionContext getStaticContext()
Get the static context for expressions on this element- Returns:
- the static context
-
getStaticContext
public ExpressionContext getStaticContext(StructuredQName attributeName)
-
getBaseURI
public String getBaseURI()
Get the base URI of the element, which acts as the static base URI for XPath expressions defined on this element. This is an expensive operation so the result is cached- Specified by:
getBaseURIin interfaceNodeInfo- Overrides:
getBaseURIin classElementImpl- Returns:
- the base URI
-
makeExpressionVisitor
public ExpressionVisitor makeExpressionVisitor()
Make an expression visitor- Returns:
- the expression visitor
-
isSchemaAware
public boolean isSchemaAware()
Ask whether the code is compiled in schema-aware mode- Returns:
- true if the compilation is schema-aware
-
substituteFor
public void substituteFor(StyleElement temp)
Make this node a substitute for a temporary one previously added to the tree. See StyleNodeFactory for details. "A node like the other one in all things but its class". Note that at this stage, the node will not yet be known to its parent, though it will contain a reference to its parent; and it will have no children.- Parameters:
temp- the element which this one is substituting for
-
setValidationError
public void setValidationError(TransformerException reason, int circumstances)
Set a validation error. This is an error detected during construction of this element on the stylesheet, but which is not to be reported until later.- Parameters:
reason- the details of the errorcircumstances- a code identifying the circumstances under which the error is to be reported
-
setIgnoreInstruction
public void setIgnoreInstruction()
-
isInstruction
public boolean isInstruction()
Ask whether this node is an instruction. The default implementation says it isn't.- Returns:
- true if this element is an instruction
-
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). The default implementation returns false- Returns:
- true if the element is a permitted child of xsl:stylesheet or xsl:transform
-
getVisibility
public Visibility getVisibility()
Get the visibility of the component. Returns the actual value of the visibility attribute, after validation, unless this is absent, in which case it returns the default value of PRIVATE. InvokesinvalidAttribute(String, String)if the value is invalid.- Returns:
- the declared visibility of the component, or
Visibility.PRIVATEif the visibility attribute is absent.
-
getDeclaredVisibility
public Visibility getDeclaredVisibility()
Get the visibility of the component. Returns the actual value of the visibility attribute, after validation, unless this is absent, in which case it returns null.- Returns:
- the declared visibility of the component, or null if the visibility attribute is absent.
-
markTailCalls
protected boolean markTailCalls()
Mark tail-recursive calls on templates and functions. For most instructions, this returns false.- Returns:
- true if one or more tail calls were identified
-
mayContainSequenceConstructor
protected boolean mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a sequence constructor- Returns:
- true if this instruction is allowed to contain a sequence constructor
-
mayContainFallback
protected boolean mayContainFallback()
Determine whether this type of element is allowed to contain an xsl:fallback instruction. Note that this is only relevant if the element is an instruction.- Returns:
- true if this element is allowed to contain an xsl:fallback
-
mayContainParam
protected boolean mayContainParam()
Determine whether this type of element is allowed to contain an xsl:param element- Returns:
- true if this element is allowed to contain an xsl:param
-
getContainingStylesheet
public XSLModuleRoot getContainingStylesheet()
Get the containing XSLStylesheet or XSLPackage element- Returns:
- the XSLStylesheet element representing the outermost element of the containing stylesheet module. Return null if there is no containing XSLStylesheet element
-
getDefaultValidation
public int getDefaultValidation()
Get the effective value of the default-validation attribute- Returns:
- the value of default-validation, as a constant from the
Validationclass, or Validation.STRIP if there is no containing element with a default-validation attribute.
-
makeQName
public final StructuredQName makeQName(String lexicalQName) throws XPathException
Make a structured QName, using this Element as the context for namespace resolution. If the name is unprefixed, the default namespace is not used.- Parameters:
lexicalQName- The lexical QName as written, in the form "[prefix:]localname". The name must have already been validated as a syntactically-correct QName. Leading and trailing whitespace will be trimmed. If XSLT 3.0 is enabled, then the EQName syntax "Q{uri}local" is also accepted.- Returns:
- the StructuredQName representation of this lexical QName
- Throws:
XPathException- if the qname is not a lexically-valid QName, or if the name is in a reserved namespace.
-
findAncestorElement
public StyleElement findAncestorElement(int fingerprint)
Get the first ancestor element in the stylesheet tree that has a given name, supplied by fingerprint.- Parameters:
fingerprint- the name of the required element- Returns:
- the first (innermost) ancestor with the required name, or null if none is found
-
getUsedPackage
public StylesheetPackage getUsedPackage()
Assuming this is an xsl:use-package element, find the package to which it refers.- Returns:
- the package referenced by this xsl:use-package element; or null if this is not an xsl:use-package element
-
getXslOriginal
public Actor getXslOriginal(int componentKind) throws XPathException
Check that a reference to xsl:original appears within an xsl:override element, and that the name of the containing component matches the name of a component in the used stylesheet package; return the component in that package with matching symbolic name- Parameters:
componentKind- the kind of component required, e.g. StandardNames.XSL_TEMPLATE- Returns:
- the component with matching name in the used stylesheet
- Throws:
XPathException- if the xsl:original reference appears in an invalid context
-
getOverriddenComponent
public Component getOverriddenComponent()
Get the component that this declaration overrides, or null if this is not an overriding declaration- Returns:
- the overridden component, or null
-
makeNamespaceContext
public SavedNamespaceContext makeNamespaceContext()
Make a NamespaceContext object representing the list of in-scope namespaces. This will be a copy of the namespace context with no references to objects in the stylesheet tree, so that it can be kept until run-time without locking the tree down in memory.- Returns:
- a copy of the namespace context
-
makeRetainedStaticContext
public RetainedStaticContext makeRetainedStaticContext()
-
changesRetainedStaticContext
public boolean changesRetainedStaticContext()
Ask whether this instruction requires a different retained static context from the containing (parent) instruction. That is, this instruction changes the static base URI, the default collation, or the set of in-scope namespaces.- Returns:
- true if the context for evaluating this instruction differs in relevant ways from that of the calling instruction
-
getNamespaceResolver
public NamespaceResolver getNamespaceResolver()
Get the namespace context of the instruction.- Returns:
- the namespace context. This method does not make a copy of the namespace context, so a reference to the returned NamespaceResolver will lock the stylesheet tree in memory.
-
processAllAttributes
public void processAllAttributes() throws XPathExceptionProcess the attributes of this element and all its children- Throws:
XPathException- in the event of a static error being detected
-
processStandardAttributes
public void processStandardAttributes(String namespace)
Process the standard attributes such as[xsl:]expand-text. InvokescompileError(String)or similar if the value of any of these attributes is invalid.The method processes:
extension-element-prefixesexclude-result-prefixesversiondefault-xpath-namespacedefault-validationexpand-text
but not:
default-collationdefault-mode
- Parameters:
namespace- either "" to find the attributes in the null namespace, or NamespaceConstant.XSLT to find them in the XSLT namespace
-
getAttributeValue
public String getAttributeValue(String clarkName)
Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).- Parameters:
clarkName- the name of the attribute in {uri}local format- Returns:
- the value of the attribute if it exists, or null otherwise
-
processAttributes
protected final void processAttributes()
Process the attribute list for the element. This is a wrapper method that calls prepareAttributes (provided in the subclass) and traps any exceptions
-
checkUnknownAttribute
protected void checkUnknownAttribute(NodeName nc)
Check whether an unknown attribute is permitted.- Parameters:
nc- The name code of the attribute name
-
prepareAttributes
protected abstract void prepareAttributes() throws XPathExceptionSet the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass- Throws:
XPathException- if a static error is detected
-
getLastChildInstruction
protected StyleElement getLastChildInstruction()
Find the last child instruction of this instruction. Returns null if there are no child instructions, or if the last child is a text node.- Returns:
- the last child instruction, or null if there are no child instructions
-
makeExpression
public Expression makeExpression(String expression, int attIndex)
Compile an XPath expression in the context of this stylesheet element- Parameters:
expression- the source text of the XPath expressionattIndex- the index position of the attribute containing the XPath expression, or -1 if the expression is in a text node- Returns:
- the compiled expression tree for the XPath expression. In the case of an error, returns an ErrorExpression that will fail at run-time if executed.
-
makePattern
public Pattern makePattern(String pattern, String attributeName)
Make a pattern in the context of this stylesheet element- Parameters:
pattern- the source text of the pattern- Returns:
- the compiled pattern
-
makeAttributeValueTemplate
protected Expression makeAttributeValueTemplate(String expression, int attIndex)
Make an attribute value template in the context of this stylesheet element- Parameters:
expression- the source text of the attribute value template- Returns:
- a compiled XPath expression that computes the value of the attribute (including concatenating the results of embedded expressions with any surrounding fixed text)
-
checkAttributeValue
protected void checkAttributeValue(String name, String value, boolean avt, String[] allowed)
Check the value of an attribute, as supplied statically- Parameters:
name- the name of the attributevalue- the value of the attributeavt- set to true if the value is permitted to be an attribute value templateallowed- list of permitted values, which must be in alphabetical order
-
processBooleanAttribute
public boolean processBooleanAttribute(String name, String value)
Process an attribute whose value is yes, no, true, false, 1, or 0; returning true or false.- Parameters:
name- the name of the attribute (used for diagnostics)value- the value of the attribute
-
isYes
static boolean isYes(String s)
-
isNo
static boolean isNo(String s)
-
processStreamableAtt
boolean processStreamableAtt(String streamableAtt)
-
makeSequenceType
public SequenceType makeSequenceType(String sequenceType) throws XPathException
Process an attribute whose value is a SequenceType- Parameters:
sequenceType- the source text of the attribute- Returns:
- the processed sequence type
- Throws:
XPathException- if the syntax is invalid or for example if it refers to a type that is not in the static context
-
makeExtendedSequenceType
public SequenceType makeExtendedSequenceType(String sequenceType) throws XPathException
- Throws:
XPathException
-
processExtensionElementAttribute
protected void processExtensionElementAttribute(String ns)
Process the [xsl:]extension-element-prefixes attribute if there is one- Parameters:
ns- the namespace URI of the attribute - either the XSLT namespace or "" for the null namespace
-
processExcludedNamespaces
protected void processExcludedNamespaces(String ns)
Process the [xsl:]exclude-result-prefixes attribute if there is one- Parameters:
ns- the namespace URI of the attribute required, either the XSLT namespace or ""
-
processVersionAttribute
protected void processVersionAttribute(String ns)
Process the [xsl:]version attribute if there is one- Parameters:
ns- the namespace URI of the attribute required, either the XSLT namespace or ""
-
getEffectiveVersion
public int getEffectiveVersion()
Get the numeric value of the version number appearing as an attribute on this element, or inherited from its ancestors- Returns:
- the version number times ten as an integer
-
getEffectiveVersionAsString
public String getEffectiveVersionAsString()
Get the effective version in a form suitable for display (for example "1.0" or "2.0")- Returns:
- the version number in conventional format
-
validateValidationAttribute
protected int validateValidationAttribute(String value)
Validate the value of the [xsl:]validation attribute- Parameters:
value- the raw value of the attribute- Returns:
- the encoded value of the attribute
-
forwardsCompatibleModeIsEnabled
public boolean forwardsCompatibleModeIsEnabled()
Determine whether forwards-compatible mode is enabled for this element- Returns:
- true if forwards-compatible mode is enabled
-
xPath10ModeIsEnabled
public boolean xPath10ModeIsEnabled()
Determine whether 1.0-compatible mode is enabled for this element- Returns:
- true if 1.0 compatable mode is enabled, that is, if this or an enclosing element specifies an [xsl:]version attribute whose value is less than 2.0
-
processDefaultCollationAttribute
protected void processDefaultCollationAttribute() throws XPathExceptionProcess the [xsl:]default-collation attribute if there is one.- Throws:
XPathException- if the value is not a valid URI, or not a recognized collation URI
-
getDefaultCollationName
protected String getDefaultCollationName()
Get the default collation for this stylesheet element. If no default collation is specified in the stylesheet, return the Unicode codepoint collation name.- Returns:
- the name of the default collation
-
findCollation
public StringCollator findCollation(String name, String baseURI) throws XPathException
Find a named collation. Note this method should only be used at compile-time, before declarations have been pre-processed. After that time, use getCollation().- Parameters:
name- identifies the name of the collation requiredbaseURI- the base URI to be used for resolving the collation name if it is relative- Returns:
- null if the collation is not found
- Throws:
XPathException- if either URI is invalid as a URI
-
processDefaultMode
protected void processDefaultMode() throws XPathExceptionProcess the [xsl:]default-mode attribute if there is one- Throws:
XPathException- if the value is not a valid EQName, or the token #unnamed
-
getDefaultMode
public StructuredQName getDefaultMode() throws XPathException
Get the default mode for this stylesheet element.- Returns:
- the name of the default mode, obtained by looking for the default-mode attribute on this element
and all all its ancestors. In the absence of a default-mode attribute, returns the magic value
Mode.UNNAMED_MODE_NAME - Throws:
XPathException
-
definesExtensionElement
protected boolean definesExtensionElement(String uri)
Check whether a particular extension element namespace is defined on this node. This checks this node only, not the ancestor nodes. The implementation checks whether the prefix is included in the [xsl:]extension-element-prefixes attribute.- Parameters:
uri- the namespace URI being tested- Returns:
- true if this namespace is defined on this element as an extension element namespace
-
isExtensionNamespace
public boolean isExtensionNamespace(String uri)
Check whether a namespace uri defines an extension element. This checks whether the namespace is defined as an extension namespace on this or any ancestor node.- Parameters:
uri- the namespace URI being tested- Returns:
- true if the URI is an extension element namespace URI
-
definesExcludedNamespace
protected boolean definesExcludedNamespace(String uri)
Check whether this node excludes a particular namespace from the result. This method checks this node only, not the ancestor nodes.- Parameters:
uri- the namespace URI being tested- Returns:
- true if the namespace is excluded by virtue of an [xsl:]exclude-result-prefixes attribute
-
isExcludedNamespace
public boolean isExcludedNamespace(String uri)
Check whether a namespace uri defines an namespace excluded from the result. This checks whether the namespace is defined as an excluded namespace on this or any ancestor node.- Parameters:
uri- the namespace URI being tested- Returns:
- true if this namespace URI is a namespace excluded by virtue of exclude-result-prefixes on this element or on an ancestor element
-
processDefaultXPathNamespaceAttribute
protected void processDefaultXPathNamespaceAttribute(String ns)
Process the [xsl:]xpath-default-namespace attribute if there is one- Parameters:
ns- the namespace URI of the attribute required (the default namespace or the XSLT namespace.)
-
getDefaultXPathNamespace
public String getDefaultXPathNamespace()
Get the default XPath namespace for elements and types- Returns:
- the default namespace for elements and types.
Return
NamespaceConstant.NULLfor the non-namespace
-
processExpandTextAttribute
protected void processExpandTextAttribute(String ns)
Process the [xsl:]expand-text attribute if there is one (and if XSLT 3.0 is enabled)- Parameters:
ns- the namespace URI of the attribute required (the default namespace or the XSLT namespace.)
-
processDefaultValidationAttribute
protected void processDefaultValidationAttribute(String ns)
Process the [xsl:]expand-text attribute if there is one- Parameters:
ns- the namespace URI of the attribute required (the default namespace or the XSLT namespace.)
-
isExpandingText
public boolean isExpandingText()
Ask whether content value templates are available within this element- Returns:
- true if content value templates are enabled
-
getSchemaType
public SchemaType getSchemaType(String typeAtt) throws XPathException
Get the Schema type definition for a type named in the stylesheet (in a "type" attribute).- Parameters:
typeAtt- the value of the type attribute- Returns:
- the corresponding schema type
- Throws:
XPathException- if the type is not declared in an imported schema, or is not a built-in type
-
getTypeAnnotation
public SimpleType getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type- Parameters:
schemaType- the schema type- Returns:
- the corresponding numeric type annotation
-
validate
public void validate(ComponentDeclaration decl) throws XPathException
Check that the stylesheet element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses.- Parameters:
decl- the declaration to be validated- Throws:
XPathException- if any error is found during validation
-
postValidate
public void postValidate() throws XPathExceptionHook to allow additional validation of a parent element immediately after its children have been validated.- Throws:
XPathException- if any error is found during post-traversal validation
-
index
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException
Method supplied by declaration elements to add themselves to a stylesheet-level index- 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- represents the outermost XSLStylesheet or XSLPackage element- Throws:
XPathException- if any error is encountered
-
typeCheck
public Expression typeCheck(String name, Expression exp) throws XPathException
Type-check an expression. This is called to check each expression while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.- Parameters:
name- the name of the attribute containing the expression to be checked (used for diagnostics)exp- the expression to be checked- Returns:
- the (possibly rewritten) expression after type checking
- Throws:
XPathException- if type-checking fails statically, that is, if it can be determined that the supplied value for the expression cannot possibly be of the required type
-
allocateLocalSlots
public void allocateLocalSlots(Expression exp)
Allocate slots in the local stack frame to range variables used in an XPath expression- Parameters:
exp- the XPath expression for which slots are to be allocated
-
typeCheck
public Pattern typeCheck(String name, Pattern pattern) throws XPathException
Type-check a pattern. This is called to check each pattern while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.- Parameters:
name- the name of the attribute holding the pattern, for example "match": used in diagnosticspattern- the compiled pattern- Returns:
- the original pattern, or a substitute pattern if it has been rewritten. Returns null if and only if the supplied pattern is null.
- Throws:
XPathException- if the pattern fails optimistic static type-checking
-
fixupReferences
public void fixupReferences() throws XPathExceptionFix up references from XPath expressions. Overridden for function declarations and variable declarations- Throws:
XPathException- if any references cannot be fixed up.
-
getContainingSlotManager
public SlotManager getContainingSlotManager()
Get the SlotManager for the containing Procedure definition- Returns:
- the SlotManager associated with the containing Function, Template, etc, or null if there is no such containing Function, Template etc.
-
validateSubtree
public void validateSubtree(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
Recursive walk through the stylesheet to validate all nodes- Parameters:
decl- the declaration to be validatedexcludeStylesheet- true if the XSLStylesheet element is to be excluded- Throws:
XPathException- if validation fails
-
validateChildren
protected void validateChildren(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
Validate the children of this node, recursively. Overridden for top-level data elements.- Parameters:
decl- the declaration whose children are to be validatedexcludeStylesheet- true if the xsl:stylesheet element is to be excluded- Throws:
XPathException- if validation fails
-
isPermittedChild
protected boolean isPermittedChild(StyleElement child)
Check whether a given child is permitted for this element. This method is used when a non-instruction child element such as xsl:sort is encountered in a context where instructions would normally be expected.- Parameters:
child- the child that may or may not be permitted- Returns:
- true if the child is permitted.
-
getPrincipalStylesheetModule
public PrincipalStylesheetModule getPrincipalStylesheetModule()
Get the principal stylesheet module of the package in which this XSLT element appears- Returns:
- the containing package
-
getContainingPackage
public StylesheetPackage getContainingPackage()
Get the containing package (the principal stylesheet module of the package in which this XSLT element appears)- Returns:
- the containing package. May be null if the method is called during initialization.
-
checkSortComesFirst
protected void checkSortComesFirst(boolean sortRequired)
Check that among the children of this element, any xsl:sort elements precede any other elements- Parameters:
sortRequired- true if there must be at least one xsl:sort element
-
checkTopLevel
public void checkTopLevel(String errorCode, boolean allowOverride)
Convenience method to check that the stylesheet element is at the top level (that is, as a child of xsl:stylesheet or xsl:transform)- Parameters:
errorCode- the error to throw if it is not at the top level; defaults to XTSE0010 if the value is nullallowOverride- true if the element is allowed to appear as a child of xsl:override
-
checkEmpty
public void checkEmpty()
Convenience method to check that the stylesheet element is empty
-
reportAbsence
public void reportAbsence(String attribute)
Convenience method to report the absence of a mandatory attribute- Parameters:
attribute- the name of the attribute whose absence is to be reported
-
compile
public Expression compile(Compilation compilation, ComponentDeclaration decl) throws XPathException
Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.- Parameters:
compilation- the compilation episodedecl- the containing top-level declaration, for example xsl:function or xsl:template- Returns:
- either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.
- Throws:
XPathException- if validation fails
-
isWithinDeclaredStreamableConstruct
protected boolean isWithinDeclaredStreamableConstruct()
-
generateId
protected String generateId()
-
compileDeclaration
public void compileDeclaration(Compilation compilation, ComponentDeclaration decl) throws XPathException
Compile a declaration in the stylesheet tree for use at run-time.- Parameters:
compilation- the compilation episodedecl- the containing top-level declaration, for example xsl:function or xsl:template- Throws:
XPathException- if compilation fails
-
compileSequenceConstructor
public Expression compileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, boolean includeParams) throws XPathException
Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.- Parameters:
compilation- the Executabledecl- the Declaration of the containing top-level stylesheet elementincludeParams- true if xsl:param elements are to be treated as child instructions (true for templates but not for functions)- Returns:
- the compiled sequence constructor
- Throws:
XPathException- if compilation fails
-
compileSequenceConstructor
public Expression compileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, SequenceIterator iter, boolean includeParams) throws XPathException
Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.- Parameters:
compilation- the Executabledecl- the Declaration of the containing top-level stylesheet elementiter- Iterator over the children. This is used in the case where there are children that are not part of the sequence constructor, for example the xsl:sort children of xsl:for-each; the iterator can be positioned past such elements.includeParams- true if xsl:param elements are to be treated as child instructions (true for templates but not for functions)- Returns:
- the compiled sequence constructor
- Throws:
XPathException- if compilation fails
-
compileContentValueTemplate
public void compileContentValueTemplate(TextImpl node, List<Expression> contents)
Compile a content value text node.- Parameters:
node- the text node potentially containing the templatecontents- a list to which expressions representing the fixed and variable parts of the content template will be appended
-
makeTraceInstruction
protected static Expression makeTraceInstruction(StyleElement source, Expression child)
Create a trace instruction to wrap a real instruction- Parameters:
source- the parent elementchild- the compiled expression tree for the instruction to be traced- Returns:
- a wrapper instruction that performs the tracing (if activated at run-time)
-
fallbackProcessing
protected Expression fallbackProcessing(Compilation exec, ComponentDeclaration decl, StyleElement instruction) throws XPathException
Perform fallback processing. Generate fallback code for an extension instruction that is not recognized by the implementation.- Parameters:
exec- the Executabledecl- the Declaration of the top-level element containing the extension instructioninstruction- The unknown extension instruction- Returns:
- the expression tree representing the fallback code
- Throws:
XPathException- if any error occurs
-
allocateLocation
protected Location allocateLocation()
Allocate a location- Returns:
- an location which can be used to report the location of the instruction
-
makeSortKeys
public SortKeyDefinitionList makeSortKeys(Compilation compilation, ComponentDeclaration decl) throws XPathException
Construct sort keys for a SortedIterator- Parameters:
compilation- the compilation episodedecl- the declaration containing the sort keys @throws XPathException if any error is detected- Returns:
- an array of SortKeyDefinition objects if there are any sort keys; or null if there are none.
- Throws:
XPathException- if an error is found
-
getUsedAttributeSets
protected StructuredQName[] getUsedAttributeSets(String use)
Get the list of attribute-set names associated with this element. This is used for xsl:element, xsl:copy, xsl:attribute-set, and on literal result elements- Parameters:
use- the original value of the [xsl:]use-attribute-sets attribute- Returns:
- an array of names of the attribute sets
-
interpretVisibilityValue
protected Visibility interpretVisibilityValue(String s, String flags)
Process the value of the visibility attribute (XSLT 3.0). InvokesinvalidAttribute(String, String)if the value is invalid.- Parameters:
s- the value of the attribute after whitespace collapsingflags- contains "h" if the value "hidden" is allowed, "a" if the value "absent" is allowed- Returns:
- the corresponding visibility
-
getWithParamInstructions
public WithParam[] getWithParamInstructions(Expression parent, Compilation compilation, ComponentDeclaration decl, boolean tunnel) throws XPathException
Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match). This method can be used to get either the tunnel parameters, or the non-tunnel parameters.- Parameters:
compilation- the compilation episodedecl- the containing stylesheet declarationtunnel- true if the tunnel="yes" parameters are wanted, false to get- Returns:
- an array of WithParam objects for either the ordinary parameters or the tunnel parameters, as an array containing the results of compiling the xsl:with-param children of this instruction (if any)
- Throws:
XPathException- if any error is detected
-
compileError
public void compileError(XPathException error)
Report an error with diagnostic information- Parameters:
error- contains information about the error
-
compileError
public void compileError(String message)
Report a static error in the stylesheet- Parameters:
message- the error message
-
compileError
public void compileError(String message, StructuredQName errorCode)
Compile time error, specifying an error code- Parameters:
message- the error messageerrorCode- the error code. May be null if not known or not defined
-
compileError
public void compileError(String message, String errorCode)
Compile time error, specifying an error code- Parameters:
message- the error messageerrorCode- the error code. May be null if not known or not defined
-
compileErrorInAttribute
public void compileErrorInAttribute(String message, String errorCode, String attributeName)
Compile time error, specifying an error code and the name of the attribute that is in error.- Parameters:
message- the error messageerrorCode- the error code. May be null if not known or not definedattributeName- the name of the attribute. For attributes in no namespace this is the local part of the name; for namespaced attributes a name in Clark format may be supplied.
-
undeclaredNamespaceError
protected void undeclaredNamespaceError(String prefix, String errorCode, String attributeName)
-
compileWarning
public void compileWarning(String message, StructuredQName errorCode)
-
issueWarning
protected void issueWarning(XPathException error)
Report a warning to the error listener- Parameters:
error- an exception containing the warning text
-
issueWarning
protected void issueWarning(String message, SourceLocator locator)
Report a warning to the error listener- Parameters:
message- the warning message textlocator- the location of the problem in the source stylesheet
-
isTopLevel
public boolean isTopLevel()
Test whether this is a top-level element- Returns:
- true if the element is a child of the xsl:stylesheet or xsl:package element
-
isConstructingComplexContent
public boolean isConstructingComplexContent()
Ask whether this is an instruction that is known to be constructing nodes which will become children of a parent document or element node, and will not have an independent existence of their own.- Returns:
- true if it is known that this is an instruction that creates nodes that will immediately be attached to a parent element or document node
-
getBindingInformation
public SourceBinding getBindingInformation(StructuredQName name)
Ask whether this element contains a binding for a variable with a given name; and if it does, return the source binding information- Parameters:
name- the variable name- Returns:
- the binding information if this element binds a variable of this name; otherwise null
-
bindVariable
public SourceBinding bindVariable(StructuredQName qName)
Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declared- Parameters:
qName- The name of the variable- Returns:
- the XSLVariableDeclaration (that is, an xsl:variable or xsl:param instruction) for the variable, or null if no declaration of the variable can be found
-
bindLocalVariable
public SourceBinding bindLocalVariable(StructuredQName qName)
Bind a variable reference used in this element to the compiled form of the XSLVariable element in which it is declared, considering only local variables and params- Parameters:
qName- The name of the variable- Returns:
- the XSLVariableDeclaration (that is, an xsl:variable or xsl:param instruction) for the variable, or null if no local declaration of the variable can be found
-
seesAvuncularVariables
protected boolean seesAvuncularVariables()
Ask whether variables declared in an "uncle" element are visible.- Returns:
- true for all elements except xsl:fallback and xsl:catch
-
hasImplicitBinding
protected SourceBinding hasImplicitBinding(StructuredQName name)
Ask whether this particular element implicitly binds a given variable (used for xsl:accumulator-rule)
-
getConstructType
public int getConstructType()
Get the type of construct. This will be a constant in classLocationKind. This method is part of theInstructionInfointerface
-
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 null.- Returns:
- the name of the object declared in this element, if any
-
setObjectName
public void setObjectName(StructuredQName qName)
Set the object name, for example the name of a function, variable, or template declared on this element- Parameters:
qName- the object name as a QName
-
getProperty
public Object getProperty(String name)
Get the value of a particular property of the instruction. This is part of theInstructionInfointerface for run-time tracing and debugging. The properties available include all the attributes of the source instruction (named by the attribute name): these are all provided as string values.- Parameters:
name- The name of the required property- Returns:
- The value of the requested property, or null if the property is not available
-
getProperties
public Iterator<String> getProperties()
Get an iterator over all the properties available. The values returned by the iterator will be of type String, and each string can be supplied as input to the getProperty() method to retrieve the value of the property.
-
isActionCompleted
public boolean isActionCompleted(int action)
Ask if an action on this StyleElement has been completed- Parameters:
action- for example ACTION_VALIDATE- Returns:
- true if the action has already been performed
-
setActionCompleted
public void setActionCompleted(int action)
Say that an action on this StyleElement has been completed- Parameters:
action- for example ACTION_VALIDATE
-
-