jd.xml.xslt.template
Class TemplateRule

java.lang.Object
  extended byjd.xml.xslt.util.XsltSortable
      extended byjd.xml.xslt.template.TemplateRule
Direct Known Subclasses:
TraceTemplateRule

public class TemplateRule
extends XsltSortable

TemplateRule represents a xsl:template instruction.


Constructor Summary
TemplateRule(int importPrecedence, double priority, int serial, Template template, Variable[] params, boolean hasLocalVariables, Pattern pattern, Pattern originalPattern, String mode)
          Create a TemplateRule with a match pattern.
TemplateRule(int importPrecedence, double priority, int serial, Template template, Variable[] params, boolean hasLocalVariables, String name)
          Create a named TemplateRule.
TemplateRule(TemplateRule rule)
          Create a TemplateRule by copying another rule.
 
Method Summary
 void applyTemplate(XsltContext context, ResultBuilder resultBuilder, Variable[] params, XObject[] paramValues)
          Instantiate the template of this template rule.
 String getMode()
          Return the mode.
 String getName()
          Return the name.
 Pattern getOriginalPattern()
          Return the pattern, which was defined in the xsl:template instructions match attribute.
 Variable[] getParameters()
          Return the parameters.
 Pattern getPattern()
          Return the pattern which is used to test if a node matches the template.
 Template getTemplate()
          Return the template content.
 boolean hasLocalVariables()
          Return if the template contains local variable or parameter declarations.
 boolean match(String name)
          Test if the name of this TemplateRule matches the given name.
(package private)  boolean match(XPathContext context)
          Test if the pattern of this TemplateRule matches the context node.
(package private)  boolean match(XPathContext context, String mode)
          Test if the pattern of this TemplateRule matches the context node.
static TemplateRule[] toSortedArray(Vector templateRules)
           
 String toString()
          Return a debug string representation.
 
Methods inherited from class jd.xml.xslt.util.XsltSortable
compareTo, getImportPrecedence, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateRule

public TemplateRule(int importPrecedence,
                    double priority,
                    int serial,
                    Template template,
                    Variable[] params,
                    boolean hasLocalVariables,
                    Pattern pattern,
                    Pattern originalPattern,
                    String mode)
Create a TemplateRule with a match pattern.

Parameters:
importPrecedence - the import precedence
priority - the priority
serial - the serial number of rule definition
template - a template
params - the template parameters. Either null or has positive length
hasLocalVariables - does the template contain local variable declarations?
pattern - the match pattern
mode - the mode

TemplateRule

public TemplateRule(int importPrecedence,
                    double priority,
                    int serial,
                    Template template,
                    Variable[] params,
                    boolean hasLocalVariables,
                    String name)
Create a named TemplateRule.

Parameters:
importPrecedence - the import precedence
priority - the priority
serial - the serial number of rule definition
template - a template
params - the template parameters. Either null or has positive length
hasLocalVariables - does the template contain local variable declarations?
name - the name

TemplateRule

public TemplateRule(TemplateRule rule)
Create a TemplateRule by copying another rule.

Parameters:
rule - another rule
Method Detail

toSortedArray

public static TemplateRule[] toSortedArray(Vector templateRules)

getTemplate

public Template getTemplate()
Return the template content.


getParameters

public Variable[] getParameters()
Return the parameters.


getName

public String getName()
Return the name.


getMode

public String getMode()
Return the mode.


getPattern

public Pattern getPattern()
Return the pattern which is used to test if a node matches the template. It is equal to getOriginalPattern() except if the original pattern is a union pattern. In that case a TemplateRule object for each alternative pattern of the union pattern is created.


getOriginalPattern

public Pattern getOriginalPattern()
Return the pattern, which was defined in the xsl:template instructions match attribute.


hasLocalVariables

public boolean hasLocalVariables()
Return if the template contains local variable or parameter declarations.


match

public boolean match(String name)
Test if the name of this TemplateRule matches the given name.


match

boolean match(XPathContext context)
Test if the pattern of this TemplateRule matches the context node.


match

boolean match(XPathContext context,
              String mode)
Test if the pattern of this TemplateRule matches the context node.


applyTemplate

public void applyTemplate(XsltContext context,
                          ResultBuilder resultBuilder,
                          Variable[] params,
                          XObject[] paramValues)
Instantiate the template of this template rule.

Parameters:
context - the transformation context
resultBuilder - the result builder
params - parameters supplied to the template via instructions. The array is null or has positive length.
paramValues - the values of the supplied parameters.

toString

public String toString()
Return a debug string representation.