Package net.sf.saxon.expr.instruct
Class AttributeCreator
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.instruct.Instruction
-
- net.sf.saxon.expr.instruct.SimpleNodeConstructor
-
- net.sf.saxon.expr.instruct.AttributeCreator
-
- All Implemented Interfaces:
ExportAgent
,TailCallReturner
,ValidatingInstruction
,Locatable
,IdentityComparable
,Traceable
- Direct Known Subclasses:
ComputedAttribute
,FixedAttribute
public abstract class AttributeCreator extends SimpleNodeConstructor implements ValidatingInstruction
Abstract class for fixed and computed attribute constructor expressions
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.SimpleNodeConstructor
selectOp
-
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
Constructors Constructor Description AttributeCreator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeSpecialProperties()
Get the static properties of this expression (other than its type).ItemType
getItemType()
Get the static type of this expressionint
getOptions()
Get the options to be used on the attribute eventSimpleType
getSchemaType()
Return the required schema type of the attributeint
getValidationAction()
Get the validation action requestedboolean
isInstruction()
Ask whether this expression is an instruction.void
processValue(java.lang.CharSequence value, Outputter output, XPathContext context)
Process the value of the node, to create the new node.void
setInstruction(boolean inst)
Say whether this attribute creator originates as an XSLT instructionvoid
setNoSpecialChars()
Indicate that the attribute value contains no special characters that might need escapingvoid
setOptions(int options)
Set the options to be used on the attribute eventvoid
setRejectDuplicates()
Indicate that two attributes with the same name are not acceptable.void
setSchemaType(SimpleType type)
Set the required schema type of the attributevoid
setValidationAction(int action)
Set the validation action requiredprotected void
validateOrphanAttribute(Orphan orphan, XPathContext context)
Validate a newly-constructed parentless attribute using the type and validation attributes.-
Methods inherited from class net.sf.saxon.expr.instruct.SimpleNodeConstructor
allowExtractingCommonSubexpressions, alwaysCreatesNewNodes, checkContent, computeCardinality, evaluateItem, evaluateNodeName, getSelect, getStreamerName, isLocal, iterate, localTypeCheck, mayCreateNewNodes, operands, optimize, processLeavingTail, setSelect, typeCheck
-
Methods inherited from class net.sf.saxon.expr.instruct.Instruction
assembleParams, assembleTunnelParams, dynamicError, evaluateAsString, getExpressionName, getImplementationMethod, getInstructionNameCode, getNetCost, getSourceLocator, isXSLT, process, someOperandCreatesNewNodes
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, copy, dynamicError, effectiveBooleanValue, equals, evaluatePendingUpdates, explain, export, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, 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, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Method Detail
-
setInstruction
public void setInstruction(boolean inst)
Say whether this attribute creator originates as an XSLT instruction- Parameters:
inst
- true if this is an xsl:attribute instruction
-
isInstruction
public boolean isInstruction()
Ask whether this expression is an instruction. In XSLT streamability analysis this is used to distinguish constructs corresponding to XSLT instructions from other constructs.- Overrides:
isInstruction
in classInstruction
- Returns:
- true if this construct originates as an XSLT instruction
-
setSchemaType
public void setSchemaType(SimpleType type)
Set the required schema type of the attribute- Parameters:
type
- the required schema type, if validation against a specific type is required, or null if no validation is required
-
getSchemaType
public SimpleType getSchemaType()
Return the required schema type of the attribute- Specified by:
getSchemaType
in interfaceValidatingInstruction
- Returns:
- if validation against a schema type was requested, return the schema type (always a simple type). Otherwise, if validation against a specific type was not requested, return null
-
setValidationAction
public void setValidationAction(int action)
Set the validation action required- Parameters:
action
- the validation action required, for example strict or lax
-
getValidationAction
public int getValidationAction()
Get the validation action requested- Specified by:
getValidationAction
in interfaceValidatingInstruction
- Returns:
- the validation action, for example strict or lax
-
setOptions
public void setOptions(int options)
Set the options to be used on the attribute event- Parameters:
options
- Options to be used. The only option currently defined isReceiverOption.REJECT_DUPLICATES
, which controls whether or not it is an error to create two attributes with the same name for the same element. (This is an error in XQuery but not in XSLT).
-
setRejectDuplicates
public void setRejectDuplicates()
Indicate that two attributes with the same name are not acceptable. (This option is set in XQuery, but not in XSLT)
-
setNoSpecialChars
public void setNoSpecialChars()
Indicate that the attribute value contains no special characters that might need escaping
-
getOptions
public int getOptions()
Get the options to be used on the attribute event- Returns:
- the option flags to be used
-
computeSpecialProperties
public int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.- Overrides:
computeSpecialProperties
in classSimpleNodeConstructor
- Returns:
- a set of flags indicating static properties of this expression
-
getItemType
public ItemType getItemType()
Get the static type of this expression- Overrides:
getItemType
in classInstruction
- Returns:
- the static type of the item returned by this expression
-
processValue
public void processValue(java.lang.CharSequence value, Outputter output, XPathContext context) throws XPathException
Process the value of the node, to create the new node.- Specified by:
processValue
in classSimpleNodeConstructor
- Parameters:
value
- the string value of the new nodeoutput
- the destination for the resultcontext
- the dynamic evaluation context- Throws:
XPathException
- if a dynamic error occurs
-
validateOrphanAttribute
protected void validateOrphanAttribute(Orphan orphan, XPathContext context) throws XPathException
Validate a newly-constructed parentless attribute using the type and validation attributes. Note, this is XSLT-only: XQuery does not allow validation of individual attributes- Parameters:
orphan
- the new attribute nodecontext
- the dynamic evaluation context- Throws:
XPathException
- if validation fails
-
-