net.sf.saxon.instruct

Class While

public class While extends Instruction

Handler for saxon:while elements in stylesheet.
The saxon:while element has a mandatory attribute test, a boolean expression. The content is output repeatedly so long as the test condition is true.
Constructor Summary
While(Expression test, Expression action)
Method Summary
booleancreatesNewNodes()
Determine whether this instruction creates new nodes.
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure.
ExpressiongetActionExpression()
Get the action expression (the content of the for-each)
intgetInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
ItemTypegetItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction
IteratoriterateSubExpressions()
Get all the XPath expressions associated with this instruction (in XSLT terms, the expression present on attributes of the instruction, as distinct from the child instructions in a sequence construction)
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
TailCallprocessLeavingTail(XPathContext context)
protected voidpromoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.
Expressionsimplify(StaticContext env)
Simplify an expression.
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)

Constructor Detail

While

public While(Expression test, Expression action)

Method Detail

createsNewNodes

public final boolean createsNewNodes()
Determine whether this instruction creates new nodes. This implementation returns true if the "action" creates new nodes. (Nodes created by the condition can't contribute to the result).

display

public void display(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure. The expression is written to the System.err output stream

Parameters: level indentation level for this expression out

getActionExpression

public Expression getActionExpression()
Get the action expression (the content of the for-each)

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes

Returns: the string "saxon:while"

getItemType

public ItemType getItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction

Parameters: th

Returns: the static item type of the instruction

iterateSubExpressions

public Iterator iterateSubExpressions()
Get all the XPath expressions associated with this instruction (in XSLT terms, the expression present on attributes of the instruction, as distinct from the child instructions in a sequence construction)

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)

processLeavingTail

public TailCall processLeavingTail(XPathContext context)

promoteInst

protected void promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.

Parameters: offer The type of rewrite being offered

Throws: XPathException

simplify

public Expression simplify(StaticContext env)
Simplify an expression. This performs any static optimization (by rewriting the expression as a different expression).

Returns: the simplified expression

Throws: XPathException if an error is discovered during expression rewriting

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)