com.icl.saxon
Class Mode

java.lang.Object
  |
  +--com.icl.saxon.Mode

public class Mode
extends java.lang.Object

A Mode is a collection of rules; the selection of a rule to apply to a given element is determined by a Pattern.


Constructor Summary
Mode()
           
 
Method Summary
 void addRule(Pattern p, java.lang.Object obj, int precedence, double priority)
          Add a rule to the Mode.
 int getList(Name name, int type)
          Determine which list to use for a given pattern (we must also search the generic list)
 java.lang.String getName()
          Get the name of the mode.
 java.lang.Object getRule(NodeInfo node, Context context)
          Get the rule corresponding to a given Node, by finding the best Pattern match.
 java.lang.Object getRule(NodeInfo node, int min, int max, Context context)
          Get the rule corresponding to a given Node, by finding the best Pattern match, subject to a minimum and maximum precedence.
 void setName(java.lang.String modeName)
          Set the name of the mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mode

public Mode()
Method Detail

setName

public void setName(java.lang.String modeName)
Set the name of the mode. Used only for diagnostic trace output

getName

public java.lang.String getName()
Get the name of the mode. Used only for diagnostic trace output.
Returns:
the mode name, or null for the default mode. The name is returned as an absolute name.

addRule

public void addRule(Pattern p,
                    java.lang.Object obj,
                    int precedence,
                    double priority)
Add a rule to the Mode.
The rule effectively replaces any other rule for the same pattern/mode at the same or a lower priority.
Parameters:
p - a Pattern
obj - the Object to return from getRule() when the supplied element matches this Pattern

getList

public int getList(Name name,
                   int type)
Determine which list to use for a given pattern (we must also search the generic list)

getRule

public java.lang.Object getRule(NodeInfo node,
                                Context context)
                         throws org.xml.sax.SAXException
Get the rule corresponding to a given Node, by finding the best Pattern match.
Parameters:
node - the NodeInfo referring to the node to be matched
Returns:
the object (e.g. a NodeHandler) registered for that element, if any (otherwise null).

getRule

public java.lang.Object getRule(NodeInfo node,
                                int min,
                                int max,
                                Context context)
                         throws org.xml.sax.SAXException
Get the rule corresponding to a given Node, by finding the best Pattern match, subject to a minimum and maximum precedence. (This supports xsl:apply-imports)
Parameters:
node - the NodeInfo referring to the node to be matched
Returns:
the object (e.g. a NodeHandler) registered for that element, if any (otherwise null).