You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by David N Bertoni <db...@locus.apache.org> on 2000/07/06 22:19:28 UTC
cvs commit: xml-xalan/c/src/XSLT AVTPartXPath.cpp ElemChoose.cpp ElemCopy.cpp ElemCopyOf.cpp ElemIf.cpp ElemLiteralResult.cpp ElemLiteralResult.hpp ElemNumber.cpp ElemNumber.hpp ElemParam.cpp ElemTemplateElement.cpp ElemValueOf.cpp NodeSorter.cpp NodeSorter.hpp Stylesheet.cpp Stylesheet.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp
dbertoni 00/07/06 13:19:28
Modified: c/src/XSLT AVTPartXPath.cpp ElemChoose.cpp ElemCopy.cpp
ElemCopyOf.cpp ElemIf.cpp ElemLiteralResult.cpp
ElemLiteralResult.hpp ElemNumber.cpp ElemNumber.hpp
ElemParam.cpp ElemTemplateElement.cpp
ElemValueOf.cpp NodeSorter.cpp NodeSorter.hpp
Stylesheet.cpp Stylesheet.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Changes for cleanup of temporary XObjects. Fixed some bugs with xsl:use-attribute-set. Fixed problems with stable sorting.
Revision Changes Path
1.5 +5 -2 xml-xalan/c/src/XSLT/AVTPartXPath.cpp
Index: AVTPartXPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartXPath.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVTPartXPath.cpp 2000/04/11 15:09:20 1.4
+++ AVTPartXPath.cpp 2000/07/06 20:19:24 1.5
@@ -59,6 +59,7 @@
#include <XPath/XObject.hpp>
+#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
#include <XPath/XPathFactory.hpp>
#include <XPath/XPathProcessor.hpp>
@@ -121,9 +122,11 @@
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const
{
- const XObject* const xobj = m_pXPath->execute(contextNode, prefixResolver, executionContext);
+ const XObjectGuard xobj(
+ executionContext.getXObjectFactory(),
+ m_pXPath->execute(contextNode, prefixResolver, executionContext));
- if(0 != xobj)
+ if(0 != xobj.get())
{
append(buf, xobj->str());
}
1.6 +6 -6 xml-xalan/c/src/XSLT/ElemChoose.cpp
Index: ElemChoose.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemChoose.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemChoose.cpp 2000/05/24 19:38:47 1.5
+++ ElemChoose.cpp 2000/07/06 20:19:24 1.6
@@ -63,6 +63,7 @@
+#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
@@ -128,11 +129,10 @@
const XPath* const theXPath = when->getXPath();
assert(theXPath != 0);
- const XObject* const test =
- theXPath ->execute(sourceNode,
- *this,
- executionContext);
- assert(test != 0);
+ const XObjectGuard test(
+ executionContext.getXObjectFactory(),
+ theXPath->execute(sourceNode, *this, executionContext));
+ assert(test.get() != 0);
if(0 != executionContext.getTraceListeners())
{
@@ -142,7 +142,7 @@
*when,
XalanDOMString(XALAN_STATIC_UCODE_STRING("test")),
*theXPath,
- test));
+ test.get()));
}
if(test->boolean() == true)
1.6 +7 -1 xml-xalan/c/src/XSLT/ElemCopy.cpp
Index: ElemCopy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemCopy.cpp 2000/05/26 19:25:35 1.5
+++ ElemCopy.cpp 2000/07/06 20:19:24 1.6
@@ -164,7 +164,13 @@
sourceNode,
mode,
*this));
- }
+ }
+
+ ElemUse::execute(
+ executionContext,
+ sourceTree,
+ sourceNode,
+ mode);
executeChildren(executionContext, sourceTree, sourceNode, mode);
}
1.6 +12 -10 xml-xalan/c/src/XSLT/ElemCopyOf.cpp
Index: ElemCopyOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemCopyOf.cpp 2000/05/24 19:38:47 1.5
+++ ElemCopyOf.cpp 2000/07/06 20:19:24 1.6
@@ -62,8 +62,9 @@
-#include <XPath/XPath.hpp>
#include <XPath/XObject.hpp>
+#include <XPath/XObjectFactory.hpp>
+#include <XPath/XPath.hpp>
@@ -122,18 +123,19 @@
assert(m_pSelectPattern != 0);
- const XObject* const pValue =
- m_pSelectPattern->execute(sourceNode, *this, executionContext);
- assert(pValue != 0);
+ const XObjectGuard value(
+ executionContext.getXObjectFactory(),
+ m_pSelectPattern->execute(sourceNode, *this, executionContext));
+ assert(value.get() != 0);
if(0 != executionContext.getTraceListeners())
{
executionContext.fireSelectEvent(
SelectionEvent(executionContext, sourceNode,
- *this, XalanDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_pSelectPattern, pValue));
+ *this, XalanDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_pSelectPattern, value.get()));
}
- const int type = pValue->getType();
+ const int type = value->getType();
XalanDOMString s;
@@ -142,13 +144,13 @@
case XObject::eTypeBoolean:
case XObject::eTypeNumber:
case XObject::eTypeString:
- s = pValue->str();
+ s = value->str();
executionContext.characters(toCharArray(s), 0, length(s));
break;
case XObject::eTypeNodeSet:
{
- const NodeRefListBase& nl = pValue->nodeset();
+ const NodeRefListBase& nl = value->nodeset();
unsigned int nChildren = nl.getLength();
@@ -209,11 +211,11 @@
}
case XObject::eTypeResultTreeFrag:
- executionContext.outputResultTreeFragment(*pValue);
+ executionContext.outputResultTreeFragment(*value.get());
break;
default:
- s = pValue->str();
+ s = value->str();
if (!isEmpty(s))
{
1.7 +6 -3 xml-xalan/c/src/XSLT/ElemIf.cpp
Index: ElemIf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemIf.cpp 2000/05/24 19:38:48 1.6
+++ ElemIf.cpp 2000/07/06 20:19:24 1.7
@@ -66,6 +66,7 @@
+#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
@@ -140,8 +141,10 @@
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- const XObject* const test =
- m_test->execute(sourceNode, *this, executionContext);
+ const XObjectGuard test(
+ executionContext.getXObjectFactory(),
+ m_test->execute(sourceNode, *this, executionContext));
+ assert(test.get() != 0);
if(0 != executionContext.getTraceListeners())
{
@@ -151,7 +154,7 @@
*this,
XALAN_STATIC_UCODE_STRING("test"),
*m_test,
- test));
+ test.get()));
}
if(test->boolean())
1.14 +10 -4 xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
Index: ElemLiteralResult.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ElemLiteralResult.cpp 2000/06/23 14:30:14 1.13
+++ ElemLiteralResult.cpp 2000/07/06 20:19:24 1.14
@@ -97,8 +97,7 @@
name,
lineNumber,
columnNumber,
- xslToken),
- m_QName(name)
+ xslToken)
{
const unsigned int nAttrs = atts.getLength();
@@ -194,7 +193,7 @@
XalanNode* sourceNode,
const QName& mode) const
{
- executionContext.startElement(toCharArray(m_QName));
+ executionContext.startElement(toCharArray(getElementName()));
ElemUse::execute(executionContext, sourceTree, sourceNode, mode);
@@ -248,6 +247,13 @@
XalanDOMString srcURI = ns.getURI();
+ const XalanDOMString alias = getStylesheet().getAliasNamespaceURI(srcURI);
+
+ if (length(alias) != 0)
+ {
+ srcURI = alias;
+ }
+
bool isXSLNS = equals(srcURI, executionContext.getXSLNameSpaceURL())
|| 0 != getStylesheet().lookupExtensionNSHandler(srcURI)
|| equalsIgnoreCase(srcURI,executionContext.getXalanXSLNameSpaceURL());
@@ -292,7 +298,7 @@
executeChildren(executionContext, sourceTree, sourceNode, mode);
- executionContext.endElement(toCharArray(m_QName));
+ executionContext.endElement(toCharArray(getElementName()));
}
1.8 +2 -5 xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
Index: ElemLiteralResult.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemLiteralResult.hpp 2000/05/24 19:38:48 1.7
+++ ElemLiteralResult.hpp 2000/07/06 20:19:24 1.8
@@ -126,7 +126,7 @@
#if defined(XALAN_NO_NAMESPACES)
typedef vector<const AVT*> AVTVectorType;
typedef vector<XalanDOMString> ExtensionElementPrefixesVectorType;
- typedef map<DOMString, DOMString> String2StringMapType;
+ typedef map<DOMString, DOMString> String2StringMapType;
#else
typedef std::vector<const AVT*> AVTVectorType;
typedef std::vector<XalanDOMString> ExtensionElementPrefixesVectorType;
@@ -138,9 +138,7 @@
*/
AVTVectorType m_avts;
- XalanDOMString m_QName;
-
ExtensionElementPrefixesVectorType m_extensionElementPrefixes;
/**
@@ -148,7 +146,7 @@
* really needed only at construction time, and so should probably go
* somewhere else.
*/
- String2StringMapType m_excludeResultPrefixes;
+ String2StringMapType m_excludeResultPrefixes;
/**
* Process the exclude-result-prefixes or the extension-element-prefixes
@@ -158,7 +156,6 @@
ElemLiteralResult::processPrefixControl(
const DOMString& localName,
const DOMString& attrValue);
-
};
1.18 +97 -45 xml-xalan/c/src/XSLT/ElemNumber.cpp
Index: ElemNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ElemNumber.cpp 2000/05/18 18:38:38 1.17
+++ ElemNumber.cpp 2000/07/06 20:19:24 1.18
@@ -72,6 +72,7 @@
#include <XPath/XPath.hpp>
+#include <XPath/XObjectFactory.hpp>
@@ -323,54 +324,53 @@
-const XPath*
+XPath*
ElemNumber::getCountMatchPattern(
StylesheetExecutionContext& executionContext,
XalanNode* contextNode) const
{
- const XPath* countMatchPattern = m_countMatchPattern;
- if(0 == countMatchPattern)
+ XPath* countMatchPattern = 0;
+
+ switch(contextNode->getNodeType())
{
- switch(contextNode->getNodeType())
- {
- case XalanNode::ELEMENT_NODE:
- countMatchPattern =
+ case XalanNode::ELEMENT_NODE:
+ countMatchPattern =
executionContext.createMatchPattern(contextNode->getNodeName(), *this);
- break;
+ break;
- case XalanNode::ATTRIBUTE_NODE:
- countMatchPattern = executionContext.createMatchPattern(
+ case XalanNode::ATTRIBUTE_NODE:
+ countMatchPattern = executionContext.createMatchPattern(
XalanDOMString(XALAN_STATIC_UCODE_STRING("@")) + contextNode->getNodeName(),
*this);
- break;
+ break;
- case XalanNode::CDATA_SECTION_NODE:
- case XalanNode::TEXT_NODE:
- countMatchPattern = executionContext.createMatchPattern(
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(
XalanDOMString(XALAN_STATIC_UCODE_STRING("text()")), *this);
- break;
+ break;
- case XalanNode::COMMENT_NODE:
- countMatchPattern = executionContext.createMatchPattern(
+ case XalanNode::COMMENT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(
XalanDOMString(XALAN_STATIC_UCODE_STRING("comment()")), *this);
- break;
+ break;
- case XalanNode::DOCUMENT_NODE:
- countMatchPattern = executionContext.createMatchPattern(
+ case XalanNode::DOCUMENT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(
XalanDOMString(XALAN_STATIC_UCODE_STRING("/")), *this);
- break;
+ break;
- case XalanNode::PROCESSING_INSTRUCTION_NODE:
- countMatchPattern = executionContext.createMatchPattern(
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
+ countMatchPattern = executionContext.createMatchPattern(
XalanDOMString(XALAN_STATIC_UCODE_STRING("pi(")) +
contextNode->getNodeName() +
XalanDOMString(XALAN_STATIC_UCODE_STRING(")")), *this);
- break;
+ break;
- default:
- break;
- }
+ default:
+ break;
}
+
return countMatchPattern;
}
@@ -388,10 +388,10 @@
if(0 != m_valueExpr)
{
- const XObject* const countObj =
- m_valueExpr->execute(sourceNode,
- *this,
- executionContext);
+ const XObjectGuard countObj(
+ executionContext.getXObjectFactory(),
+ m_valueExpr->execute(sourceNode, *this, executionContext));
+ assert(countObj.get() != 0);
numberList.push_back(static_cast<int>(countObj->num()));
}
@@ -415,7 +415,7 @@
{
for(unsigned int i = 0; i < lastIndex; i++)
{
- XalanNode* const target = ancestors.item(lastIndex - i -1);
+ XalanNode* const target = ancestors.item(lastIndex - i - 1);
numberList.push_back(ctable.countNode(
executionContext,
this,
@@ -432,8 +432,22 @@
ElemNumber::getPreviousNode(
StylesheetExecutionContext& executionContext,
XalanNode* pos) const
-{
- const XPath* countMatchPattern = getCountMatchPattern(executionContext, pos);
+{
+ // Create an XPathGuard, since we may need to
+ // create a new XPath...
+ StylesheetExecutionContext::XPathGuard xpathGuard(
+ executionContext);
+
+ const XPath* countMatchPattern = m_countMatchPattern;
+
+ if (countMatchPattern == 0)
+ {
+ // Get the XPath...
+ xpathGuard.reset(getCountMatchPattern(executionContext, pos));
+
+ countMatchPattern = xpathGuard.get();
+ }
+
if(Constants::NUMBERLEVEL_ANY == m_level)
{
const XPath* fromMatchPattern = m_fromMatchPattern;
@@ -506,18 +520,41 @@
XalanNode* sourceNode) const
{
XalanNode* target = 0;
- const XPath* countMatchPattern =
- getCountMatchPattern(executionContext, sourceNode);
+
+ // Create an XPathGuard, since we may need to
+ // create a new XPath...
+ StylesheetExecutionContext::XPathGuard xpathGuard(
+ executionContext);
+
+ const XPath* countMatchPattern = m_countMatchPattern;
+
+ if (countMatchPattern == 0)
+ {
+ // Get the XPath...
+ xpathGuard.reset(getCountMatchPattern(executionContext, sourceNode));
+
+ countMatchPattern = xpathGuard.get();
+ }
+
if(Constants::NUMBERLEVEL_ANY == m_level)
{
- target = findPrecedingOrAncestorOrSelf(executionContext,
- m_fromMatchPattern, countMatchPattern, sourceNode, this);
+ target = findPrecedingOrAncestorOrSelf(
+ executionContext,
+ m_fromMatchPattern,
+ countMatchPattern,
+ sourceNode,
+ this);
}
else
{
- target = findAncestor(executionContext, m_fromMatchPattern,
- countMatchPattern, sourceNode, this);
+ target = findAncestor(
+ executionContext,
+ m_fromMatchPattern,
+ countMatchPattern,
+ sourceNode,
+ this);
}
+
return target;
}
@@ -537,13 +574,28 @@
bool stopAtFirstFound) const
{
MutableNodeRefList ancestors;
- const XPath* countMatchPattern = getCountMatchPattern(executionContext, node);
+
+ // Create an XPathGuard, since we may need to
+ // create a new XPath...
+ StylesheetExecutionContext::XPathGuard xpathGuard(
+ executionContext);
+
+ const XPath* countMatchPattern = m_countMatchPattern;
+
+ if (countMatchPattern == 0)
+ {
+ // Get the XPath...
+ xpathGuard.reset(getCountMatchPattern(executionContext, node));
+
+ countMatchPattern = xpathGuard.get();
+ }
+
while( 0 != node )
{
if((0 != m_fromMatchPattern) &&
(m_fromMatchPattern->getMatchScore(node, *this, executionContext) !=
XPath::s_MatchScoreNone))
- {
+ {
// The following if statement gives level="single" different
// behavior from level="multiple", which seems incorrect according
// to the XSLT spec. For now we are leaving this in to replicate
@@ -552,7 +604,7 @@
// that we still don't understand.
if(!stopAtFirstFound)
break;
- }
+ }
if(0 == countMatchPattern)
error(XalanDOMString("Programmers error! countMatchPattern should never be 0!"));
@@ -899,7 +951,7 @@
// Make this match the conformance test
else if(val == 0)
{
- return XalanDOMString("0");
+ return XalanDOMString(XALAN_STATIC_UCODE_STRING("0"));
}
@@ -1040,7 +1092,7 @@
{
const int n = blist.getLength();
- for(int i = (n-1); i >= 0; i--)
+ for(int i = n - 1; i >= 0; i--)
{
flist.addNode(blist.item(i));
}
1.14 +2 -2 xml-xalan/c/src/XSLT/ElemNumber.hpp
Index: ElemNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ElemNumber.hpp 2000/05/08 17:29:34 1.13
+++ ElemNumber.hpp 2000/07/06 20:19:25 1.14
@@ -58,7 +58,7 @@
#define XALAN_ELEMNUMBER_HEADER_GUARD
/**
- * $Id: ElemNumber.hpp,v 1.13 2000/05/08 17:29:34 dbertoni Exp $
+ * $Id: ElemNumber.hpp,v 1.14 2000/07/06 20:19:25 dbertoni Exp $
*
* $State: Exp $
*
@@ -186,7 +186,7 @@
/**
* Get the count match pattern, or a default value.
*/
- const XPath*
+ XPath*
getCountMatchPattern(
StylesheetExecutionContext& executionContext,
XalanNode* contextNode) const;
1.5 +4 -0 xml-xalan/c/src/XSLT/ElemParam.cpp
Index: ElemParam.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemParam.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemParam.cpp 2000/05/24 19:38:48 1.4
+++ ElemParam.cpp 2000/07/06 20:19:25 1.5
@@ -58,6 +58,10 @@
+#include <XPath/XObjectFactory.hpp>
+
+
+
#include "Constants.hpp"
#include "Stylesheet.hpp"
#include "StylesheetExecutionContext.hpp"
1.25 +14 -8 xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
Index: ElemTemplateElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ElemTemplateElement.cpp 2000/06/08 17:54:22 1.24
+++ ElemTemplateElement.cpp 2000/07/06 20:19:25 1.25
@@ -87,6 +87,7 @@
#include <XPath/MutableNodeRefList.hpp>
+#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
@@ -316,7 +317,7 @@
for (ElemTemplateElement* node = m_firstChild; node != 0; node = node->m_nextSibling)
{
- node->execute(executionContext, sourceTree, sourceNode, mode);
+ node->execute(executionContext, sourceTree, sourceNode, mode);
}
}
@@ -593,7 +594,10 @@
{
const ElemForEach* foreach = static_cast<const ElemForEach *>(&xslInstruction);
const unsigned int nChildren = foreach->getSortElems().size();
-
+
+ // Reserve the space now...
+ keys.reserve(nChildren);
+
// March backwards, performing a sort on each xsl:sort child.
// Probably not the most efficient method.
for(unsigned int i = 0; i < nChildren; i++)
@@ -659,13 +663,15 @@
savedCurrentStackFrameIndex) : null;
*/
- XObject* const result = selectPattern->execute(
- sourceNodeContext,
- xslInstruction,
- executionContext);
+ const XObjectGuard result(
+ executionContext.getXObjectFactory(),
+ selectPattern->execute(
+ sourceNodeContext,
+ xslInstruction,
+ executionContext));
// @@ JMD: Should this be an assert ??
- if (0 != result)
+ if (0 != result.get())
{
sourceNodes = result->mutableNodeset();
@@ -677,7 +683,7 @@
*this,
XALAN_STATIC_UCODE_STRING("select"),
*selectPattern,
- result));
+ result.get()));
}
}
}
1.9 +5 -6 xml-xalan/c/src/XSLT/ElemValueOf.cpp
Index: ElemValueOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemValueOf.cpp 2000/05/26 19:25:36 1.8
+++ ElemValueOf.cpp 2000/07/06 20:19:25 1.9
@@ -192,10 +192,9 @@
}
else
{
- const XObject* const value =
- m_selectPattern->execute(sourceNode,
- *this,
- executionContext);
+ const XObjectGuard value(
+ executionContext.getXObjectFactory(),
+ m_selectPattern->execute(sourceNode, *this, executionContext));
if(0 != executionContext.getTraceListeners())
{
@@ -205,10 +204,10 @@
*this,
XalanDOMString(XALAN_STATIC_UCODE_STRING("select")),
*m_selectPattern,
- value));
+ value.get()));
}
- if(0 != value)
+ if(0 != value.get())
{
const XObject::eObjectType type = value->getType();
1.8 +76 -14 xml-xalan/c/src/XSLT/NodeSorter.cpp
Index: NodeSorter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NodeSorter.cpp 2000/07/01 21:56:18 1.7
+++ NodeSorter.cpp 2000/07/06 20:19:25 1.8
@@ -69,9 +69,10 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/DoubleSupport.hpp>
+#include <DOMSupport/DOMServices.hpp>
-
+#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
@@ -92,6 +93,7 @@
void
NodeSorter::sort(
+ const MutableNodeRefList& theList,
NodeVectorType& v,
const NodeSortKeyVectorType& keys)
{
@@ -102,6 +104,7 @@
m_keys = keys;
NodeSortKeyCompare theComparer(m_executionContext,
+ theList,
v,
keys);
@@ -133,11 +136,15 @@
theNodes.push_back(theList.item(i));
}
- sort(theNodes,
- keys);
+ // Do the sort...
+ sort(
+ theList,
+ theNodes,
+ keys);
assert(theNodes.size() ==
static_cast<NodeVectorType::size_type>(theLength));
+ // Copy the nodes back to the list in sorted order.
theList.clear();
for (i = 0; i < theLength; ++i)
@@ -156,15 +163,21 @@
second_argument_type theRHS,
unsigned int theKeyIndex) const
{
- assert(theKeyIndex < UINT_MAX);
result_type theResult = false;
const NodeSortKey& theKey = m_nodeSortKeys[theKeyIndex];
const XPath& xpath = theKey.getSelectPattern();
- XObject* r1 = xpath.execute(theLHS, theKey.getPrefixResolver(), NodeRefList(), m_executionContext);
- XObject* r2 = xpath.execute(theRHS, theKey.getPrefixResolver(), NodeRefList(), m_executionContext);
+ const XObjectGuard r1(
+ m_executionContext.getXObjectFactory(),
+ xpath.execute(theLHS, theKey.getPrefixResolver(), NodeRefList(), m_executionContext));
+ assert(r1.get() != 0);
+
+ const XObjectGuard r2(
+ m_executionContext.getXObjectFactory(),
+ xpath.execute(theRHS, theKey.getPrefixResolver(), NodeRefList(), m_executionContext));
+ assert(r2.get() != 0);
// Compare as numbers
if(theKey.getTreatAsNumbers() == true)
@@ -172,6 +185,9 @@
double n1Num = r1->num();
double n2Num = r2->num();
+ const XalanDOMString r1str(r1->str());
+ const XalanDOMString r2str(r2->str());
+
if (DoubleSupport::isNaN(n1Num))
n1Num = 0.0;
@@ -187,11 +203,19 @@
{
const double diff = n1Num - n2Num;
- theResult = diff <= 0.0 ? true : false;
-
- if (theKey.getDescending() == true)
+ if (diff == 0.0)
+ {
+ // The nodes are equal, so if theLHS is
+ // before theRHS, return true.
+ theResult = isNodeBefore(theLHS, theRHS);
+ }
+ else if (theKey.getDescending() == true)
+ {
+ theResult = diff < 0.0 ? false : true;
+ }
+ else
{
- theResult = !theResult;
+ theResult = diff < 0.0 ? true : false;
}
}
}
@@ -209,12 +233,50 @@
}
else
{
- theResult = theCompareResult <= 0 ? true : false;
-
- if (theKey.getDescending() == true)
+ if (theCompareResult == 0)
+ {
+ // The nodes are equal, so if theLHS is
+ // before theRHS, return true.
+ theResult = isNodeBefore(theLHS, theRHS);
+ }
+ else if (theKey.getDescending() == true)
{
- theResult = !theResult;
+ theResult = theCompareResult < 0 ? false : true;
}
+ else
+ {
+ theResult = theCompareResult < 0 ? true : false;
+ }
+ }
+ }
+
+ return theResult;
+}
+
+
+
+bool
+NodeSorter::NodeSortKeyCompare::isNodeBefore(
+ const XalanNode* node1,
+ const XalanNode* node2) const
+{
+ bool theResult = true;
+
+ const unsigned int theLength = m_list.getLength();
+
+ for(unsigned int i = 0; i < theLength; ++i)
+ {
+ const XalanNode* const theCurrentNode = m_list.item(i);
+
+ if (theCurrentNode == node1)
+ {
+ break;
+ }
+ else if (theCurrentNode == node2)
+ {
+ theResult = false;
+
+ break;
}
}
1.5 +35 -24 xml-xalan/c/src/XSLT/NodeSorter.hpp
Index: NodeSorter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeSorter.hpp 2000/04/11 15:09:28 1.4
+++ NodeSorter.hpp 2000/07/06 20:19:25 1.5
@@ -112,22 +112,10 @@
~NodeSorter();
/**
- * Given a vector of nodes, sort each node according to the criteria in the
- * keys.
+ * Given a list of nodes, sort each node according to the criteria in the
+ * keys. The list is assumed to be in document order.
*
- * @param v vector of Nodes
- * @param keys vector of NodeSortKeys
- */
- void
- sort(
- NodeVectorType& v,
- const NodeSortKeyVectorType& keys);
-
- /**
- * Given a vector of nodes, sort each node according to the criteria in the
- * keys.
- *
- * @param v vector of Nodes
+ * @param v list of Nodes
* @param keys vector of NodeSortKeys
*/
void
@@ -158,10 +146,13 @@
* @param theNodes vector or nodes to be sorted
* @param theNodeSortKeys vector of keys upon which to sort
*/
- NodeSortKeyCompare(XPathExecutionContext& executionContext,
- const NodeVectorType& theNodes,
- const NodeSortKeyVectorType& theNodeSortKeys) :
+ NodeSortKeyCompare(
+ XPathExecutionContext& executionContext,
+ const MutableNodeRefList& theList,
+ const NodeVectorType& theNodes,
+ const NodeSortKeyVectorType& theNodeSortKeys) :
m_executionContext(executionContext),
+ m_list(theList),
m_nodes(theNodes),
m_nodeSortKeys(theNodeSortKeys)
{
@@ -180,21 +171,41 @@
unsigned int theKeyIndex = 0) const;
XPathExecutionContext& m_executionContext;
+ const MutableNodeRefList& m_list;
const NodeVectorType& m_nodes;
const NodeSortKeyVectorType& m_nodeSortKeys;
+
+ bool
+ isNodeBefore(
+ const XalanNode* node1,
+ const XalanNode* node2) const;
};
private:
+ /**
+ * Given a vector of nodes, sort each node according to the criteria in the
+ * keys.
+ *
+ * @param theList the original node list.
+ * @param v vector of Nodes
+ * @param keys vector of NodeSortKeys
+ */
+ void
+ sort(
+ const MutableNodeRefList& theList,
+ NodeVectorType& v,
+ const NodeSortKeyVectorType& keys);
+
XPathExecutionContext& m_executionContext;
NodeSortKeyVectorType m_keys; // vector of NodeSortKeys
- /**
- * @@ TODO: Adjust this for locale.
- * JMD: java: not used yet, placeholder
- */
- // NumberFormat m_formatter = NumberFormat.getNumberInstance();
-
+
+ /**
+ * @@ TODO: Adjust this for locale.
+ * JMD: java: not used yet, placeholder
+ */
+ // NumberFormat m_formatter = NumberFormat.getNumberInstance();
};
1.23 +111 -14 xml-xalan/c/src/XSLT/Stylesheet.cpp
Index: Stylesheet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Stylesheet.cpp 2000/06/08 18:40:01 1.22
+++ Stylesheet.cpp 2000/07/06 20:19:25 1.23
@@ -145,7 +145,8 @@
m_attributeSets(),
m_surrogateChildren(*this),
m_fakeAttributes(),
- m_elemDecimalFormats()
+ m_elemDecimalFormats(),
+ m_prefixAliases()
{
if (length(m_baseIdent) != 0)
{
@@ -295,12 +296,17 @@
NamespaceVectorType namespaces;
+ // Reserve the maximum space. Any extra will not
+ // be copied to m_namespaces, since we're pushing
+ // a copy.
+ namespaces.reserve(nAttrs);
+
for(unsigned int i = 0; i < nAttrs; i++)
{
const XalanDOMChar* const aname = atts.getName(i);
const XalanDOMChar* const value = atts.getValue(i);
- bool isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
+ const bool isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
{
@@ -318,7 +324,8 @@
void
Stylesheet::popNamespaces()
{
- assert(m_namespaces.size());
+ assert(m_namespaces.empty() == false);
+
m_namespaces.pop_back();
}
@@ -331,11 +338,14 @@
int /* which */,
StylesheetConstructionContext& constructionContext) const
{
+ // Namespace declarations are OK by definition
bool attrOK = equals(attrName, DOMServices::s_XMLNamespace) ||
startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator);
if(!attrOK)
{
+ // Others are OK if their prefix has been
+ // bound to a non-null Namespace URI other than XSLT's
const unsigned int indexOfNSSep = indexOf(attrName, ':');
if(indexOfNSSep < length(attrName))
@@ -343,10 +353,12 @@
const XalanDOMString prefix = substring(attrName, 0, indexOfNSSep);
const XalanDOMString ns = getNamespaceForPrefixFromStack(prefix);
- attrOK = indexOf(ns, constructionContext.getXSLTNamespaceURI()) < length(ns);
+ attrOK = ! ::isEmpty(ns) && !equals(ns,constructionContext.getXSLTNamespaceURI());
}
else
- attrOK = true;
+ {
+ attrOK = false;
+ }
}
return attrOK;
@@ -1208,23 +1220,26 @@
{
const unsigned int nAttrs = atts.getLength();
- XalanDOMString stylesheetPrefix;
- XalanDOMString resultPrefix;
+ XalanDOMString stylesheetNamespace;
+ XalanDOMString resultNamespace;
+ XalanDOMString dummy;
for(unsigned int i = 0; i < nAttrs; i++)
{
const XalanDOMChar* const aname = atts.getName(i);
- XalanDOMString prefix;
-
if(equals(aname, Constants::ATTRNAME_STYLESHEET_PREFIX) == true)
{
const XalanDOMChar* const value = atts.getValue(i);
if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
+ {
+ stylesheetNamespace = getNamespaceForPrefix(dummy);
+ }
+ else
{
- stylesheetPrefix = getNamespaceForPrefix(value);
+ stylesheetNamespace = getNamespaceForPrefix(value);
}
}
else if(equals(aname, Constants::ATTRNAME_RESULT_PREFIX))
@@ -1233,8 +1248,12 @@
if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
{
- resultPrefix = getNamespaceForPrefix(value);
+ resultNamespace = getNamespaceForPrefix(dummy);
}
+ else
+ {
+ resultNamespace = getNamespaceForPrefix(value);
+ }
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
@@ -1244,9 +1263,26 @@
// Build a table of aliases, the key is the stylesheet uri and the
// value is the result uri
- if (length(stylesheetPrefix) != 0 && length(resultPrefix) != 0 )
+ if (length(stylesheetNamespace) != 0 &&
+ length(resultNamespace) != 0)
{
- // $$$ ToDo: Fix this!!!
+#if 1
+ // $$$ ToDo: Enable other code. Perhaps an error?
+ m_prefixAliases[stylesheetNamespace] = resultNamespace;
+#else
+ const PrefixAliasesMapType::iterator i =
+ m_prefixAliases.find(stylesheetNamespace);
+
+ if (i != m_prefixAliases.end())
+ {
+ // $$$ ToDo: This could also be an error?
+ i->second = resultNamespace;
+ }
+ else
+ {
+ m_prefixAliases.insert(PrefixAliasesMapType::value_type(stylesheetNamespace, resultNamespace));
+ }
+#endif
}
else
{
@@ -1256,6 +1292,67 @@
+XalanDOMString
+Stylesheet::getAliasNamespaceURI(const XalanDOMString& uri) const
+{
+ XalanDOMString result;
+
+ const PrefixAliasesMapType::const_iterator i =
+ m_prefixAliases.find(uri);
+
+ if (i != m_prefixAliases.end())
+ {
+ result = i->second;
+
+ assert(length(result) > 0);
+ }
+ else
+ {
+ const StylesheetVectorType::size_type nImports =
+ m_imports.size();
+
+ for(StylesheetVectorType::size_type i = 0; i < nImports; ++i)
+ {
+ result = m_imports[i]->getAliasNamespaceURI(uri);
+
+ if(length(result) != 0)
+ {
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
+
+
+const Stylesheet*
+Stylesheet::getPreviousImport(const Stylesheet* stylesheet) const
+{
+ const Stylesheet* previous = 0;
+
+ const StylesheetVectorType::size_type nImports =
+ m_imports.size();
+
+ for(StylesheetVectorType::size_type i = 0; i < nImports; ++i)
+ {
+ if (m_imports[i] == stylesheet)
+ {
+ if (i + 1 < nImports)
+ {
+ previous = m_imports[i + 1];
+
+ break;
+ }
+ }
+ }
+
+ return previous;
+}
+
+
+
void
Stylesheet::processDecimalFormatElement(
ElemDecimalFormat* elemDecimalFormat,
@@ -1324,7 +1421,7 @@
*/
void
Stylesheet::addAttributeSet(
- const QName& /*qname */,
+ const QName& /* qname */,
ElemAttributeSet* attrSet)
{
m_attributeSets.push_back(attrSet);
1.15 +24 -0 xml-xalan/c/src/XSLT/Stylesheet.hpp
Index: Stylesheet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Stylesheet.hpp 2000/06/08 18:40:01 1.14
+++ Stylesheet.hpp 2000/07/06 20:19:25 1.15
@@ -127,6 +127,7 @@
# define XALAN_STD std::
#endif
+typedef XALAN_STD map<XalanDOMString, XalanDOMString> PrefixAliasesMapType;
typedef XALAN_STD map<XalanDOMString, ExtensionNSHandler*> ExtensionNamespacesMapType;
typedef XALAN_STD map<QName, ElemTemplateElement*> ElemTemplateElementMapType;
typedef XALAN_STD vector<Arg> ParamVectorType;
@@ -310,6 +311,27 @@
getNamespaceForPrefixFromStack(const XalanDOMString& prefix) const;
/**
+ * See if there is a namespace alias.
+ *
+ * @param uri the URI of the namespace.
+ * @return the alias URI, if found.
+ */
+ XalanDOMString
+ getAliasNamespaceURI(const XalanDOMString& uri) const;
+
+ /**
+ * This recursive function is called starting from the
+ * stylesheet root, and tries to find a match for the
+ * passed stylesheet, and then will return the previous
+ * sibling, or 0 if there was no previous sibling.
+ *
+ * @param stylesheet the stylesheet to search
+ * @return the stylesheet's previous import if found, or 0 not found.
+ */
+ const Stylesheet*
+ getPreviousImport(const Stylesheet* stylesheet) const;
+
+ /**
* Add a template to the list of names templates
*
* @param tmpl template to add
@@ -1249,6 +1271,8 @@
XalanEmptyNamedNodeMap m_fakeAttributes;
ElemDecimalFormatVectorType m_elemDecimalFormats;
+
+ PrefixAliasesMapType m_prefixAliases;
};
1.20 +63 -0 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- StylesheetExecutionContext.hpp 2000/06/01 16:28:36 1.19
+++ StylesheetExecutionContext.hpp 2000/07/06 20:19:25 1.20
@@ -636,6 +636,69 @@
const PrefixResolver& resolver) = 0;
/**
+ * Return the XPath created by createMatchPattern().
+ *
+ * @param xpath The XPath to return.
+ */
+ virtual void
+ returnXPath(XPath* xpath) = 0;
+
+ // A helper class to automatically return an XPath instance.
+ class XPathGuard
+ {
+ public:
+
+ XPathGuard(
+ StylesheetExecutionContext& context,
+ XPath* xpath = 0) :
+ m_context(context),
+ m_xpath(xpath)
+ {
+ }
+
+ ~XPathGuard()
+ {
+ if (m_xpath != 0)
+ {
+ m_context.returnXPath(m_xpath);
+ }
+ }
+
+ XPath*
+ get() const
+ {
+ return m_xpath;
+ }
+
+ XPath*
+ release()
+ {
+ XPath* const temp = m_xpath;
+
+ m_xpath = 0;
+
+ return temp;
+ }
+
+ void
+ reset(XPath* xpath)
+ {
+ if (m_xpath != 0)
+ {
+ m_context.returnXPath(m_xpath);
+ }
+
+ m_xpath = xpath;
+ }
+
+ private:
+
+ StylesheetExecutionContext& m_context;
+
+ XPath* m_xpath;
+ };
+
+ /**
* Evaluate the value of an attribute within the context of a specified
* context node and namespace
*
1.19 +8 -0 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StylesheetExecutionContextDefault.cpp 2000/06/25 17:17:56 1.18
+++ StylesheetExecutionContextDefault.cpp 2000/07/06 20:19:25 1.19
@@ -464,6 +464,14 @@
+void
+StylesheetExecutionContextDefault::returnXPath(XPath* xpath)
+{
+ m_xsltProcessor.returnXPath(xpath);
+}
+
+
+
const XalanDOMString
StylesheetExecutionContextDefault::evaluateAttrVal(
XalanNode* contextNode,
1.17 +3 -0 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- StylesheetExecutionContextDefault.hpp 2000/06/01 16:28:37 1.16
+++ StylesheetExecutionContextDefault.hpp 2000/07/06 20:19:25 1.17
@@ -220,6 +220,9 @@
const XalanDOMString& str,
const PrefixResolver& resolver);
+ virtual void
+ returnXPath(XPath* xpath);
+
virtual const XalanDOMString
evaluateAttrVal(
XalanNode* contextNode,
1.47 +32 -77 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- XSLTEngineImpl.cpp 2000/06/27 21:00:20 1.46
+++ XSLTEngineImpl.cpp 2000/07/06 20:19:25 1.47
@@ -807,7 +807,10 @@
NodeRefList(),
&theProxy);
- const XObject* xobj = evalXPathStr(ds, theExecutionContext);
+ const XObjectGuard xobj(
+ m_xobjectFactory,
+ evalXPathStr(ds, theExecutionContext));
+ assert(xobj.get() != 0);
const NodeRefListBase* nl = &xobj->nodeset();
@@ -821,7 +824,10 @@
theExecutionContext.setContextNodeList(theEmptyList);
- xobj = evalXPathStr(ds, theExecutionContext);
+ const XObjectGuard xobj(
+ m_xobjectFactory,
+ evalXPathStr(ds, theExecutionContext));
+ assert(xobj.get() != 0);
nl = &xobj->nodeset();
@@ -833,7 +839,10 @@
theExecutionContext.setContextNodeList(theEmptyList);
- xobj = evalXPathStr(ds, theExecutionContext);
+ const XObjectGuard xobj(
+ m_xobjectFactory,
+ evalXPathStr(ds, theExecutionContext));
+ assert(xobj.get() != 0);
nl = &xobj->nodeset();
@@ -842,7 +851,10 @@
// Well, hell, maybe it's an XPath...
theExecutionContext.setContextNodeList(theEmptyList);
- xobj = evalXPathStr(fragID, theExecutionContext);
+ const XObjectGuard xobj(
+ m_xobjectFactory,
+ evalXPathStr(fragID, theExecutionContext));
+ assert(xobj.get() != 0);
nl = &xobj->nodeset();
}
@@ -2478,74 +2490,8 @@
-// $$$ ToDo: This really should not be here...
-XPath*
-XSLTEngineImpl::createProcessingXPath(
- const XalanDOMString& str,
- XPathExecutionContext& executionContext,
- const PrefixResolver& resolver)
-{
- XPath* const xpath = m_xpathFactory.create();
-
- m_xpathProcessor->initXPath(*xpath,
- str,
- resolver,
- executionContext.getXObjectFactory(),
- m_xpathEnvSupport);
-
- return xpath;
-}
-
-
/**
- * Evaluate an xpath string and return the result.
- */
-XPath*
-XSLTEngineImpl::createXPath(
- const XalanDOMString& str,
- const PrefixResolver& resolver)
-{
- XPath* const xpath = m_xpathFactory.create();
-
- m_xpathProcessor->initXPath(*xpath,
- str,
- resolver,
- m_xobjectFactory,
- m_xpathEnvSupport);
-
- return xpath;
-}
-
-/**
- * Evaluate an xpath string and return the result.
- */
-double
-XSLTEngineImpl::evalMatchPatternStr(
- const XalanDOMString& str,
- XalanNode* context,
- XPathExecutionContext& executionContext)
-{
- FactoryObjectAutoPointer<XPath> theXPath(&m_xpathFactory,
- m_xpathFactory.create());
-
- const PrefixResolver* const theResolver =
- executionContext.getPrefixResolver();
- assert(theResolver != 0);
-
- // This needs to use a factory method of some sort.
- m_xpathProcessor->initMatchPattern(*theXPath.get(),
- str,
- *theResolver,
- executionContext.getXObjectFactory(),
- m_xpathEnvSupport);
-
- return theXPath->getMatchScore(context, *theResolver, executionContext);
-}
-
-
-
-/**
* Create and initialize an xpath and return it.
*/
XPath*
@@ -2562,14 +2508,10 @@
-XPath* XSLTEngineImpl::getExpression(
- const AttributeList& attrs,
- const XalanDOMString& key,
- const PrefixResolver& resolver)
+void
+XSLTEngineImpl::returnXPath(XPath* xpath)
{
- const XMLCh* const val = attrs.getValue(c_wstr(key));
-
- return 0 != val ? createXPath(XalanDOMString(val), resolver) : 0;
+ m_xpathFactory.returnObject(xpath);
}
@@ -3682,6 +3624,8 @@
m_globalStackFrameIndex(-1),
m_currentStackFrameIndex(0)
{
+ m_stack.reserve(eDefaultVectorSize);
+
pushContextMarker(0, 0);
}
@@ -3709,6 +3653,17 @@
DeleteFunctor<StackEntry>());
m_stackEntries.clear();
+
+ // If the stack has grown past the default size,
+ // shrink it down...
+ if (m_stack.capacity() > eDefaultVectorSize)
+ {
+ VariableStackStackType temp;
+
+ temp.reserve(eDefaultVectorSize);
+
+ m_stack.swap(temp);
+ }
pushContextMarker(0, 0);
}
1.37 +15 -39 xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- XSLTEngineImpl.hpp 2000/06/27 21:00:21 1.36
+++ XSLTEngineImpl.hpp 2000/07/06 20:19:25 1.37
@@ -898,6 +898,15 @@
const PrefixResolver& resolver);
/**
+ * Return the xpath created by createXPath() or
+ * createMatchPattern().
+ *
+ * @param xpath The XPath to return.
+ */
+ void
+ returnXPath(XPath* xpath);
+
+ /**
* Copy XMLNS: attributes in if not already in scope.
*
* @param src source node
@@ -953,22 +962,6 @@
XPathExecutionContext& executionContext);
/**
- * Create an XPath whose lifetime can end after transforming
- * is complete. Do not use this to create an XPath to be
- * held by a stylesheet.
- *
- * @param str string to evaluate
- * @param executionContext current execution context
- * @param resolver resolver for namespace resolution
- * @return pointer to XPath created
- */
- virtual XPath*
- createProcessingXPath(
- const XalanDOMString& str,
- XPathExecutionContext& executionContext,
- const PrefixResolver& resolver);
-
- /**
* Given a valid element id, return the corresponding element.
*
* @param id string representing ID
@@ -1034,20 +1027,6 @@
}
/**
- * Get an Expression object from a select node. Does not cache!
- *
- * @param attrs attribute list to search
- * @param key key value to search for
- * @param resolver resolver for namespace resolution
- * @return pointer to XPath for expression
- */
- XPath*
- getExpression(
- const AttributeList& attrs,
- const XalanDOMString& key,
- const PrefixResolver& resolver);
-
- /**
* Given an element, return an attribute value in the form of a string.
*
* @param el element from where to get the attribute
@@ -1590,6 +1569,12 @@
private:
+ // Default stack vector allocation size.
+ enum
+ {
+ eDefaultVectorSize = 200
+ };
+
XObject*
findXObject(
const QName& name,
@@ -2016,15 +2001,6 @@
*/
void
translateCSSAttrsToStyleAttr(AttributeListImpl& attList);
-
- // $$$ ToDo: This must go!!!!!!
- /**
- * Evaluate an xpath string and return the result.
- */
- virtual XPath*
- createXPath(
- const XalanDOMString& str,
- const PrefixResolver& resolver);
/**
* Given a name, locate a variable in the current context, and return