|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.templates.TemplateList
public class TemplateList
Encapsulates a template list, and helps locate individual templates.
Nested Class Summary | |
---|---|
class |
TemplateList.TemplateWalker
An inner class used by a compiler to iterate over all of the ElemTemplates stored in this TemplateList. |
Field Summary | |
---|---|
(package private) static boolean |
DEBUG
Flag to indicate whether in DEBUG mode |
private TemplateSubPatternAssociation |
m_commentPatterns
Comment Patterns. |
private TemplateSubPatternAssociation |
m_docPatterns
Root document Patterns. |
private java.util.Hashtable |
m_namedTemplates
Keyed on string macro names, and holding values that are macro elements in the XSL DOM tree. |
private java.util.Hashtable |
m_patternTable
This table is keyed on the target elements of patterns, and contains linked lists of the actual patterns that match the target element to some degree of specifity. |
private TemplateSubPatternAssociation |
m_textPatterns
Text Patterns. |
private TemplateSubPatternAssociation |
m_wildCardPatterns
Wildcard patterns. |
(package private) static long |
serialVersionUID
|
Constructor Summary | |
---|---|
TemplateList()
Construct a TemplateList object. |
Method Summary | |
---|---|
private void |
addObjectIfNotFound(java.lang.Object obj,
java.util.Vector v)
Add object to vector if not already there. |
private void |
checkConflicts(TemplateSubPatternAssociation head,
XPathContext xctxt,
int targetNode,
QName mode)
Check for match conflicts, and warn the stylesheet author. |
void |
compose(StylesheetRoot sroot)
After all templates have been added, this function should be called. |
(package private) void |
dumpAssociationTables()
Dump all patterns and elements that match those patterns |
private TemplateSubPatternAssociation |
getHead(java.lang.String key)
Get the head of the assocation list that is keyed by target. |
TemplateSubPatternAssociation |
getHead(XPathContext xctxt,
int targetNode,
DTM dtm)
Get the head of the most likely list of associations to check, based on the name and type of the targetNode argument. |
private java.util.Hashtable |
getNamedTemplates()
Get table of named Templates. |
private double |
getPriorityOrScore(TemplateSubPatternAssociation matchPat)
Given a match pattern and template association, return the score of that match. |
ElemTemplate |
getTemplate(QName qname)
Locate a named template. |
ElemTemplate |
getTemplate(XPathContext xctxt,
int targetNode,
QName mode,
boolean quietConflictWarnings,
DTM dtm)
Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft. |
ElemTemplate |
getTemplate(XPathContext xctxt,
int targetNode,
QName mode,
int maxImportLevel,
int endImportLevel,
boolean quietConflictWarnings,
DTM dtm)
Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft. |
ElemTemplate |
getTemplateFast(XPathContext xctxt,
int targetNode,
int expTypeID,
QName mode,
int maxImportLevel,
boolean quietConflictWarnings,
DTM dtm)
Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft. |
TemplateList.TemplateWalker |
getWalker()
Get a TemplateWalker for use by a compiler. |
private TemplateSubPatternAssociation |
insertAssociationIntoList(TemplateSubPatternAssociation head,
TemplateSubPatternAssociation item,
boolean isWildCardInsert)
Insert the given TemplateSubPatternAssociation into the the linked list. |
private void |
insertPatternInTable(StepPattern pattern,
ElemTemplate template)
Add a template to the template list. |
private void |
putHead(java.lang.String key,
TemplateSubPatternAssociation assoc)
Get the head of the assocation list that is keyed by target. |
private void |
setNamedTemplates(java.util.Hashtable v)
Set table of named Templates. |
void |
setTemplate(ElemTemplate template)
Add a template to the table of named templates and/or the table of templates with match patterns. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
static final boolean DEBUG
private java.util.Hashtable m_namedTemplates
private java.util.Hashtable m_patternTable
private TemplateSubPatternAssociation m_wildCardPatterns
private TemplateSubPatternAssociation m_textPatterns
private TemplateSubPatternAssociation m_docPatterns
private TemplateSubPatternAssociation m_commentPatterns
Constructor Detail |
---|
public TemplateList()
Method Detail |
---|
public void setTemplate(ElemTemplate template)
template
- void dumpAssociationTables()
public void compose(StylesheetRoot sroot)
private TemplateSubPatternAssociation insertAssociationIntoList(TemplateSubPatternAssociation head, TemplateSubPatternAssociation item, boolean isWildCardInsert)
head
- The first TemplateSubPatternAssociation in the linked list.item
- The item that we want to insert into the proper place.isWildCardInsert
- true
if we are inserting a wild card
template onto this list.
private void insertPatternInTable(StepPattern pattern, ElemTemplate template)
pattern
- template
- private double getPriorityOrScore(TemplateSubPatternAssociation matchPat)
matchPat
- The match pattern to template association.
NodeTest.SCORE_NODETEST
,
NodeTest.SCORE_NONE
,
NodeTest.SCORE_NSWILD
,
NodeTest.SCORE_QNAME
, or
NodeTest.SCORE_OTHER
, or
the value defined by the priority attribute of the template.public ElemTemplate getTemplate(QName qname)
qname
- Qualified name of the template.
public TemplateSubPatternAssociation getHead(XPathContext xctxt, int targetNode, DTM dtm)
xctxt
- The XPath runtime context.targetNode
- The target node that will be checked for a match.dtm
- The dtm owner for the target node.
public ElemTemplate getTemplateFast(XPathContext xctxt, int targetNode, int expTypeID, QName mode, int maxImportLevel, boolean quietConflictWarnings, DTM dtm) throws javax.xml.transform.TransformerException
xctxt
- targetNode
- mode
- A string indicating the display mode.maxImportLevel
- The maximum importCountComposed that we should consider or -1
if we should consider all import levels. This is used by apply-imports to
access templates that have been overridden.quietConflictWarnings
-
XSLProcessorException
- thrown if the active ProblemListener and XPathContext decide
the error condition is severe enough to halt processing.
javax.xml.transform.TransformerException
public ElemTemplate getTemplate(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) throws javax.xml.transform.TransformerException
xctxt
- targetNode
- mode
- A string indicating the display mode.quietConflictWarnings
-
XSLProcessorException
- thrown if the active ProblemListener and XPathContext decide
the error condition is severe enough to halt processing.
javax.xml.transform.TransformerException
public ElemTemplate getTemplate(XPathContext xctxt, int targetNode, QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, DTM dtm) throws javax.xml.transform.TransformerException
xctxt
- targetNode
- mode
- A string indicating the display mode.maxImportLevel
- The maximum importCountComposed that we should consider or -1
if we should consider all import levels. This is used by apply-imports to
access templates that have been overridden.endImportLevel
- The count of composed importsquietConflictWarnings
-
XSLProcessorException
- thrown if the active ProblemListener and XPathContext decide
the error condition is severe enough to halt processing.
javax.xml.transform.TransformerException
public TemplateList.TemplateWalker getWalker()
private void checkConflicts(TemplateSubPatternAssociation head, XPathContext xctxt, int targetNode, QName mode)
head
- Template patternxctxt
- Current XPath contexttargetNode
- Node matching the patternmode
- reference, which may be null, to the current mode.private void addObjectIfNotFound(java.lang.Object obj, java.util.Vector v)
obj
- v
- private java.util.Hashtable getNamedTemplates()
String
s
as the keys, and ElemTemplate
s as the
values.private void setNamedTemplates(java.util.Hashtable v)
v
- Hashtable dictionary that contains String
s
as the keys, and ElemTemplate
s as the
values.private TemplateSubPatternAssociation getHead(java.lang.String key)
key
- The name of a node.
private void putHead(java.lang.String key, TemplateSubPatternAssociation assoc)
key
- assoc
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |