Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.xsl.process
Class TemplateRule

    java.lang.Object
      com.novell.xsl.process.Rule
          com.novell.xsl.process.TemplateRule

All Implemented Interfaces:
  Comparable

Direct Known Subclasses:
  BuiltInTemplateRule

    public class TemplateRule

extends Rule

Represents a template rule corresponding to an `xsl:template` element.

Nested Class Summary
`protected static class` | `TemplateRule.RecursionCounter` Class to keep track of recursion for multiple instances of TemplateRule that share everything but their patterns (i.e., were created with cloneForUnion()

Field Summary
`protected TemplateRule.RecursionCounter` | `recursionLevel` Keeps track of how many times this rule and clones have been instantiated in a recursive fashion.

Constructor Summary
`` | `TemplateRule(Pattern pattern, ExpandedQName name, Template[] templates, Collection variables, Mode mode, int importance, Priority priority, int number, Node nsContext)` Constructs a new template rule.
`protected` | `TemplateRule(TemplateRule original, Pattern pattern)` Constructs a new template rule that is (almost) a shallow copy of the specified rule, with the intent of using the new rule as one of the multiple instances representing a union of path expressions.

Method Summary
`Rule` | `cloneForUnion(Pattern pattern)` Creates a new template rule that is (almost) a shallow copy of this rule and whose actual class is the same as this rule's actual class, with the intent of using the new rule as one of the multiple instances representing a union of path expressions.
`void` | `dump(PrintWriter out, int indent)` Dumps this object to the specified output stream.
`Template[]` | `getTemplates()` Returns the templates that are instantiated when this rule's pattern is successfully matched.
`void` | `instantiate(ProcessingEnv env, Node currentNode, Mode currentMode, ResultHandler result)` Instantiates this rule's template for the specified current node and sends the result to the specified result handler.
`protected void` | `popVariables(ExpressionValue[] state)` Restore any variable values that were saved by `pushVariables()`
`protected ExpressionValue[]` | `pushVariables()` Save any variable values that are currently in effect in preparation for a recursive instantiation.

Methods inherited from class com.novell.xsl.process.Rule
`compareTo, getImportance, getMode, getName, getNamespaceContext, getNumber, getPattern, getPriority, indent, matches`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### recursionLevel

    protected TemplateRule.RecursionCounter recursionLevel

  Keeps track of how many times this rule and clones have been instantiated in a recursive fashion.

Constructor Detail

### TemplateRule

    public TemplateRule(Pattern pattern,
                        ExpandedQName name,
                        Template[] templates,
                        Collection variables,
                        Mode mode,
                        int importance,
                        Priority priority,
                        int number,
                        Node nsContext)

  Constructs a new template rule.

  Parameters:
    `pattern` - the rule's path match pattern
    `name` - the rule's expanded name
    `templates` - the templates to be instantiated when this rule's pattern is successfully matched
    `variables` - all descendant variables and parameters (may be null)
    `mode` - the rule's mode
    `importance` - the rule's importance
    `priority` - the rule's priority; `null` means use the default priority based on the rule's pattern
    `number` - the rule's identifying number
    `nsContext` - The node in the style sheet from which this rule comes

### TemplateRule

    protected TemplateRule(TemplateRule original,
                           Pattern pattern)

  Constructs a new template rule that is (almost) a shallow copy of the specified rule, with the intent of using the new rule as one of the multiple instances representing a union of path expressions. The new rule is not quite a shallow copy because its pattern is set to a different path expression, and the new and original rules share the same `Template` objects.

  Parameters:
    `original` - the original template rule
    `pattern` - the clone's path expression, represented as a chain of `FilterExpr` objects
  See Also:
    `cloneForUnion(com.novell.xsl.pattern.Pattern)`

Method Detail

### getTemplates

    public Template[] getTemplates()

  Returns the templates that are instantiated when this rule's pattern is successfully matched.

  Returns:
    this rule's templates

### cloneForUnion

    public Rule cloneForUnion(Pattern pattern)

  Creates a new template rule that is (almost) a shallow copy of this rule and whose actual class is the same as this rule's actual class, with the intent of using the new rule as one of the multiple instances representing a union of path expressions. The new rule is not quite a shallow copy because its pattern is set to a different path expression, and the new and original rules share the same `Template` objects.

  Specified by:
    `cloneForUnion` in class `Rule`
  Parameters:
    `pattern` - the clone's path expression, represented as a chain of `FilterExpr` objects
  Returns:
    a clone of this template rule, representing one of the path expressions in a union expression

### instantiate

    public void instantiate(ProcessingEnv env,
                            Node currentNode,
                            Mode currentMode,
                            ResultHandler result)
                     throws XSLException

  Instantiates this rule's template for the specified current node and sends the result to the specified result handler.

  Parameters:
    `env` - the current processing environment
    `currentNode` - the current source node
    `currentMode` - the current processing mode, this is really only for built-in rules which handle all modes
    `result` - the handler to which results are sent
  Throws:
    `XSLException` - if a fatal error occurs during instantiation

### pushVariables

    protected ExpressionValue[] pushVariables()

  Save any variable values that are currently in effect in preparation for a recursive instantiation.

  Returns:
    An array of `ExpressionValue` objects containing the current values of all descendant variables, or null if nothing to save.

### popVariables

    protected void popVariables(ExpressionValue[] state)

  Restore any variable values that were saved by `pushVariables()`

  Parameters:
    `state` - The return from `pushVariables()`

### dump

    public void dump(PrintWriter out,
                     int indent)

  Dumps this object to the specified output stream.

  Specified by:
    `dump` in class `Rule`
  Parameters:
    `out` - the output stream to write to
    `indent` - the number of tabs to indent

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD