Class UseAttributeSet
- All Implemented Interfaces:
ComponentInvocation,ContextOriginator,ExportAgent,Locatable,IdentityComparable,Traceable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD -
Constructor Summary
ConstructorsConstructorDescriptionUseAttributeSet(StructuredQName name, boolean streamable) Create a use-attribute-set expression -
Method Summary
Modifier and TypeMethodDescriptionprotected intCompute a hashcodecopy(RebindingMap rebindings) Copy an expression.booleanTest whether this UseAttributeSets expression is equal to anothervoidExport of expression structure.intGet the binding slot to be used.Make an elaborator for this expressionGet a name identifying the kind of expression, in terms meaningful to a user.Get the target component if this is known in advance, that is, if the target component is private or final, or in some other cases such as xsl:original.intDetermine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.Get the item type of the items returned by evaluating this instructionGet the (partial) name of a class that supports streaming of this kind of expressionGet the symbolic name of the component that this invocation referencesGet the target attribute set to which this instruction is provisionally boundGet the target attribute sets of this instruction.booleanbooleanAsk whether this expression is an instruction.static ExpressionmakeCompositeExpression(List<UseAttributeSet> targets) Given a list of UseAttributeSet expressions, combine them into a single expressionstatic List<UseAttributeSet> makeUseAttributeSetInstructions(StructuredQName[] targets, StyleElement instruction) Make a list of expressions whose combined effect is to expand the attribute sets named in an [xsl]use-attribute-sets attribute, for example on a literal result elementstatic ExpressionmakeUseAttributeSets(StructuredQName[] targets, StyleElement instruction) Make an expression whose effect is to expand the attribute sets named in an [xsl]use-attribute-sets attribute, for example on a literal result elementoperands()Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) Perform optimisation of an expression and its subexpressions.voidsetBindingSlot(int slot) Set the binding slot to be used.voidsetTarget(AttributeSet target) Set the attribute set to be used.typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Perform type checking of an expression and its subexpressions.Methods inherited from class net.sf.saxon.expr.instruct.Instruction
alwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getImplementationMethod, getInstructionNameCode, getNetCost, getSourceLocator, isXSLT, iterate, mayCreateNewNodes, process, someOperandCreatesNewNodesMethods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocationMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Constructor Details
-
UseAttributeSet
Create a use-attribute-set expression- Parameters:
name- the name of the target attribute setstreamable- true if the attribute set is streamable
-
-
Method Details
-
isInstruction
public boolean isInstruction()Description copied from class:ExpressionAsk whether this expression is an instruction. In XSLT streamability analysis this is used to distinguish constructs corresponding to XSLT instructions from other constructs, typically XPath expressions (but also things like attribute constructors on a literal result element, references to attribute sets, etc. However, an XPath expression within a text value template in a text node of an XSLT stylesheet is treated as an instruction. In a non-XSLT environment (such as XQuery) this property has no meaning and its setting is undefined.- Overrides:
isInstructionin classInstruction- Returns:
- true if this construct originates as an XSLT instruction
-
makeUseAttributeSets
public static Expression makeUseAttributeSets(StructuredQName[] targets, StyleElement instruction) throws XPathException Make an expression whose effect is to expand the attribute sets named in an [xsl]use-attribute-sets attribute, for example on a literal result element- Parameters:
targets- the QNames contained in the use-attribute-sets attributeinstruction- the instruction on which the use-attribute-sets attribute appears- Returns:
- the required expression
- Throws:
XPathException- if an error occurs, for example no attribute set found with the required name
-
makeUseAttributeSetInstructions
public static List<UseAttributeSet> makeUseAttributeSetInstructions(StructuredQName[] targets, StyleElement instruction) throws XPathException Make a list of expressions whose combined effect is to expand the attribute sets named in an [xsl]use-attribute-sets attribute, for example on a literal result element- Parameters:
targets- the QNames contained in the use-attribute-sets attributeinstruction- the instruction on which the use-attribute-sets attribute appears- Returns:
- the required expression
- Throws:
XPathException- if an error occurs, for example no attribute set found with the required name
-
makeCompositeExpression
Given a list of UseAttributeSet expressions, combine them into a single expression- Parameters:
targets- the list of expressions- Returns:
- the combined expression
-
isDeclaredStreamable
public boolean isDeclaredStreamable() -
setTarget
Set the attribute set to be used.- Parameters:
target- the attribute set to be used
-
setBindingSlot
public void setBindingSlot(int slot) Set the binding slot to be used. This is the offset within the binding vector of the containing component where the actual target component is to be found. The target template is not held directly in the invocation instruction/expression itself because it can be overridden in a using package.- Specified by:
setBindingSlotin interfaceComponentInvocation- Parameters:
slot- the offset in the binding vector of the containing package where the target component can be found.
-
getBindingSlot
public int getBindingSlot()Get the binding slot to be used. This is the offset within the binding vector of the containing component where the actual target component is to be found.- Specified by:
getBindingSlotin interfaceComponentInvocation- Returns:
- the offset in the binding vector of the containing package where the target component can be found.
-
getSymbolicName
Get the symbolic name of the component that this invocation references- Specified by:
getSymbolicNamein interfaceComponentInvocation- Returns:
- the symbolic name of the target component
-
getTargetAttributeSet
Get the target attribute set to which this instruction is provisionally bound- Returns:
- the provisional attribute set (which might be overridden in another package)
-
getFixedTarget
Description copied from interface:ComponentInvocationGet the target component if this is known in advance, that is, if the target component is private or final, or in some other cases such as xsl:original. Otherwise, return null.- Specified by:
getFixedTargetin interfaceComponentInvocation- Returns:
- the bound component if the binding has been fixed
-
operands
Description copied from class:ExpressionGet the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
- Specified by:
operandsin classInstruction- Returns:
- an iterator containing the sub-expressions of this expression
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException Perform optimisation of an expression and its subexpressions.This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
- Overrides:
optimizein classExpression- Parameters:
visitor- an expression visitorcontextItemType- the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set toType.ITEM_TYPE- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
copy
Copy an expression. This makes a deep copy.- Specified by:
copyin classExpression- Parameters:
rebindings- a mutable list of (old binding, new binding) pairs that is used to update the bindings held in any local variable references that are copied.- Returns:
- the copy of the original expression
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Perform type checking of an expression and its subexpressions.This checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.
- Overrides:
typeCheckin classExpression- Parameters:
visitor- an expression visitorcontextInfo- information about the static type of the context item- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
getItemType
Get the item type of the items returned by evaluating this instruction- Overrides:
getItemTypein classInstruction- Returns:
- the static item type of the instruction
-
getIntrinsicDependencies
public int getIntrinsicDependencies()Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".- Overrides:
getIntrinsicDependenciesin classExpression- Returns:
- a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
-
getTargetAttributeSetName
Get the target attribute sets of this instruction. Called from generated bytecode.- Returns:
- the target attribute sets, as an array
-
getExpressionName
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classInstruction- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
export
Export of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Specified by:
exportin classExpression- Parameters:
out- the expression presenter used to display the structure- Throws:
XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
-
equals
Test whether this UseAttributeSets expression is equal to another- Overrides:
equalsin classExpression- Parameters:
obj- the other expression- Returns:
- true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
-
computeHashCode
protected int computeHashCode()Compute a hashcode- Overrides:
computeHashCodein classExpression- Returns:
- a computed hash code
-
getStreamerName
Get the (partial) name of a class that supports streaming of this kind of expression- Overrides:
getStreamerNamein classExpression- Returns:
- the partial name of a class that can be instantiated to provide streaming support in Saxon-EE, or null if there is no such class
-
getElaborator
Description copied from class:ExpressionMake an elaborator for this expression- Overrides:
getElaboratorin classExpression- Returns:
- an appropriate
Elaborator
-