org.apache.xalan.templates
Class TemplateSubPatternAssociation

java.lang.Object
  extended byorg.apache.xalan.templates.TemplateSubPatternAssociation
All Implemented Interfaces:
Cloneable, Serializable

class TemplateSubPatternAssociation
extends Object
implements Serializable, Cloneable

A class to contain a match pattern and it's corresponding template. This class also defines a node in a match pattern linked list.


Field Summary
private  TemplateSubPatternAssociation m_next
          Next pattern
private  String m_pattern
          Template pattern
(package private)  StepPattern m_stepPattern
          Step pattern
private  String m_targetString
          Target string for this match pattern
private  ElemTemplate m_template
          The template element
private  boolean m_wild
          Flag indicating whether this is wild card pattern
 
Constructor Summary
(package private) TemplateSubPatternAssociation(ElemTemplate template, StepPattern pattern, String pat)
          Construct a match pattern from a pattern and template.
 
Method Summary
 Object clone()
          Clone this object.
 int getDocOrderPos()
          Return the position of the template in document order in the stylesheet.
 int getImportLevel()
          Return the import level associated with the stylesheet into which this template is composed.
 TemplateSubPatternAssociation getNext()
          Get the next association.
 String getPattern()
          Get the pattern string for diagnostic purposes.
 StepPattern getStepPattern()
          Get associated XSLT StepPattern.
 String getTargetString()
          Get the target string of the pattern.
 ElemTemplate getTemplate()
          Get the assocated xsl:template.
 boolean isWild()
          Tell if the pattern for this association is a wildcard.
 boolean matches(XPathContext xctxt, int targetNode, QName mode)
          Return the mode associated with the template.
(package private)  boolean matchMode(QName m1)
          Tell if two modes match according to the rules of XSLT.
private  boolean matchModes(QName m1, QName m2)
          Tell if two modes match according to the rules of XSLT.
 void setNext(TemplateSubPatternAssociation mp)
          Set the next element on this association list, which should be equal or less in priority to this association, and, if equal priority, should occur before this template in document order.
 void setTargetString(String key)
          Set Target String for this template pattern
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stepPattern

StepPattern m_stepPattern
Step pattern


m_pattern

private String m_pattern
Template pattern


m_template

private ElemTemplate m_template
The template element


m_next

private TemplateSubPatternAssociation m_next
Next pattern


m_wild

private boolean m_wild
Flag indicating whether this is wild card pattern


m_targetString

private String m_targetString
Target string for this match pattern

Constructor Detail

TemplateSubPatternAssociation

TemplateSubPatternAssociation(ElemTemplate template,
                              StepPattern pattern,
                              String pat)
Construct a match pattern from a pattern and template.

Parameters:
template - The node that contains the template for this pattern.
pattern - An executable XSLT StepPattern.
pat - For now a Nodelist that contains old-style element patterns.
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Clone this object.

Overrides:
clone in class Object
Returns:
The cloned object.
Throws:
CloneNotSupportedException
See Also:
Cloneable

getTargetString

public final String getTargetString()
Get the target string of the pattern. For instance, if the pattern is "foo/baz/boo[@daba]", this string will be "boo".

Returns:
The "target" string.

setTargetString

public void setTargetString(String key)
Set Target String for this template pattern

Parameters:
key - Target string to set

matchMode

boolean matchMode(QName m1)
Tell if two modes match according to the rules of XSLT.

Parameters:
m1 - mode to match
Returns:
True if the given mode matches this template's mode

matchModes

private boolean matchModes(QName m1,
                           QName m2)
Tell if two modes match according to the rules of XSLT.

Parameters:
m1 - First mode to match
m2 - Second mode to match
Returns:
True if the two given modes match

matches

public boolean matches(XPathContext xctxt,
                       int targetNode,
                       QName mode)
                throws javax.xml.transform.TransformerException
Return the mode associated with the template.

Parameters:
xctxt - XPath context to use with this template
targetNode - Target node
mode - reference, which may be null, to the current mode.
Returns:
The mode associated with the template.
Throws:
javax.xml.transform.TransformerException

isWild

public final boolean isWild()
Tell if the pattern for this association is a wildcard.

Returns:
true if this pattern is considered to be a wild match.

getStepPattern

public final StepPattern getStepPattern()
Get associated XSLT StepPattern.

Returns:
An executable StepPattern object, never null.

getPattern

public final String getPattern()
Get the pattern string for diagnostic purposes.

Returns:
The pattern string for diagnostic purposes.

getDocOrderPos

public int getDocOrderPos()
Return the position of the template in document order in the stylesheet.

Returns:
The position of the template in the overall template order.

getImportLevel

public final int getImportLevel()
Return the import level associated with the stylesheet into which this template is composed.

Returns:
The import level of this template.

getTemplate

public final ElemTemplate getTemplate()
Get the assocated xsl:template.

Returns:
An ElemTemplate, never null.

getNext

public final TemplateSubPatternAssociation getNext()
Get the next association.

Returns:
A valid TemplateSubPatternAssociation, or null.

setNext

public void setNext(TemplateSubPatternAssociation mp)
Set the next element on this association list, which should be equal or less in priority to this association, and, if equal priority, should occur before this template in document order.

Parameters:
mp - The next association to score if this one fails.