com.icl.saxon
Class 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.
void | addRule(Pattern p, Object obj, int precedence, double priority) - Add a rule to the Mode.
|
int | getList(int fingerprint, int type) - Determine which list to use for a given pattern (we must also search the generic list)
|
int | getNameCode() - Get the name of this mode (for tracing output)
|
Object | getRule(NodeInfo node, Context context) - Get the rule corresponding to a given Node, by finding the best Pattern match.
|
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 | setNameCode(int nameCode) - Set the name of this mode (for tracing output)
|
addRule
public void addRule(Pattern p,
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.
p
- a Patternobj
- the Object to return from getRule() when the supplied element matches this Pattern
getList
public int getList(int fingerprint,
int type)
Determine which list to use for a given pattern (we must also search the generic list)
getNameCode
public int getNameCode()
Get the name of this mode (for tracing output)
getRule
public Object getRule(NodeInfo node,
Context context)
throws TransformerException
Get the rule corresponding to a given Node, by finding the best Pattern match.
node
- the NodeInfo referring to the node to be matched
- the object (e.g. a NodeHandler) registered for that element, if any (otherwise null).
getRule
public Object getRule(NodeInfo node,
int min,
int max,
Context context)
throws XPathException
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)
node
- the NodeInfo referring to the node to be matched
- the object (e.g. a NodeHandler) registered for that element, if any (otherwise null).
setNameCode
public void setNameCode(int nameCode)
Set the name of this mode (for tracing output)