net.sf.saxon.instruct
Class SimpleNodeConstructor
- SourceLocator, EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator, TailCallReturner
public abstract class SimpleNodeConstructor
Common superclass for XSLT instructions whose content template produces a text
value: xsl:attribute, xsl:comment, xsl:processing-instruction, xsl:namespace,
and xsl:text, and their XQuery equivalents
assembleParams , assembleTunnelParams , computeCardinality , computeSpecialProperties , createsNewNodes , dynamicError , evaluateAsString , evaluateItem , getImplementationMethod , getInstructionInfo , getInstructionNameCode , getItemType , getSourceLocator , isXSLT , iterate , process , processLeavingTail , promote , promoteInst , simplify |
addToPathMap , adoptChildExpression , checkPermittedContents , computeCardinality , computeDependencies , computeSpecialProperties , computeStaticProperties , copy , display , doPromotion , dynamicError , effectiveBooleanValue , evaluateAsString , evaluateItem , explain , explain , findParentOf , getCardinality , getColumnNumber , getConstructType , getContainer , getDependencies , getExecutable , getHostLanguage , getImplementationMethod , getInstructionInfo , getIntrinsicDependencies , getItemType , getLineNumber , getLocationId , getLocationProvider , getPublicId , getSlotsUsed , getSpecialProperties , getSystemId , hasLoopingSubexpression , implementsStaticTypeCheck , iterate , iterateEvents , iterateSubExpressions , markTailFunctionCalls , optimize , process , promote , replaceSubExpression , resetLocalStaticProperties , setContainer , setFiltered , setFlattened , setLocationId , simplify , staticTypeCheck , suppressValidation , toString , typeCheck , typeError |
SimpleNodeConstructor
public SimpleNodeConstructor()
Default constructor used by subclasses
checkContent
protected String checkContent(String data,
XPathContext context)
throws XPathException
Check the content of the node, and adjust it if necessary. The checks depend on the node kind.
data
- the supplied contentcontext
- the dynamic context
- the original content, unless adjustments are needed
computeCardinality
public int computeCardinality()
Get the cardinality of the sequence returned by evaluating this instruction
- computeCardinality in interface Instruction
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.
- computeSpecialProperties in interface Instruction
- a set of flags indicating static properties of this expression
createsNewNodes
public final boolean createsNewNodes()
Determine whether this instruction creates new nodes.
This implementation returns true.
- createsNewNodes in interface Instruction
evaluateNameCode
public int evaluateNameCode(XPathContext context)
throws XPathException
Run-time method to compute the name of the node being constructed. This is overridden
for nodes that have a name. The default implementation returns -1, which is suitable for
unnamed nodes such as comments
context
- the XPath dynamic evaluation context
- the name pool nameCode identifying the name of the constructed node
expandChildren
public CharSequence expandChildren(XPathContext context)
throws XPathException
Expand the stylesheet elements subordinate to this one, returning the result
as a string. The expansion must not generate any element or attribute nodes.
context
- The dynamic context for the transformation
- the value that will be used as the string value of the constructed node
getSelect
public Expression getSelect()
Get the expression that determines the string value of the constructed node
localTypeCheck
public abstract void localTypeCheck(ExpressionVisitor visitor,
ItemType contextItemType)
throws XPathException
Method to perform type-checking specific to the kind of instruction
visitor
- an expression visitorcontextItemType
- the static type of the context item
promoteInst
protected void promoteInst(PromotionOffer offer)
throws XPathException
Offer promotion for subexpressions. The offer will be accepted if the subexpression
is not dependent on the factors (e.g. the context item) identified in the PromotionOffer.
By default the offer is not accepted - this is appropriate in the case of simple expressions
such as constant values and variable references where promotion would give no performance
advantage. This method is always called at compile time.
- promoteInst in interface Instruction
offer
- details of the offer, for example the offer to move
expressions that don't depend on the context to an outer level in
the containing expression
replaceSubExpression
public boolean replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
- replaceSubExpression in interface Expression
original
- the original subexpressionreplacement
- the replacement subexpression
- true if the original subexpression is found
setSelect
public void setSelect(Expression select,
Configuration config)
throws XPathException
Set the select expression: the value of this expression determines the string-value of the node
select
- the expression that computes the string value of the nodeconfig
- the Saxon configuration (used for example to do early validation of the content
of an attribute against the schema-defined type)
typeCheck
public Expression typeCheck(ExpressionVisitor visitor,
ItemType contextItemType)
throws XPathException
The typeCheck() method is called in XQuery, where node constructors
are implemented as Expressions. In this case the required type for the
select expression is a single string.
- typeCheck in interface Expression
visitor
- an expression visitor
XPathException
- if any static errors are found in this expression
or any of its children