sboag 01/06/04 00:53:01
Modified: java/src/org/apache/xalan/templates Tag: DTM_EXP
ElemApplyTemplates.java ElemForEach.java
ElemTemplateElement.java ElemValueOf.java
TemplateList.java
TemplateSubPatternAssociation.java
java/src/org/apache/xalan/transformer Tag: DTM_EXP
QueuedEvents.java ResultTreeHandler.java
TransformSnapshotImpl.java
TransformerHandlerImpl.java
java/src/org/apache/xpath Tag: DTM_EXP Expression.java
XPath.java XPathContext.java
java/src/org/apache/xpath/axes Tag: DTM_EXP
LocPathIterator.java PredicatedNodeTest.java
java/src/org/apache/xpath/functions Tag: DTM_EXP
FuncGenerateId.java
java/src/org/apache/xpath/objects Tag: DTM_EXP XString.java
java/src/org/apache/xpath/patterns Tag: DTM_EXP
FunctionPattern.java NodeTest.java StepPattern.java
Log:
Various minor optimizations or bug fixes.
Revision Changes Path
No revision
No revision
1.13.2.4 +6 -124
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
Index: ElemApplyTemplates.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
retrieving revision 1.13.2.3
retrieving revision 1.13.2.4
diff -u -r1.13.2.3 -r1.13.2.4
--- ElemApplyTemplates.java 2001/06/03 03:20:56 1.13.2.3
+++ ElemApplyTemplates.java 2001/06/04 07:52:50 1.13.2.4
@@ -200,126 +200,8 @@
transformer.pushMode(m_mode);
}
-
- transformSelectedNodes(transformer, null);
- }
- else
- {
- transformSelectedNodes(transformer, null);
- // The code below would work, except for the context node list. -sb
-// try
-// {
-// boolean rdebug = TransformerImpl.S_DEBUG;
-// XPathContext xctxt = transformer.getXPathContext();
-// int sourceNode = xctxt.getCurrentNode();
-//
-// if (rdebug)
-// transformer.getTraceManager().fireSelectedEvent(sourceNode,
this,
-// "test", getSelectOrDefault(),
-// new org.apache.xpath.objects.XNodeSet(
-// getSelectOrDefault().getExpression().asIterator(xctxt,
-// sourceNode))); // ugly as sin.
-//
-//
xctxt.pushContextNodeList((DTMIterator)getSelectOrDefault().getExpression());
// ?? Will it do?
-// transformer.pushElemTemplateElement(null);
-//
-// ResultTreeHandler rth = transformer.getResultTreeHandler();
-// StylesheetRoot sroot = getStylesheetRoot();
-// TemplateList tl = sroot.getTemplateListComposed();
-// SourceLocator savedLocator = xctxt.getSAXLocator();
-// boolean quiet = transformer.getQuietConflictWarnings();
-//
-// try
-// {
-// int child;
-// DTM dtm = xctxt.getDTM(sourceNode);
-// DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.CHILD);
-//
-// for (child = traverser.first(sourceNode); DTM.NULL != child;
-// child = traverser.next(sourceNode, child))
-// {
-//
-// mode = transformer.getMode();
-//
-// ElemTemplate template = tl.getTemplate(xctxt, child, mode,
-// -1, quiet, dtm);
-//
-// // If that didn't locate a node, fall back to a default
template
-// // rule. See http://www.w3.org/TR/xslt#built-in-rule.
-// if (null == template)
-// {
-// switch (dtm.getNodeType(child))
-// {
-// case DTM.DOCUMENT_FRAGMENT_NODE :
-// case DTM.ELEMENT_NODE :
-// template = sroot.getDefaultRule();
-// break;
-// case DTM.ATTRIBUTE_NODE :
-// case DTM.CDATA_SECTION_NODE :
-// case DTM.TEXT_NODE :
-// dtm.dispatchCharactersEvents(child, rth, false);
-//
-// continue;
-// case DTM.DOCUMENT_NODE :
-// template = sroot.getDefaultRootRule();
-// break;
-// default :
-//
-// // No default rules for processing instructions and the
like.
-// continue;
-// }
-// }
-//
-// ElemTemplateElement t = template.m_firstChild;
-//
-// // If we are processing the default text rule, then just
clone
-// // the value directly to the result tree.
-// try
-// {
-// xctxt.pushCurrentNode(child);
-//
-// transformer.pushPairCurrentMatched(template, child);
-//
-// // Fire a trace event for the template.
-// if (rdebug)
-// transformer.getTraceManager().fireTraceEvent(template);
-//
-// // And execute the child templates.
-// // Loop through the children of the template, calling
execute on
-// // each of them.
-// for (; t != null; t = t.m_nextSibling)
-// {
-// xctxt.setSAXLocator(t);
-// transformer.setCurrentElement(t);
-// t.execute(transformer);
-// }
-//
-// // reMarkParams(xctxt);
-// }
-// finally
-// {
-// xctxt.popCurrentNode();
-// transformer.popCurrentMatched();
-// }
-// }
-// }
-// finally
-// {
-// xctxt.setSAXLocator(savedLocator);
-// xctxt.popContextNodeList();
-// transformer.popElemTemplateElement();
-// // popParams(xctxt, savedSearchStart);
-//
-// // if(null != sourceNodes)
-// // sourceNodes.detach();
-// }
-// }
-// catch (SAXException se)
-// {
-// transformer.getErrorListener().fatalError(
-// new TransformerException(se));
-// }
}
+ transformSelectedNodes(transformer, null);
}
finally
{
@@ -336,7 +218,7 @@
*
* @return whether or not to push default arguments on the stack
*/
- boolean needToPushParams()
+ public boolean needToPushParams()
{
return true;
}
@@ -357,11 +239,11 @@
*
* @throws TransformerException
*/
- int pushParams(TransformerImpl transformer, XPathContext xctxt)
+ public int pushParams(TransformerImpl transformer, XPathContext xctxt)
throws TransformerException
{
if(m_isDefaultTemplate)
- return 0;
+ return -1;
VariableStack vars = xctxt.getVarStack();
int savedSearchStart = vars.getSearchStart();
@@ -383,7 +265,7 @@
*
* NEEDSDOC @param xctxt
*/
- void reMarkParams(XPathContext xctxt)
+ public void reMarkParams(XPathContext xctxt)
{
if(m_isDefaultTemplate)
return;
@@ -401,7 +283,7 @@
* @param savedSearchStart Value to restore VariableStack.m_searchStart
* to. This is used to set where to start the current search for a
variable.
*/
- void popParams(XPathContext xctxt, int savedSearchStart)
+ public void popParams(XPathContext xctxt, int savedSearchStart)
{
if(m_isDefaultTemplate)
return;
1.20.2.8 +19 -24
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
Index: ElemForEach.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
retrieving revision 1.20.2.7
retrieving revision 1.20.2.8
diff -u -r1.20.2.7 -r1.20.2.8
--- ElemForEach.java 2001/06/03 03:20:56 1.20.2.7
+++ ElemForEach.java 2001/06/04 07:52:50 1.20.2.8
@@ -265,7 +265,7 @@
*
* @throws TransformerException
*/
- protected DTMIterator sortNodes(
+ public DTMIterator sortNodes(
XPathContext xctxt, Vector keys, DTMIterator sourceNodes)
throws TransformerException
{
@@ -295,7 +295,7 @@
*
* @return False, no need to push parameters here.
*/
- boolean needToPushParams()
+ public boolean needToPushParams()
{
return false;
}
@@ -315,7 +315,7 @@
*
* @throws TransformerException
*/
- int pushParams(TransformerImpl transformer, XPathContext xctxt)
+ public int pushParams(TransformerImpl transformer, XPathContext xctxt)
throws TransformerException
{
@@ -331,7 +331,7 @@
*
* NEEDSDOC @param xctxt
*/
- void reMarkParams(XPathContext xctxt){}
+ public void reMarkParams(XPathContext xctxt){}
/**
* Pop Default parameters from the stack
@@ -342,7 +342,7 @@
* It is just there because ElemApplyTemplates which derives
* from this needs to restore that value.
*/
- void popParams(XPathContext xctxt, int savedSearchStart)
+ public void popParams(XPathContext xctxt, int savedSearchStart)
{
VariableStack vars = xctxt.getVarStack();
@@ -385,7 +385,7 @@
final ResultTreeHandler rth = transformer.getResultTreeHandler();
ContentHandler chandler = rth.getContentHandler();
- final StylesheetRoot sroot = getStylesheetRoot();
+ final StylesheetRoot sroot = transformer.getStylesheet();
final TemplateList tl = sroot.getTemplateListComposed();
final boolean needToFindTemplate = (null == template);
final boolean quiet = transformer.getQuietConflictWarnings();
@@ -400,9 +400,7 @@
// StylesheetComposed stylesheet = getStylesheetComposed();
boolean didSetVars = false;
- SourceLocator savedLocator = null;
- StackGuard guard = null;
- boolean check = false;
+ // boolean check = false;
int savedSearchStart = 0;
try
@@ -446,7 +444,8 @@
case DTM.ATTRIBUTE_NODE :
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
- rth.flushPending(true);
+ if(rth.m_elemIsPending || rth.m_docPending)
+ rth.flushPending(true);
dtm.dispatchCharactersEvents(child, chandler, false);
continue;
case DTM.DOCUMENT_NODE :
@@ -463,19 +462,14 @@
if (!didSetVars)
{
didSetVars = true;
- guard = transformer.getStackGuard();
- check = (guard.m_recursionLimit > -1);
+ // check = (transformer.getStackGuard().m_recursionLimit > -1);
- savedLocator = xctxt.getSAXLocator();
-
+ xctxt.pushSAXLocatorNull();
xctxt.pushContextNodeList(sourceNodes);
transformer.pushElemTemplateElement(null);
-
savedSearchStart = pushParams(transformer, xctxt);
}
- ElemTemplateElement t = template.m_firstChild;
-
// If we are processing the default text rule, then just clone
// the value directly to the result tree.
try
@@ -483,8 +477,8 @@
if (needToFindTemplate)
transformer.pushPairCurrentMatched(template, child);
- if (check)
- guard.push(this, child);
+ // if (check)
+ // guard.push(this, child);
// Fire a trace event for the template.
if (TransformerImpl.S_DEBUG)
@@ -493,7 +487,8 @@
// And execute the child templates.
// Loop through the children of the template, calling execute on
// each of them.
- for (; t != null; t = t.m_nextSibling)
+ for (ElemTemplateElement t = template.m_firstChild;
+ t != null; t = t.m_nextSibling)
{
xctxt.setSAXLocator(t);
transformer.setCurrentElement(t);
@@ -536,7 +531,7 @@
if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(t);
- super.execute(transformer);
+ // super.execute(transformer);
transformer.executeChildTemplates(t, true);
}
break;
@@ -552,8 +547,8 @@
if (needToFindTemplate)
transformer.popCurrentMatched();
- if (check)
- guard.pop();
+ // if (check)
+ // guard.pop();
}
}
}
@@ -561,7 +556,7 @@
{
if (didSetVars)
{
- xctxt.setSAXLocator(savedLocator);
+ xctxt.popSAXLocator();
xctxt.popContextNodeList();
transformer.popElemTemplateElement();
popParams(xctxt, savedSearchStart);
1.38.2.5 +19 -0
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
Index: ElemTemplateElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
retrieving revision 1.38.2.4
retrieving revision 1.38.2.5
diff -u -r1.38.2.4 -r1.38.2.5
--- ElemTemplateElement.java 2001/06/03 03:24:21 1.38.2.4
+++ ElemTemplateElement.java 2001/06/04 07:52:50 1.38.2.5
@@ -234,6 +234,10 @@
public void compose() throws TransformerException
{
resolvePrefixTables();
+ ElemTemplateElement t = getFirstChildElem();
+ m_hasTextLitOnly = ((t != null)
+ && (t.getXSLToken() == Constants.ELEMNAME_TEXTLITERALRESULT)
+ && (t.getNextSiblingElem() == null));
}
/**
@@ -598,6 +602,15 @@
{
return getNodeName();
}
+
+ /**
+ * Tell if this element only has one text child, for optimization purposes.
+ * @return true of this element only has one text literal child.
+ */
+ public boolean hasTextLitOnly()
+ {
+ return m_hasTextLitOnly;
+ }
/**
* Return the base identifier.
@@ -688,6 +701,12 @@
* @serial
*/
private boolean m_defaultSpace = true;
+
+ /**
+ * Tell if this element only has one text child, for optimization purposes.
+ * @serial
+ */
+ private boolean m_hasTextLitOnly = false;
/**
* Set the "xml:space" attribute.
1.13.2.6 +2 -4
xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java
Index: ElemValueOf.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java,v
retrieving revision 1.13.2.5
retrieving revision 1.13.2.6
diff -u -r1.13.2.5 -r1.13.2.6
--- ElemValueOf.java 2001/05/29 14:31:00 1.13.2.5
+++ ElemValueOf.java 2001/06/04 07:52:51 1.13.2.6
@@ -274,10 +274,8 @@
}
else
{
- PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
+ xctxt.pushNamespaceContext(this);
- xctxt.setNamespaceContext(this);
-
int current = xctxt.getCurrentNode();
xctxt.pushCurrentNodeAndExpression(current, current);
@@ -302,7 +300,7 @@
rth.processingInstruction(
javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
- xctxt.setNamespaceContext(savedPrefixResolver);
+ xctxt.popNamespaceContext();
xctxt.popCurrentNodeAndExpression();
}
}
1.30.2.4 +38 -56
xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java
Index: TemplateList.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java,v
retrieving revision 1.30.2.3
retrieving revision 1.30.2.4
diff -u -r1.30.2.3 -r1.30.2.4
--- TemplateList.java 2001/06/03 03:24:21 1.30.2.3
+++ TemplateList.java 2001/06/04 07:52:52 1.30.2.4
@@ -504,28 +504,43 @@
}
/**
- * Get the head of the most likely list of associations to check, based on
- * the name and type of the targetNode argument.
+ * Given a target element, find the template that best
+ * matches in the given XSL document, according
+ * to the rules specified in the xsl draft. This variation of getTemplate
+ * assumes the current node and current expression node have already been
+ * pushed.
*
- * @param xctxt The XPath runtime context.
- * @param targetNode The target node that will be checked for a match.
- * @param dtm The dtm owner for the target node.
+ * @param xctxt
+ * @param targetNode
+ * @param mode A string indicating the display mode.
+ * @param 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.
+ * @param quietConflictWarnings
+ * @return Rule that best matches targetElem.
+ * @throws XSLProcessorException thrown if the active ProblemListener and
XPathContext decide
+ * the error condition is severe enough to halt processing.
*
- * @return The head of a linked list that contains all possible match
pattern to
- * template associations.
+ * @throws TransformerException
*/
- public TemplateSubPatternAssociation getHeadFast(XPathContext xctxt,
- int targetNode, DTM dtm,
- int expNameID)
+ public ElemTemplate getTemplateFast(XPathContext xctxt,
+ int targetNode,
+ int expTypeID,
+ QName mode,
+ int maxImportLevel,
+ boolean quietConflictWarnings,
+ DTM dtm)
+ throws TransformerException
{
+
TemplateSubPatternAssociation head;
- switch (expNameID >> ExpandedNameTable.ROTAMOUNT_TYPE)
+ switch (expTypeID >> ExpandedNameTable.ROTAMOUNT_TYPE)
{
case DTM.ELEMENT_NODE :
case DTM.ATTRIBUTE_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
- dtm.getLocalName(targetNode));
+ dtm.getLocalNameFromExpandedNameID(expTypeID));
break;
case DTM.TEXT_NODE :
case DTM.CDATA_SECTION_NODE :
@@ -553,49 +568,17 @@
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
}
- return (null == head) ? m_wildCardPatterns : head;
- }
-
- /**
- * Given a target element, find the template that best
- * matches in the given XSL document, according
- * to the rules specified in the xsl draft. This variation of getTemplate
- * assumes the current node and current expression node have already been
- * pushed.
- *
- * @param xctxt
- * @param targetNode
- * @param mode A string indicating the display mode.
- * @param 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.
- * @param quietConflictWarnings
- * @return Rule that best matches targetElem.
- * @throws XSLProcessorException thrown if the active ProblemListener and
XPathContext decide
- * the error condition is severe enough to halt processing.
- *
- * @throws TransformerException
- */
- public ElemTemplate getTemplateFast(XPathContext xctxt,
- int targetNode,
- int expTypeID,
- QName mode,
- int maxImportLevel,
- boolean quietConflictWarnings,
- DTM dtm)
- throws TransformerException
- {
-
- TemplateSubPatternAssociation head = getHeadFast(xctxt, targetNode,
- dtm, expTypeID);
-
if(null == head)
- return null;
+ {
+ head = m_wildCardPatterns;
+ if(null == head)
+ return null;
+ }
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
- final PrefixResolver savedPR = xctxt.getNamespaceContext();
+ xctxt.pushNamespaceContextNull();
try
{
do
@@ -607,7 +590,7 @@
ElemTemplate template = head.getTemplate();
xctxt.setNamespaceContext(template);
- if ((head.m_stepPattern.execute(xctxt, targetNode) !=
NodeTest.SCORE_NONE)
+ if ((head.m_stepPattern.execute(xctxt, targetNode, dtm, expTypeID)
!= NodeTest.SCORE_NONE)
&& head.matchMode(mode))
{
if (quietConflictWarnings)
@@ -620,7 +603,7 @@
}
finally
{
- xctxt.setNamespaceContext(savedPR);
+ xctxt.popNamespaceContext();
}
return null;
@@ -660,11 +643,10 @@
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
- PrefixResolver savedPR = xctxt.getNamespaceContext();
+ xctxt.pushNamespaceContextNull();
+ xctxt.pushCurrentNodeAndExpression(targetNode, targetNode);
try
{
- xctxt.pushCurrentNodeAndExpression(targetNode, targetNode);
-
do
{
if ( (maxImportLevel > -1) && (head.getImportLevel() >
maxImportLevel) )
@@ -688,7 +670,7 @@
finally
{
xctxt.popCurrentNodeAndExpression();
- xctxt.setNamespaceContext(savedPR);
+ xctxt.popNamespaceContext();
}
}
1.9.2.2 +7 -7
xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java
Index: TemplateSubPatternAssociation.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -r1.9.2.1 -r1.9.2.2
--- TemplateSubPatternAssociation.java 2001/04/10 18:44:53 1.9.2.1
+++ TemplateSubPatternAssociation.java 2001/06/04 07:52:52 1.9.2.2
@@ -132,7 +132,7 @@
*
* @return The "target" string.
*/
- public String getTargetString()
+ public final String getTargetString()
{
return m_targetString;
}
@@ -200,7 +200,7 @@
*
* @return true if this pattern is considered to be a wild match.
*/
- public boolean isWild()
+ public final boolean isWild()
{
return m_wild;
}
@@ -211,7 +211,7 @@
* @return An executable StepPattern object, never null.
*
*/
- public StepPattern getStepPattern()
+ public final StepPattern getStepPattern()
{
return m_stepPattern;
}
@@ -222,7 +222,7 @@
* @return The pattern string for diagnostic purposes.
*
*/
- public String getPattern()
+ public final String getPattern()
{
return m_pattern;
}
@@ -244,7 +244,7 @@
*
* @return The import level of this template.
*/
- public int getImportLevel()
+ public final int getImportLevel()
{
return m_template.getStylesheetComposed().getImportCountComposed();
}
@@ -255,7 +255,7 @@
* @return An ElemTemplate, never null.
*
*/
- public ElemTemplate getTemplate()
+ public final ElemTemplate getTemplate()
{
return m_template;
}
@@ -265,7 +265,7 @@
*
* @return A valid TemplateSubPatternAssociation, or null.
*/
- public TemplateSubPatternAssociation getNext()
+ public final TemplateSubPatternAssociation getNext()
{
return m_next;
}
No revision
No revision
1.7.2.2 +3 -2
xml-xalan/java/src/org/apache/xalan/transformer/QueuedEvents.java
Index: QueuedEvents.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedEvents.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- QueuedEvents.java 2001/06/03 03:11:52 1.7.2.1
+++ QueuedEvents.java 2001/06/04 07:52:54 1.7.2.2
@@ -85,10 +85,11 @@
/** Queued start element */
// QueuedStartElement m_startElement = new QueuedStartElement();
- protected boolean m_docPending = false;
+ public boolean m_docPending = false;
protected boolean m_docEnded = false;
- /** Flag indicating that an event is pending */
+ /** Flag indicating that an event is pending. Public for
+ * fast access by ElemForEach. */
public boolean m_elemIsPending = false;
/** Flag indicating that an event is ended */
1.37.2.10 +1 -1
xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
Index: ResultTreeHandler.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
retrieving revision 1.37.2.9
retrieving revision 1.37.2.10
diff -u -r1.37.2.9 -r1.37.2.10
--- ResultTreeHandler.java 2001/06/03 03:11:52 1.37.2.9
+++ ResultTreeHandler.java 2001/06/04 07:52:54 1.37.2.10
@@ -1197,7 +1197,7 @@
* has been registered.
* @see #setContentHandler
*/
- public ContentHandler getContentHandler()
+ public final ContentHandler getContentHandler()
{
return m_contentHandler;
}
1.1.2.4 +9 -11
xml-xalan/java/src/org/apache/xalan/transformer/TransformSnapshotImpl.java
Index: TransformSnapshotImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformSnapshotImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- TransformSnapshotImpl.java 2001/06/03 03:24:22 1.1.2.3
+++ TransformSnapshotImpl.java 2001/06/04 07:52:55 1.1.2.4
@@ -62,6 +62,7 @@
import org.apache.xml.utils.NodeVector;
import org.apache.xml.utils.BoolStack;
import org.apache.xml.dtm.DTMIterator;
+import org.apache.xalan.templates.ElemTemplateElement;
import java.util.Stack;
@@ -111,7 +112,7 @@
/**
* Is > 0 when we're processing a for-each.
*/
- private BoolStack m_currentTemplateRuleIsNull = new BoolStack();
+ private BoolStack m_currentTemplateRuleIsNull;
/**
* A node vector used as a stack to track the current
@@ -119,7 +120,7 @@
* org.apache.xalan.transformer.TransformState interface,
* so a tool can discover the calling template.
*/
- private NodeVector m_currentTemplateElements = new NodeVector(64);
+ private ElemTemplateElement[] m_currentTemplateElements;
/**
* A node vector used as a stack to track the current
@@ -129,7 +130,7 @@
* so a tool can discover the matched template, and matched
* node.
*/
- private Stack m_currentMatchTemplates = new Stack();
+ private Stack m_currentMatchTemplates;
/**
* A node vector used as a stack to track the current
@@ -139,19 +140,19 @@
* so a tool can discover the matched template, and matched
* node.
*/
- private NodeVector m_currentMatchNodes = new NodeVector();
+ private NodeVector m_currentMatchNodes;
/**
* The table of counters for xsl:number support.
* @see ElemNumber
*/
- private CountersTable m_countersTable = null;
+ private CountersTable m_countersTable;
/**
* Stack for the purposes of flagging infinite recursion with
* attribute sets.
*/
- private Stack m_attrSetStack = null;
+ private Stack m_attrSetStack;
/** Indicate whether a namespace context was pushed */
boolean m_nsContextPushed;
@@ -164,9 +165,6 @@
/** The number of events queued */
int m_eventCount;
- /** Queued start element */
- QueuedStartElement m_startElement;
-
/**
* Constructor TransformSnapshotImpl
*
@@ -215,7 +213,7 @@
m_currentTemplateRuleIsNull =
(BoolStack) transformer.m_currentTemplateRuleIsNull.clone();
m_currentTemplateElements =
- (NodeVector) transformer.m_currentTemplateElements.clone();
+ (ElemTemplateElement[])
transformer.m_currentTemplateElements.clone();
m_currentMatchTemplates =
(Stack) transformer.m_currentMatchTemplates.clone();
m_currentMatchNodes =
@@ -283,7 +281,7 @@
transformer.m_currentTemplateRuleIsNull =
(BoolStack) m_currentTemplateRuleIsNull.clone();
transformer.m_currentTemplateElements =
- (Stack) m_currentTemplateElements.clone();
+ (ElemTemplateElement[]) m_currentTemplateElements.clone();
transformer.m_currentMatchTemplates =
(Stack) m_currentMatchTemplates.clone();
transformer.m_currentMatchedNodes =
1.1.2.7 +1 -0
xml-xalan/java/src/org/apache/xalan/transformer/Attic/TransformerHandlerImpl.java
Index: TransformerHandlerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/Attic/TransformerHandlerImpl.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- TransformerHandlerImpl.java 2001/05/28 04:07:21 1.1.2.6
+++ TransformerHandlerImpl.java 2001/06/04 07:52:55 1.1.2.7
@@ -358,6 +358,7 @@
Thread listener = new Thread(m_transformer);
m_transformer.setTransformThread(listener);
+ m_transformer.setSourceTreeDocForThread(m_dtm.getDocument());
listener.setDaemon(false);
listener.start();
No revision
No revision
1.14.2.5 +25 -0 xml-xalan/java/src/org/apache/xpath/Expression.java
Index: Expression.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/Expression.java,v
retrieving revision 1.14.2.4
retrieving revision 1.14.2.5
diff -u -r1.14.2.4 -r1.14.2.5
--- Expression.java 2001/06/03 03:24:23 1.14.2.4
+++ Expression.java 2001/06/04 07:52:56 1.14.2.5
@@ -71,6 +71,7 @@
import org.apache.xml.utils.SAXSourceLocator;
import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.dtm.DTMIterator;
+import org.apache.xml.dtm.DTM;
import javax.xml.transform.SourceLocator;
import javax.xml.transform.ErrorListener;
@@ -136,6 +137,30 @@
// For now, the current node is already pushed.
return execute(xctxt);
}
+
+ /**
+ * Execute an expression in the XPath runtime context, and return the
+ * result of the expression.
+ *
+ *
+ * @param xctxt The XPath runtime context.
+ * @param currentNode The currentNode.
+ * @param dtm The DTM of the current node.
+ * @param expType The expanded type ID of the current node.
+ *
+ * @return The result of the expression in the form of a
<code>XObject</code>.
+ *
+ * @throws javax.xml.transform.TransformerException if a runtime exception
+ * occurs.
+ */
+ public XObject execute(XPathContext xctxt, int currentNode,
+ DTM dtm, int expType)
+ throws javax.xml.transform.TransformerException
+ {
+ // For now, the current node is already pushed.
+ return execute(xctxt);
+ }
+
/**
* Execute an expression in the XPath runtime context, and return the
1.18.2.7 +2 -4 xml-xalan/java/src/org/apache/xpath/XPath.java
Index: XPath.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPath.java,v
retrieving revision 1.18.2.6
retrieving revision 1.18.2.7
diff -u -r1.18.2.6 -r1.18.2.7
--- XPath.java 2001/06/03 03:24:23 1.18.2.6
+++ XPath.java 2001/06/04 07:52:57 1.18.2.7
@@ -278,10 +278,8 @@
throws javax.xml.transform.TransformerException
{
- PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
+ xctxt.pushNamespaceContext(namespaceContext);
- xctxt.setNamespaceContext(namespaceContext);
-
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
XObject xobj = null;
@@ -324,7 +322,7 @@
}
finally
{
- xctxt.setNamespaceContext(savedPrefixResolver);
+ xctxt.popNamespaceContext();
xctxt.popCurrentNodeAndExpression();
}
1.20.2.14 +111 -20 xml-xalan/java/src/org/apache/xpath/XPathContext.java
Index: XPathContext.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
retrieving revision 1.20.2.13
retrieving revision 1.20.2.14
diff -u -r1.20.2.13 -r1.20.2.14
--- XPathContext.java 2001/06/03 03:24:23 1.20.2.13
+++ XPathContext.java 2001/06/04 07:52:57 1.20.2.14
@@ -305,6 +305,10 @@
*/
public XPathContext()
{
+ m_prefixResolvers[m_prefixResolversTop++] = null;
+ m_currentNodes[m_currentNodesFirstFree++] = DTM.NULL;
+ m_currentNodes[m_currentExpressionNodesFirstFree++] = DTM.NULL;
+ m_saxLocations[m_saxLocationsTop++] = null;
}
/**
@@ -319,6 +323,10 @@
m_ownerGetErrorListener =
m_owner.getClass().getMethod("getErrorListener", new Class[] {});
}
catch (NoSuchMethodException nsme) {}
+ m_prefixResolvers[m_prefixResolversTop++] = null;
+ m_currentNodes[m_currentNodesFirstFree++] = DTM.NULL;
+ m_currentNodes[m_currentExpressionNodesFirstFree++] = DTM.NULL;
+ m_saxLocations[m_saxLocationsTop++] = null;
}
/**
@@ -327,28 +335,57 @@
public void reset(){}
/** The current stylesheet locator. */
- SourceLocator m_saxLocation;
+ SourceLocator[] m_saxLocations = new SourceLocator[RECURSIONLIMIT];
+ int m_saxLocationsTop = 0;
/**
* Set the current locater in the stylesheet.
*
- *
* @param location The location within the stylesheet.
*/
public void setSAXLocator(SourceLocator location)
+ {
+ m_saxLocations[m_saxLocationsTop-1] = location;
+ }
+
+ /**
+ * Set the current locater in the stylesheet.
+ *
+ * @param location The location within the stylesheet.
+ */
+ public void pushSAXLocator(SourceLocator location)
+ {
+ m_saxLocations[m_saxLocationsTop++] = location;
+ }
+
+ /**
+ * Push a slot on the locations stack so that setSAXLocator can be
+ * repeatedly called.
+ *
+ * @param location The location within the stylesheet.
+ */
+ public void pushSAXLocatorNull()
{
- m_saxLocation = location;
+ m_saxLocationsTop++;
}
+
+ /**
+ * Pop the current locater.
+ */
+ public void popSAXLocator()
+ {
+ m_saxLocationsTop--;
+ }
+
/**
* Get the current locater in the stylesheet.
*
- *
* @return The location within the stylesheet, or null if not known.
*/
public SourceLocator getSAXLocator()
{
- return m_saxLocation;
+ return m_saxLocations[m_saxLocationsTop-1];
}
/** The owner context of this XPathContext. In the case of XSLT, this
will be a
@@ -414,7 +451,7 @@
*
* @return the variable stack, which should not be null.
*/
- public VariableStack getVarStack()
+ public final VariableStack getVarStack()
{
return m_variableStacks;
}
@@ -425,7 +462,7 @@
*
* @param varStack non-null reference to the variable stack.
*/
- public void setVarStack(VariableStack varStack)
+ public final void setVarStack(VariableStack varStack)
{
m_variableStacks = varStack;
}
@@ -656,13 +693,10 @@
}
/**
- * The current prefixResolver for the execution context (not
- * the source tree context).
- * (Is this really needed?)
+ * The ammount to use for stacks that record information during the
+ * recursive execution.
*/
- private PrefixResolver m_currentPrefixResolver = null;
-
- private static final int RECURSIONLIMIT = (1024*4);
+ public static final int RECURSIONLIMIT = (1024*4);
/** The stack of <a
href="http://www.w3.org/TR/xslt#dt-current-node">current node</a> objects.
* Not to be confused with the current node list. %REVIEW% Note that
there
@@ -683,8 +717,7 @@
*/
public final int getCurrentNode()
{
- int i = m_currentNodesFirstFree-1;
- return (i < 0) ? DTM.NULL : m_currentNodes[i];
+ return m_currentNodes[m_currentNodesFirstFree-1];
}
/**
@@ -707,6 +740,32 @@
m_currentNodesFirstFree--;
m_currentExpressionNodesFirstFree--;
}
+
+ /**
+ * Push the current context node, expression node, and prefix resolver.
+ *
+ * @param cn the <a
href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
+ * @param en the sub-expression context node.
+ * @param nc the namespace context (prefix resolver.
+ */
+ public final void pushExpressionState(int cn, int en, PrefixResolver nc)
+ {
+ m_currentNodes[m_currentNodesFirstFree++] = cn;
+ m_currentExpressionNodes[m_currentExpressionNodesFirstFree++] = cn;
+ m_prefixResolvers[m_prefixResolversTop++] = nc;
+ }
+
+ /**
+ * Pop the current context node, expression node, and prefix resolver.
+ */
+ public final void popExpressionState()
+ {
+ m_currentNodesFirstFree--;
+ m_currentExpressionNodesFirstFree--;
+ m_prefixResolversTop--;
+ }
+
+
/**
* Set the current context node.
@@ -822,8 +881,7 @@
*/
public final int getCurrentExpressionNode()
{
- int i = m_currentExpressionNodesFirstFree-1;
- return (i < 0) ? DTM.NULL : m_currentExpressionNodes[i];
+ return m_currentExpressionNodes[m_currentExpressionNodesFirstFree-1];
}
/**
@@ -837,12 +895,17 @@
}
/**
- * Pop the current node that is the expression's context (i.e. for
current() support).
+ * Pop the current node that is the expression's context
+ * (i.e. for current() support).
*/
public final void popCurrentExpressionNode()
{
m_currentExpressionNodesFirstFree--;
}
+
+ private PrefixResolver[] m_prefixResolvers
+ = new PrefixResolver[RECURSIONLIMIT];
+ private int m_prefixResolversTop = 0;
/**
* Get the current namespace context for the xpath.
@@ -852,7 +915,7 @@
*/
public final PrefixResolver getNamespaceContext()
{
- return m_currentPrefixResolver;
+ return m_prefixResolvers[m_prefixResolversTop-1];
}
/**
@@ -862,8 +925,36 @@
* namespace URLs.
*/
public final void setNamespaceContext(PrefixResolver pr)
+ {
+ m_prefixResolvers[m_prefixResolversTop-1] = pr;
+ }
+
+ /**
+ * Push a current namespace context for the xpath.
+ *
+ * @param pr the prefix resolver to be used for resolving prefixes to
+ * namespace URLs.
+ */
+ public final void pushNamespaceContext(PrefixResolver pr)
+ {
+ m_prefixResolvers[m_prefixResolversTop++] = pr;
+ }
+
+ /**
+ * Just increment the namespace contest stack, so that setNamespaceContext
+ * can be used on the slot.
+ */
+ public final void pushNamespaceContextNull()
+ {
+ m_prefixResolversTop++;
+ }
+
+ /**
+ * Pop the current namespace context for the xpath.
+ */
+ public final void popNamespaceContext()
{
- m_currentPrefixResolver = pr;
+ m_prefixResolversTop--;
}
//==========================================================
No revision
No revision
1.24.2.11 +1 -1
xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
Index: LocPathIterator.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
retrieving revision 1.24.2.10
retrieving revision 1.24.2.11
diff -u -r1.24.2.10 -r1.24.2.11
--- LocPathIterator.java 2001/06/03 03:09:23 1.24.2.10
+++ LocPathIterator.java 2001/06/04 07:52:58 1.24.2.11
@@ -958,7 +958,7 @@
private boolean m_isTopLevel = false;
/** The index of the last node in the iteration. */
- transient private int m_last = 0;
+ transient protected int m_last = 0;
/** The last node that was fetched, usually by nextNode. */
transient public int m_lastFetched = DTM.NULL;
1.3.2.6 +2 -2
xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java
Index: PredicatedNodeTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java,v
retrieving revision 1.3.2.5
retrieving revision 1.3.2.6
diff -u -r1.3.2.5 -r1.3.2.6
--- PredicatedNodeTest.java 2001/06/03 03:09:23 1.3.2.5
+++ PredicatedNodeTest.java 2001/06/04 07:52:58 1.3.2.6
@@ -275,7 +275,7 @@
try
{
xctxt.pushSubContextList(this);
- xctxt.setNamespaceContext(m_lpi.getPrefixResolver());
+ xctxt.pushNamespaceContext(m_lpi.getPrefixResolver());
xctxt.pushCurrentNode(context);
for (int i = 0; i < nPredicates; i++)
@@ -323,7 +323,7 @@
finally
{
xctxt.popCurrentNode();
- xctxt.setNamespaceContext(savedResolver);
+ xctxt.popNamespaceContext();
xctxt.popSubContextList();
}
No revision
No revision
1.4.2.3 +7 -1
xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java
Index: FuncGenerateId.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- FuncGenerateId.java 2001/05/10 20:49:05 1.4.2.2
+++ FuncGenerateId.java 2001/06/04 07:52:59 1.4.2.3
@@ -88,7 +88,13 @@
int which = getArg0AsNode(xctxt);
if (DTM.NULL != which)
- return new XString("N" + Integer.toHexString(which+1).toUpperCase());
+ {
+ // Uglieness to get the unique ID to match the test gold.
+ int docID = (which & org.apache.xml.dtm.DTMManager.IDENT_DTM_DEFAULT)
>> 20;
+ docID = (docID-1) << 20;
+ int id = ((which &
org.apache.xml.dtm.DTMManager.IDENT_NODE_DEFAULT)+1) | docID;
+ return new XString("N" + Integer.toHexString(id).toUpperCase());
+ }
else
return XString.EMPTYSTRING;
}
No revision
No revision
1.6.2.10 +9 -8 xml-xalan/java/src/org/apache/xpath/objects/XString.java
Index: XString.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XString.java,v
retrieving revision 1.6.2.9
retrieving revision 1.6.2.10
diff -u -r1.6.2.9 -r1.6.2.10
--- XString.java 2001/06/01 23:48:16 1.6.2.9
+++ XString.java 2001/06/04 07:53:00 1.6.2.10
@@ -537,16 +537,17 @@
*/
public int compareToIgnoreCase(XMLString str)
{
- // %REVIEW% Like it says, @since 1.2. Doesn't exist in earlier
- // versions of Java, hence we can't yet shell out to it. We can
implement
- // it as character-by-character compare, but doing so efficiently
+ // %REVIEW% Like it says, @since 1.2. Doesn't exist in earlier
+ // versions of Java, hence we can't yet shell out to it. We can implement
+ // it as character-by-character compare, but doing so efficiently
// is likely to be (ahem) interesting.
- //
- // However, since nobody is actually _using_ this method yet:
+ //
+ // However, since nobody is actually _using_ this method yet:
// return str().compareToIgnoreCase(str.toString());
-
- throw new java.lang.NoSuchMethodException("Java 1.2 method, not yet
implemented");
-
+
+ throw new org.apache.xml.utils.WrappedRuntimeException(
+ new java.lang.NoSuchMethodException(
+ "Java 1.2 method, not yet implemented"));
}
/**
No revision
No revision
1.7.2.7 +45 -0
xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java
Index: FunctionPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -r1.7.2.6 -r1.7.2.7
--- FunctionPattern.java 2001/05/30 20:31:25 1.7.2.6
+++ FunctionPattern.java 2001/06/04 07:53:00 1.7.2.7
@@ -106,6 +106,7 @@
* @serial
*/
Expression m_functionExpr;
+
/**
* Test a node to see if it matches the given node test.
*
@@ -120,6 +121,50 @@
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt, int context)
+ throws javax.xml.transform.TransformerException
+ {
+
+ XObject obj = m_functionExpr.execute(xctxt);
+ DTMIterator nl = obj.nodeset();
+ XNumber score = SCORE_NONE;
+
+ if (null != nl)
+ {
+ int n;
+
+ while (DTM.NULL != (n = nl.nextNode()))
+ {
+ score = (n == context) ? SCORE_OTHER : SCORE_NONE;
+
+ if (score == SCORE_OTHER)
+ {
+ context = n;
+
+ break;
+ }
+ }
+
+ // nl.detach();
+ }
+
+ return score;
+ }
+
+ /**
+ * Test a node to see if it matches the given node test.
+ *
+ * @param xctxt XPath runtime context.
+ *
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_OTHER}.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public XObject execute(XPathContext xctxt, int context,
+ DTM dtm, int expType)
throws javax.xml.transform.TransformerException
{
1.20.2.8 +74 -0
xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java
Index: NodeTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java,v
retrieving revision 1.20.2.7
retrieving revision 1.20.2.8
diff -u -r1.20.2.7 -r1.20.2.8
--- NodeTest.java 2001/05/28 04:07:45 1.20.2.7
+++ NodeTest.java 2001/06/04 07:53:00 1.20.2.8
@@ -66,6 +66,7 @@
import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.dtm.DTMFilter;
import org.apache.xml.dtm.DTM;
+import org.apache.xml.dtm.ref.ExpandedNameTable;
/**
* <meta name="usage" content="advanced"/>
@@ -530,6 +531,79 @@
return m_score;
int nodeBit = (m_whatToShow & (0x00000001 << (nodeType - 1)));
+
+ switch (nodeBit)
+ {
+ case DTMFilter.SHOW_DOCUMENT_FRAGMENT :
+ case DTMFilter.SHOW_DOCUMENT :
+ return SCORE_OTHER;
+ case DTMFilter.SHOW_COMMENT :
+ return m_score;
+ case DTMFilter.SHOW_CDATA_SECTION :
+ case DTMFilter.SHOW_TEXT :
+
+ // was:
+ // return (!xctxt.getDOMHelper().shouldStripSourceNode(context))
+ // ? m_score : SCORE_NONE;
+ return m_score;
+ case DTMFilter.SHOW_PROCESSING_INSTRUCTION :
+ return subPartMatch(dtm.getNodeName(context), m_name)
+ ? m_score : SCORE_NONE;
+
+ // From the draft: "Two expanded names are equal if they
+ // have the same local part, and either both have no URI or
+ // both have the same URI."
+ // "A node test * is true for any node of the principal node type.
+ // For example, child::* will select all element children of the
+ // context node, and attribute::* will select all attributes of
+ // the context node."
+ // "A node test can have the form NCName:*. In this case, the prefix
+ // is expanded in the same way as with a QName using the context
+ // namespace declarations. The node test will be true for any node
+ // of the principal type whose expanded name has the URI to which
+ // the prefix expands, regardless of the local part of the name."
+ case DTMFilter.SHOW_NAMESPACE :
+ {
+ String ns = dtm.getNodeValue(context);
+
+ return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
+ }
+ case DTMFilter.SHOW_ATTRIBUTE :
+ case DTMFilter.SHOW_ELEMENT :
+ {
+ return (m_isTotallyWild ||
(subPartMatchNS(dtm.getNamespaceURI(context), m_namespace) &&
subPartMatch(dtm.getLocalName(context), m_name)))
+ ? m_score : SCORE_NONE;
+ }
+ default :
+ return SCORE_NONE;
+ } // end switch(testType)
+ }
+
+ /**
+ * Tell what the test score is for the given node.
+ *
+ *
+ * @param xctxt XPath runtime context.
+ * @param context The node being tested.
+ *
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest#SCORE_OTHER}.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public XObject execute(XPathContext xctxt, int context,
+ DTM dtm, int expType)
+ throws javax.xml.transform.TransformerException
+ {
+
+ if (m_whatToShow == DTMFilter.SHOW_ALL)
+ return m_score;
+
+ int nodeBit = (m_whatToShow & (0x00000001
+ << ((expType >> ExpandedNameTable.ROTAMOUNT_TYPE) - 1)));
switch (nodeBit)
{
1.19.2.7 +45 -0
xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java
Index: StepPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java,v
retrieving revision 1.19.2.6
retrieving revision 1.19.2.7
diff -u -r1.19.2.6 -r1.19.2.7
--- StepPattern.java 2001/05/30 20:31:26 1.19.2.6
+++ StepPattern.java 2001/06/04 07:53:01 1.19.2.7
@@ -396,6 +396,51 @@
}
/**
+ * Execute an expression in the XPath runtime context, and return the
+ * result of the expression.
+ *
+ *
+ * @param xctxt The XPath runtime context.
+ * @param currentNode The currentNode.
+ * @param dtm The DTM of the current node.
+ * @param expType The expanded type ID of the current node.
+ *
+ * @return The result of the expression in the form of a
<code>XObject</code>.
+ *
+ * @throws javax.xml.transform.TransformerException if a runtime exception
+ * occurs.
+ */
+ public XObject execute(XPathContext xctxt, int currentNode,
+ DTM dtm, int expType)
+ throws javax.xml.transform.TransformerException
+ {
+ if (m_whatToShow == NodeTest.SHOW_BYFUNCTION)
+ {
+ if (null != m_relativePathPattern)
+ {
+ return m_relativePathPattern.execute(xctxt);
+ }
+ else
+ return NodeTest.SCORE_NONE;
+ }
+
+ XObject score = super.execute(xctxt, currentNode, dtm, expType);
+
+ if (score == NodeTest.SCORE_NONE)
+ return score;
+
+ else if (null != m_relativePathPattern)
+ {
+ return m_relativePathPattern.executeRelativePathPattern(xctxt, this);
+ }
+ else
+ {
+ return score;
+ }
+ }
+
+
+ /**
* Get the proximity position index of the current node based on this
* node test.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]