net.sf.saxon.instruct
Class Choose

java.lang.Object
  |
  +--net.sf.saxon.instruct.Instruction
        |
        +--net.sf.saxon.instruct.Choose
All Implemented Interfaces:
Instr, Locatable, java.io.Serializable, javax.xml.transform.SourceLocator

public class Choose
extends Instruction

Compiled representation of an xsl:choose or xsl:if element in the stylesheet.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.instruct.Instruction
children
 
Constructor Summary
Choose(Expression[] conditions, Instruction[] actions)
          Construct an xsl:choose instruction
 
Method Summary
 java.lang.String getInstructionName()
          Get the name of this instruction for diagnostic and tracing purposes We assume that if there was only one condition then it was an xsl:if; this is not necessarily so, but it's adequate for tracing purposes.
 TailCall processLeavingTail(XPathContext context)
          Process this instruction, that is, choose an xsl:when or xsl:otherwise child and process it.
 
Methods inherited from class net.sf.saxon.instruct.Instruction
assembleParams, assembleTunnelParams, displayChildren, dynamicError, dynamicError, getCardinality, getChildren, getColumnNumber, getExecutable, getInstructionNamespace, getItemType, getLineNumber, getPublicId, getSourceLocator, getSystemId, process, processChildren, processChildrenLeavingTail, recoverableError, setChildren, setExecutable, setSourceLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Choose

public Choose(Expression[] conditions,
              Instruction[] actions)
Construct an xsl:choose instruction

Parameters:
conditions - the conditions to be tested, in order
actions - the actions to be taken when the corresponding condition is true
Method Detail

getInstructionName

public java.lang.String getInstructionName()
Get the name of this instruction for diagnostic and tracing purposes We assume that if there was only one condition then it was an xsl:if; this is not necessarily so, but it's adequate for tracing purposes.

Specified by:
getInstructionName in class Instruction

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
                            throws javax.xml.transform.TransformerException
Process this instruction, that is, choose an xsl:when or xsl:otherwise child and process it.

Specified by:
processLeavingTail in interface Instr
Specified by:
processLeavingTail in class Instruction
Parameters:
context - the dynamic context of this transformation
Returns:
a TailCall, if the chosen branch ends with a call of call-template or apply-templates. It is the caller's responsibility to execute such a TailCall. If there is no TailCall, returns null.
Throws:
javax.xml.transform.TransformerException - if any non-recoverable dynamic error occurs