Package org.exolab.adaptx.xslt
Class TemplateRule
java.lang.Object
org.exolab.adaptx.xslt.XSLObject
org.exolab.adaptx.xslt.TemplateRule
A class that Represents an XSLT Template Rule.
Section 5 of the W3C XSLT 1.0 Recommendation (19991116).
- Version:
- $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
- Author:
- Keith Visco
-
Field Summary
Fields inherited from class org.exolab.adaptx.xslt.XSLObject
APPLY_IMPORTS, APPLY_TEMPLATES, ARG, ATTRIBUTE, ATTRIBUTE_SET, CALL_TEMPLATE, CDATA, CHOOSE, COMMENT, CONTENTS, COPY, COPY_OF, ELEMENT, ENTITY_REF, FOR_EACH, FUNCTIONS, ID, IF, IMPORT, INCLUDE, KEY, LITERAL, LOCALE, MESSAGE, NUMBER, OTHERWISE, OUTPUT, PARAM, PI, PRESERVE_SPACE, SCRIPT, SORT, STRIP_SPACE, STYLESHEET, TEMPLATE, TEXT, VALUE_OF, VARIABLE, WHEN, WITH_PARAM
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TemplateRule.
By default the new rule will not match any elements. -
Method Summary
Modifier and TypeMethodDescriptionfloat
calculatePriority
(XPathNode node, XPathContext context) Calculates the priority for this Template Rule.copy()
Creates a copy of this TemplateRulegetMatchingPattern
(XPathNode node, XPathContext context) Returns the Pattern contained within this template rule that matched the given node using the given context.getMode()
Returns the mode attribute of this Template RulegetName()
Returns the name for this Template Rule, or null if no name exists.Returns the match Pattern for this templateboolean
matches
(XPathNode node, ProcessorState ps) Determines if the given node is matched by this MatchExpr with respect to the given context node.void
setAttribute
(String name, String value) Sets the attribute with the given name to the given value.void
setMatchAttr
(String matchPattern) Sets the MatchExpr for this TemplateRulevoid
setModeAttr
(String mode) void
Sets the name for this Templatevoid
setPriority
(float priority) Sets the priority for this TemplateRuleMethods inherited from class org.exolab.adaptx.xslt.XSLObject
addNamespaceDecl, appendAction, appendText, appendText, getActions, getAttribute, getAttributes, getNamespace, getNearestAncestor, getNodeValue, getStylesheet, getText, getType, getTypeFromName, getTypeName, resolveNamespace, setAllowActions, setNamespace, setTypeName
-
Constructor Details
-
TemplateRule
public TemplateRule()Creates a new TemplateRule.
By default the new rule will not match any elements.
-
-
Method Details
-
calculatePriority
Calculates the priority for this Template Rule. The priority is calculated using the rules from Section 5.5 of the XSLT 1.0 Recommendation.- Returns:
- the priority for this Template Rule
-
copy
Creates a copy of this TemplateRule- Returns:
- the new copy of this TemplateRule
-
getMatchingPattern
public LocationPathPattern getMatchingPattern(XPathNode node, XPathContext context) throws XPathException Returns the Pattern contained within this template rule that matched the given node using the given context.- Parameters:
node
- the XPathNode to match againstcontext
- the XPathContext to match against- Returns:
- the matching pattern, or null if no patterns matched the given node.
- Throws:
XPathException
-
getMode
Returns the mode attribute of this Template Rule- Returns:
- the value of the mode attribute.
-
getName
Returns the name for this Template Rule, or null if no name exists. -
getPattern
Returns the match Pattern for this template- Returns:
- the match Pattern for this template
-
matches
Determines if the given node is matched by this MatchExpr with respect to the given context node. Note: If there are errors in the XPath expression of this template, the errors are reported on first use of the template. The template will then be disabled and no longer used for XSLT processing.- Parameters:
node
- the node to determine a match forcontext
- the Node which represents the current contextps
- the current ProcessorState- Returns:
- true if the given node is matched by this MatchExpr
- Throws:
XSLException
-
setAttribute
Sets the attribute with the given name to the given value.- Overrides:
setAttribute
in classXSLObject
- Parameters:
name
- the name of the attribute to setvalue
- the value to set the attribute to- Throws:
XSLException
- if this XSLObject does not allow attributes with the given name, or if the attribute is read only
-
setMatchAttr
Sets the MatchExpr for this TemplateRule- Parameters:
matchPattern
- the desired Match Pattern to use for this template
-
setModeAttr
-
setName
Sets the name for this Template- Parameters:
name
- the name to use for this template
-
setPriority
public void setPriority(float priority) Sets the priority for this TemplateRule- Parameters:
priority
- the desired priority of this rule. 0 by default
-