Implements an imaginary xsl:block instruction which simply evaluates
its contents. Used for top-level templates, xsl:otherwise, etc.
checkPermittedContents
public void checkPermittedContents(SchemaType parentType,
StaticContext env,
boolean whole)
throws XPathException
Check that any elements and attributes constructed or returned by this expression are acceptable
in the content model of a given complex type. It's always OK to say yes, since the check will be
repeated at run-time. The process of checking element and attribute constructors against the content
model of a complex type also registers the type of content expected of those constructors, so the
static validation can continue recursively.
- checkPermittedContents in interface Expression
copy
public Expression copy()
Copy an expression. This makes a deep copy.
- copy in interface Expression
- the copy of the original expression
createsNewNodes
public final boolean createsNewNodes()
Determine whether this instruction creates new nodes.
This implementation returns true if any child instruction
returns true.
- createsNewNodes in interface Instruction
explain
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree
is written to the supplied output destination.
- explain in interface Expression
getCardinality
public final int getCardinality()
Determine the cardinality of the expression
- getCardinality in interface Expression
getChildren
public Expression[] getChildren()
Get the children of this instruction
- the children of this instruction, as an array of Instruction objects. May return either
a zero-length array or null if there are no children
getImplementationMethod
public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
This method indicates which of these methods is provided. This implementation provides both iterate() and
process() methods natively.
- getImplementationMethod in interface Instruction
makeBlock
public static Expression makeBlock(List list)
Static factory method to create a block from a list of expressions
list
- the list of expressions making up this block. The members of the List must
be instances of Expression
- a Block containing the two subexpressions, and if either of them is a block, it will
have been collapsed to create a flattened sequence
makeBlock
public static Expression makeBlock(Expression e1,
Expression e2)
Static factory method to create a block. If one of the arguments is already a block,
the contents will be merged into a new composite block
e1
- the first subexpression (child) of the blocke2
- the second subexpression (child) of the block
- a Block containing the two subexpressions, and if either of them is a block, it will
have been collapsed to create a flattened sequence
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
setChildren
public void setChildren(Expression[] children)
Set the children of this instruction
children
- The instructions that are children of this instruction
simplify
public Expression simplify(ExpressionVisitor visitor)
throws XPathException
Simplify an expression. This performs any static optimization (by rewriting the expression
as a different expression). The default implementation does nothing.
- simplify in interface Instruction
visitor
- an expression visitor
- the simplified expression
XPathException
- if an error is discovered during expression
rewriting