You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/04/20 18:47:38 UTC
cvs commit: xml-xalan/c/src/XSLT ElemAttribute.cpp ElemChoose.cpp ElemCopyOf.cpp ElemElement.cpp ElemIf.cpp ElemLiteralResult.cpp ElemNumber.cpp ElemTemplateElement.cpp ElemValueOf.cpp ElemVariable.cpp Stylesheet.cpp StylesheetExecutionContext.cpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp StylesheetHandler.cpp StylesheetHandler.hpp StylesheetRoot.cpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp XSLTProcessor.hpp
dbertoni 00/04/20 09:47:38
Modified: c/src/XSLT ElemAttribute.cpp ElemChoose.cpp ElemCopyOf.cpp
ElemElement.cpp ElemIf.cpp ElemLiteralResult.cpp
ElemNumber.cpp ElemTemplateElement.cpp
ElemValueOf.cpp ElemVariable.cpp Stylesheet.cpp
StylesheetExecutionContext.cpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
StylesheetHandler.cpp StylesheetHandler.hpp
StylesheetRoot.cpp XSLTEngineImpl.cpp
XSLTEngineImpl.hpp XSLTProcessor.hpp
Log:
Changes for XSLTProcessor API, namespace problems, cast problems, and new StylesheetExecutionContext derivation.
Revision Changes Path
1.6 +2 -4 xml-xalan/c/src/XSLT/ElemAttribute.cpp
Index: ElemAttribute.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemAttribute.cpp 2000/04/18 15:30:44 1.5
+++ ElemAttribute.cpp 2000/04/20 16:47:34 1.6
@@ -147,8 +147,7 @@
XalanDOMString attrName;
- m_pNameAVT->evaluate(attrName, sourceNode, *this,
- executionContext.getXPathExecutionContext());
+ m_pNameAVT->evaluate(attrName, sourceNode, *this, executionContext);
if(!isEmpty(attrName))
{
@@ -162,8 +161,7 @@
if(0 != m_pNamespaceAVT)
{
- m_pNamespaceAVT->evaluate(attrNameSpace, sourceNode,
- *this, executionContext.getXPathExecutionContext());
+ m_pNamespaceAVT->evaluate(attrNameSpace, sourceNode, *this, executionContext);
if(!isEmpty(attrNameSpace))
{
1.4 +1 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemChoose.cpp 2000/04/11 15:09:23 1.3
+++ ElemChoose.cpp 2000/04/20 16:47:34 1.4
@@ -131,7 +131,7 @@
const XObject* const test =
theXPath ->execute(sourceNode,
*this,
- executionContext.getXPathExecutionContext());
+ executionContext);
assert(test != 0);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
1.4 +1 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCopyOf.cpp 2000/04/11 15:09:23 1.3
+++ ElemCopyOf.cpp 2000/04/20 16:47:34 1.4
@@ -123,7 +123,7 @@
assert(m_pSelectPattern != 0);
const XObject* const pValue =
- m_pSelectPattern->execute(sourceNode, *this, executionContext.getXPathExecutionContext());
+ m_pSelectPattern->execute(sourceNode, *this, executionContext);
assert(pValue != 0);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
1.5 +2 -3 xml-xalan/c/src/XSLT/ElemElement.cpp
Index: ElemElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemElement.cpp 2000/04/18 15:30:45 1.4
+++ ElemElement.cpp 2000/04/20 16:47:34 1.5
@@ -141,7 +141,7 @@
assert(m_nameAVT != 0);
- m_nameAVT->evaluate(elemName, sourceNode, *this, executionContext.getXPathExecutionContext());
+ m_nameAVT->evaluate(elemName, sourceNode, *this, executionContext);
if(!isEmpty(elemName))
{
@@ -149,8 +149,7 @@
{
XalanDOMString elemNameSpace;
- m_namespaceAVT->evaluate(elemNameSpace, sourceNode,
- *this, executionContext.getXPathExecutionContext());
+ m_namespaceAVT->evaluate(elemNameSpace, sourceNode, *this, executionContext);
if(!isEmpty(elemNameSpace))
{
1.5 +1 -1 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemIf.cpp 2000/04/12 19:40:58 1.4
+++ ElemIf.cpp 2000/04/20 16:47:34 1.5
@@ -141,7 +141,7 @@
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
const XObject* const test =
- m_test->execute(sourceNode, *this, executionContext.getXPathExecutionContext());
+ m_test->execute(sourceNode, *this, executionContext);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
1.10 +1 -2 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ElemLiteralResult.cpp 2000/04/18 15:30:46 1.9
+++ ElemLiteralResult.cpp 2000/04/20 16:47:34 1.10
@@ -188,8 +188,7 @@
XalanDOMString stringedValue;
- avt->evaluate(stringedValue, sourceNode, *this,
- executionContext.getXPathExecutionContext());
+ avt->evaluate(stringedValue, sourceNode, *this, executionContext);
if(!isEmpty(stringedValue))
{
1.13 +14 -14 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemNumber.cpp 2000/04/20 14:13:32 1.12
+++ ElemNumber.cpp 2000/04/20 16:47:34 1.13
@@ -241,7 +241,7 @@
if(0 != fromMatchPattern)
{
if(fromMatchPattern->getMatchScore(contextCopy, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)
{
break;
@@ -251,7 +251,7 @@
if(0 != countMatchPattern)
{
if(countMatchPattern->getMatchScore(contextCopy, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)
{
break;
@@ -279,7 +279,7 @@
if(0 != fromMatchPattern)
{
if(fromMatchPattern->getMatchScore(contextCopy, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)
{
contextCopy = 0;
@@ -290,7 +290,7 @@
if(0 != countMatchPattern)
{
if(countMatchPattern->getMatchScore(contextCopy, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)
{
break;
@@ -382,7 +382,7 @@
const XObject* const countObj =
m_valueExpr->execute(sourceNode,
*this,
- executionContext.getXPathExecutionContext());
+ executionContext);
numberList.push_back(static_cast<int>(countObj->num()));
}
@@ -436,7 +436,7 @@
next = pos->getParentNode();
if((0 != next) && ((((0 != fromMatchPattern) &&
(fromMatchPattern->getMatchScore(next, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone))) ||
(next->getNodeType() == XalanNode::DOCUMENT_NODE)))
{
@@ -459,7 +459,7 @@
if((0 != pos) && ((0 == countMatchPattern) ||
(countMatchPattern->getMatchScore(pos, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)))
{
break;
@@ -473,7 +473,7 @@
pos = pos->getPreviousSibling();
if((0 != pos) && ((0 == countMatchPattern) ||
(countMatchPattern->getMatchScore(pos, *this,
- executionContext.getXPathExecutionContext()) !=
+ executionContext) !=
XPath::s_MatchScoreNone)))
{
break;
@@ -525,7 +525,7 @@
while( 0 != node )
{
if((0 != m_fromMatchPattern) &&
- (m_fromMatchPattern->getMatchScore(node, *this, executionContext.getXPathExecutionContext()) !=
+ (m_fromMatchPattern->getMatchScore(node, *this, executionContext) !=
XPath::s_MatchScoreNone))
{
// The following if statement gives level="single" different
@@ -541,7 +541,7 @@
if(0 == countMatchPattern)
error(XalanDOMString("Programmers error! countMatchPattern should never be 0!"));
- if(countMatchPattern->getMatchScore(node, *this, executionContext.getXPathExecutionContext()) !=
+ if(countMatchPattern->getMatchScore(node, *this, executionContext) !=
XPath::s_MatchScoreNone)
{
ancestors.addNode(node);
@@ -583,12 +583,12 @@
XalanDOMString digitGroupSepValue;
if (0 != m_groupingSeparator_avt)
m_groupingSeparator_avt->evaluate(digitGroupSepValue, contextNode,
- *this, executionContext.getXPathExecutionContext());
+ *this, executionContext);
XalanDOMString nDigitsPerGroupValue;
if (0 != m_groupingSize_avt)
m_groupingSize_avt->evaluate(nDigitsPerGroupValue, contextNode, *this,
- executionContext.getXPathExecutionContext());
+ executionContext);
// TODO: Handle digit-group attributes
// 7.7.1 If one is empty, it is ignored (numb81 conf test)
@@ -626,7 +626,7 @@
XalanDOMString formatValue;
if (m_format_avt != 0)
- m_format_avt->evaluate(formatValue, contextNode, *this, executionContext.getXPathExecutionContext());
+ m_format_avt->evaluate(formatValue, contextNode, *this, executionContext);
if(isEmpty(formatValue))
formatValue = XALAN_STATIC_UCODE_STRING("1");
@@ -712,7 +712,7 @@
XalanDOMString letterVal;
if (m_lettervalue_avt != 0)
m_lettervalue_avt->evaluate(letterVal, contextNode, *this,
- executionContext.getXPathExecutionContext());
+ executionContext);
XalanDOMString formattedNumber;
1.15 +5 -6 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ElemTemplateElement.cpp 2000/04/14 17:53:57 1.14
+++ ElemTemplateElement.cpp 2000/04/20 16:47:34 1.15
@@ -686,7 +686,7 @@
XObject* const result = selectPattern->execute(
sourceNodeContext,
xslInstruction,
- executionContext.getXPathExecutionContext());
+ executionContext);
sourceNodes = result->mutableNodeset();
@@ -713,7 +713,7 @@
{
if (keys.size() > 0)
{
- NodeSorter sorter(executionContext.getXPathExecutionContext());
+ NodeSorter sorter(executionContext);
executionContext.setCurrentStackFrameIndex(selectStackFrameIndex);
sorter.sort(sourceNodes, keys);
@@ -866,7 +866,6 @@
case XalanNode::ATTRIBUTE_NODE:
{
- //rcw: DOM_node has no virtual funcs so we can't do a dynamic_cast<>.
const XalanAttr* const attr = static_cast<const XalanAttr*>(child);
const XalanDOMString val = attr->getValue();
@@ -1049,7 +1048,7 @@
XalanNode* newChild,
XalanNode* refChild)
{
-#if defined(XALAN_OLD_STYLE_CASTS)
+#if defined(XALAN_OLD_STYLE_CASTS) || !defined(XALAN_RTTI_AVAILABLE)
return insertBeforeElem((ElemTemplateElement*)newChild,
(ElemTemplateElement*)refChild);
#else
@@ -1065,7 +1064,7 @@
XalanNode* newChild,
XalanNode* oldChild)
{
-#if defined(XALAN_OLD_STYLE_CASTS)
+#if defined(XALAN_OLD_STYLE_CASTS) || !defined(XALAN_RTTI_AVAILABLE)
return replaceChildElem((ElemTemplateElement*)newChild,
(ElemTemplateElement*)oldChild);
#else
@@ -1136,7 +1135,7 @@
XalanNode*
ElemTemplateElement::appendChild(XalanNode* oldChild)
{
-#if defined(XALAN_OLD_STYLE_CASTS)
+#if defined(XALAN_OLD_STYLE_CASTS) || !defined(XALAN_RTTI_AVAILABLE)
return appendChildElem((ElemTemplateElement*)oldChild);
#else
return appendChildElem(dynamic_cast<ElemTemplateElement*>(oldChild));
1.5 +1 -1 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemValueOf.cpp 2000/04/12 19:41:00 1.4
+++ ElemValueOf.cpp 2000/04/20 16:47:34 1.5
@@ -154,7 +154,7 @@
const XObject* const value =
m_selectPattern->execute(sourceNode,
*this,
- executionContext.getXPathExecutionContext());
+ executionContext);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
1.5 +1 -2 xml-xalan/c/src/XSLT/ElemVariable.cpp
Index: ElemVariable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemVariable.cpp 2000/04/12 19:41:00 1.4
+++ ElemVariable.cpp 2000/04/20 16:47:35 1.5
@@ -174,8 +174,7 @@
if(0 != m_selectPattern)
{
- var = m_selectPattern->execute(sourceNode, *this,
- executionContext.getXPathExecutionContext());
+ var = m_selectPattern->execute(sourceNode, *this, executionContext);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
1.12 +4 -4 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Stylesheet.cpp 2000/04/18 15:30:46 1.11
+++ Stylesheet.cpp 2000/04/20 16:47:35 1.12
@@ -431,10 +431,10 @@
if(tmpl->getName().isEmpty() == false)
{
- m_namedTemplates.insert(std::make_pair(tmpl->getName(), tmpl));
+ m_namedTemplates.insert(ElemTemplateElementMapType::value_type(tmpl->getName(), tmpl));
}
- const XPath* xp = tmpl->getMatchPattern();
+ const XPath* const xp = tmpl->getMatchPattern();
if(0 != xp)
{
@@ -700,7 +700,7 @@
const XPath* const xpath = matchPat->getExpression();
double score =
- xpath->getMatchScore(targetNode, *this, executionContext.getXPathExecutionContext());
+ xpath->getMatchScore(targetNode, *this, executionContext);
if(XPath::s_MatchScoreNone != score)
{
@@ -1224,7 +1224,7 @@
{
assert(m_elemDecimalFormats[i] != 0);
- if (equals(m_elemDecimalFormats[i]->getTagName(), name) == true)
+ if (equals(m_elemDecimalFormats[i]->getName(), name) == true)
{
dfs = &m_elemDecimalFormats[i]->getDecimalFormatSymbols();
1.2 +2 -1 xml-xalan/c/src/XSLT/StylesheetExecutionContext.cpp
Index: StylesheetExecutionContext.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetExecutionContext.cpp 2000/01/26 14:29:44 1.1
+++ StylesheetExecutionContext.cpp 2000/04/20 16:47:35 1.2
@@ -59,7 +59,8 @@
-StylesheetExecutionContext::StylesheetExecutionContext()
+StylesheetExecutionContext::StylesheetExecutionContext() :
+ XPathExecutionContext()
{
}
1.7 +399 -41 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StylesheetExecutionContext.hpp 2000/04/12 19:41:01 1.6
+++ StylesheetExecutionContext.hpp 2000/04/20 16:47:35 1.7
@@ -64,6 +64,11 @@
+// Base class header file...
+#include <XPath/XPathExecutionContext.hpp>
+
+
+
#include <XalanDOM/XalanDOMString.hpp>
@@ -85,7 +90,6 @@
class XalanNode;
class XalanDocument;
class XPath;
-class XPathExecutionContext;
class XObject;
@@ -93,7 +97,7 @@
//
// An abstract class which provides support for executing stylesheets.
//
-class XALAN_XSLT_EXPORT StylesheetExecutionContext : public ExecutionContext
+class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
{
public:
@@ -106,39 +110,6 @@
// These interfaces are new...
/**
- * Retrieve parent of node
- *
- * @param theNode child node
- * @return parent node of 'theNode'
- */
- virtual XalanNode*
- getParentOfNode(const XalanNode& theNode) const = 0;
-
- /**
- * Retrieve execution context
- *
- * @return current execution context.
- */
- virtual XPathExecutionContext&
- getXPathExecutionContext() = 0;
-
- /**
- * Retrieve node list for current context.
- *
- * @return node list
- */
- virtual const NodeRefListBase&
- getContextNodeList() const = 0;
-
- /**
- * Set node list for current context.
- *
- * @param theContextNodeList new node list
- */
- virtual void
- setContextNodeList(const NodeRefListBase& theContextNodeList) = 0;
-
- /**
* Retrieve a top level variable corresponding to name.
*
* @param name name of variable
@@ -485,7 +456,8 @@
*
* @return current value of index
*/
- virtual int getCurrentStackFrameIndex() const = 0;
+ virtual int
+ getCurrentStackFrameIndex() const = 0;
/**
* Set the top of the stack frame from where a search
@@ -493,12 +465,14 @@
*
* @param currentStackFrameIndex new value of index
*/
- virtual void setCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0;
+ virtual void
+ setCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0;
/**
* Mark the top of the global stack where global searches should start.
*/
- virtual void markGlobalStackFrame() = 0;
+ virtual void
+ markGlobalStackFrame() = 0;
/**
* Receive notification of the beginning of a document.
@@ -785,6 +759,393 @@
StylesheetExecutionContext& m_executionContext;
};
+ // These interfaces are inherited from XPathExecutionContext...
+
+ /**
+ * Retrieve the node currently being executed.
+ *
+ * @return current node
+ */
+ virtual XalanNode*
+ getCurrentNode() const = 0;
+
+ /**
+ * Change the node currently being executed.
+ *
+ * @param theCurrentNode new current node
+ */
+ virtual void
+ setCurrentNode(XalanNode* theCurrentNode) = 0;
+
+ /**
+ * Retrieve the factory object for creating XObjects.
+ *
+ * @return factory object instance
+ */
+ virtual XObjectFactory&
+ getXObjectFactory() const = 0;
+
+ /**
+ * Retrieve namespace corresponding to a DOM node.
+ *
+ * @param n DOM node queried
+ * @return namespace string corresponding to 'n'
+ */
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const = 0;
+
+ /**
+ * Returns the local name of the given node.
+ *
+ * @param n node queried
+ * @return local name string corresponding to 'n'
+ */
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const = 0;
+
+ /**
+ * Returns the parent of the given node.
+ *
+ * @param n DOM node queried
+ * @return parent node for 'n'
+ */
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& n) const = 0;
+
+ /**
+ * Get node data recursively.
+ * (Note whitespace issues.)
+ *
+ * @param n DOM node queried
+ * @return string of data for node 'n'
+ */
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const = 0;
+
+ /**
+ * Given a valid element id, return the corresponding element.
+ *
+ * @param id string representing ID
+ * @param doc document to search
+ * @return element for ID
+ */
+ virtual XalanElement*
+ getElementByID(
+ const XalanDOMString& id,
+ const XalanDocument& doc) const = 0;
+
+ /**
+ * Retrieve node list for current context.
+ *
+ * @return node list
+ */
+ virtual const NodeRefListBase&
+ getContextNodeList() const = 0;
+
+ /**
+ * Set node list for current context.
+ *
+ * @param theList new node list
+ */
+ virtual void
+ setContextNodeList(const NodeRefListBase& theList) = 0;
+
+ /*
+ * Get the count of nodes in the current context node list.
+ *
+ * @return length of list
+ */
+ virtual int
+ getContextNodeListLength() const = 0;
+
+ /*
+ * Get the position of the node in the current context node list.
+ *
+ * @return position in list
+ */
+ virtual int
+ getContextNodeListPosition(const XalanNode& contextNode) const = 0;
+
+ /**
+ * Determine if an external element is available.
+ *
+ * @param theNamespace namespace for the element
+ * @param extensionName name of extension element
+ * @return whether the given element is available or not
+ */
+ virtual bool
+ elementAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const = 0;
+
+ /**
+ * Determine if an external function is available.
+ *
+ * @param theNamespace namespace for the function
+ * @param extensionName name of extension function
+ * @return whether the given function is available or not
+ */
+ virtual bool
+ functionAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const = 0;
+
+ /**
+ * Handle an extension function.
+ *
+ * @param theNamespace namespace of function
+ * @param extensionName extension function name
+ * @param argVec vector of arguments to function
+ * @return pointer to XObject result
+ */
+ virtual XObject*
+ extFunction(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec) = 0;
+
+ /**
+ * Get an XLocator provider keyed by node. This gets the association
+ * based on the root of the tree that is the node's parent.
+ *
+ * @param node node for locator
+ * @return pointer to locator
+ */
+ virtual XLocator*
+ getXLocatorFromNode(const XalanNode* node) const = 0;
+
+ /**
+ * Associate an XLocator provider to a node. This makes the association
+ * based on the root of the tree that is the node's parent.
+ *
+ * @param node node for association
+ * @param xlocator locator to associate with node
+ */
+ virtual void
+ associateXLocatorToNode(
+ const XalanNode* node,
+ XLocator* xlocator) = 0;
+
+ /**
+ * Provides support for XML parsing service.
+ *
+ * @param urlString location of the XML
+ * @param base base location for URI
+ * @return parsed document
+ */
+ virtual XalanDocument*
+ parseXML(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const = 0;
+
+ /**
+ * Create a MutableNodeRefList with the appropriate context.
+ *
+ * @return node list created
+ */
+ virtual MutableNodeRefList
+ createMutableNodeRefList() const = 0;
+
+ /**
+ * Tells if namespaces should be supported. For optimization purposes.
+ *
+ * @return true if namespaces supported
+ */
+ virtual bool
+ getProcessNamespaces() const = 0;
+
+ /**
+ * Given a valid element key, return the corresponding node list.
+ *
+ * @param doc source document
+ * @param name name of the key, which must match the 'name'
+ * attribute on xsl:key
+ * @param ref value that must match the value found by the
+ * 'match' attribute on xsl:key
+ * @param nscontext context node for namespace resolution
+ * @return if the name was not declared with xsl:key, this will return
+ * null, if the identifier is not found, it will return an empty
+ * node set, otherwise it will return a nodeset of nodes.
+ */
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext) = 0;
+
+ /**
+ * Given a valid element key, return the corresponding node list.
+ *
+ * @param doc source document
+ * @param name name of the key, which must match the 'name'
+ * attribute on xsl:key
+ * @param ref value that must match the value found by the
+ * 'match' attribute on xsl:key
+ * @return if the name was not declared with xsl:key, this will return
+ * null, if the identifier is not found, it will return an empty
+ * node set, otherwise it will return a nodeset of nodes.
+ */
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref) = 0;
+
+ /**
+ * Given a valid element key, return the corresponding node list.
+ *
+ * @param doc source document
+ * @param name name of the key, which must match the 'name'
+ * attribute on xsl:key
+ * @param ref value that must match the value found by the
+ * 'match' attribute on xsl:key
+ * @param resolver resolver for namespace resolution
+ * @return if the name was not declared with xsl:key, this will return
+ * null, if the identifier is not found, it will return an empty
+ * node set, otherwise it will return a nodeset of nodes.
+ */
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const PrefixResolver& resolver) = 0;
+
+ /**
+ * Given a name, locate a variable in the current context, and return
+ * a pointer to the object.
+ *
+ * @param theName name of variable
+ * @return pointer to an XObject if the variable was found, 0 if it was not
+ */
+ virtual XObject*
+ getVariable(const QName& name) const = 0;
+
+ /**
+ * Retrieve the resolver for namespaces.
+ *
+ * @return object for namespace resolution
+ */
+ virtual const PrefixResolver*
+ getPrefixResolver() const = 0;
+
+ /**
+ * Change the resolver for namespaces.
+ *
+ * @param thePrefixResolver new object for namespace resolution
+ */
+ virtual void
+ setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0;
+
+ /**
+ * Retrieve the URI corresponding to a namespace prefix
+ *
+ * @param prefix prefix for a namespace
+ * @return URI corresponding to namespace
+ */
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const = 0;
+
+ /**
+ * Given a DOM Document, tell what URI was used to parse it. Needed for
+ * relative resolution.
+ *
+ * @param owner source document
+ * @return document URI
+ */
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const = 0;
+
+ /**
+ * The getUnparsedEntityURI function returns the URI of the unparsed
+ * entity with the specified name in the same document as the context
+ * node (see [3.3 Unparsed Entities]). It returns the empty string if
+ * there is no such entity.
+ *
+ * @param theName name of entity
+ * @param theDocument document containing entity
+ * @return URI for the entity
+ */
+ virtual XalanDOMString
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const = 0;
+
+ /**
+ * Tells, through the combination of the default-space attribute
+ * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the
+ * xml:space attribute, whether or not extra whitespace should be stripped
+ * from the node. Literal elements from template elements should
+ * <em>not</em> be tested with this function.
+ *
+ * @param textNode text node from the source tree
+ * @return true if the text node should be stripped of extra whitespace
+ */
+ virtual bool
+ shouldStripSourceNode(const XalanNode& node) const = 0;
+
+ /**
+ * Tells if FoundIndex should be thrown if index is found. This is an
+ * optimization for match patterns, and is used internally by the XPath
+ * engine.
+ *
+ * @return true to throw FoundIndex
+ */
+ virtual bool
+ getThrowFoundIndex() const = 0;
+
+ /**
+ * Changes whether FoundIndex should be thrown if index is found. This is an
+ * optimization for match patterns, and is used internally by the XPath
+ * engine.
+ *
+ * @param fThrow true to throw FoundIndex
+ */
+ virtual void
+ setThrowFoundIndex(bool fThrow) = 0;
+
+ /**
+ * Sets the current match pattern.
+ *
+ * @param thePattern new match pattern
+ */
+ virtual void
+ setCurrentPattern(const XalanDOMString& thePattern) = 0;
+
+ /**
+ * Retrieve the current match pattern.
+ *
+ * @return current match pattern
+ */
+ virtual XalanDOMString
+ getCurrentPattern() const = 0;
+
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const = 0;
+
+ /**
+ * Associate a document with a given URI.
+ *
+ * @param theURI document URI
+ * @param theDocument source document
+ */
+ virtual void
+ setSourceDocument(
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument) = 0;
+
+
+ /**
+ * Retrieve the DecimalFormatSymbols instance associated with
+ * the name.
+ *
+ * @param name the name for the lookup
+ * @return a pointer to the matching instance, or 0 if none was found
+ */
+ virtual const DecimalFormatSymbols*
+ getDecimalFormatSymbols(const XalanDOMString& name) = 0;
+
// These interfaces are inherited from ExecutionContext...
virtual void
@@ -805,9 +1166,6 @@
const XalanNode* sourceNode = 0,
const XalanNode* styleNode = 0) const = 0;
};
-
-
-
1.6 +407 -80 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StylesheetExecutionContextDefault.cpp 2000/04/12 19:41:01 1.5
+++ StylesheetExecutionContextDefault.cpp 2000/04/20 16:47:35 1.6
@@ -81,12 +81,24 @@
StylesheetExecutionContextDefault::StylesheetExecutionContextDefault(
- XPathExecutionContext& xpathExecutionContext,
- XSLTEngineImpl& xsltProcessor) :
+ XSLTEngineImpl& xsltProcessor,
+ XPathEnvSupport& theXPathEnvSupport,
+ XPathSupport& theXPathSupport,
+ XObjectFactory& theXObjectFactory,
+ XalanNode* theCurrentNode,
+ const NodeRefListBase& theContextNodeList,
+ const PrefixResolver* thePrefixResolver) :
StylesheetExecutionContext(),
- m_xpathExecutionContext(xpathExecutionContext),
+ m_xpathExecutionContextDefault(theXPathEnvSupport,
+ theXPathSupport,
+ theXObjectFactory,
+ theCurrentNode,
+ theContextNodeList,
+ thePrefixResolver),
m_xsltProcessor(xsltProcessor),
- m_elementRecursionStack()
+ m_elementRecursionStack(),
+ m_prefixResolver(0),
+ m_stylesheetRoot(0)
{
}
@@ -98,71 +110,6 @@
-void
-StylesheetExecutionContextDefault::error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const XalanNode* styleNode) const
-{
- m_xpathExecutionContext.error(msg, sourceNode, styleNode);
-}
-
-
-
-void
-StylesheetExecutionContextDefault::warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const XalanNode* styleNode) const
-{
- m_xpathExecutionContext.warn(msg, sourceNode, styleNode);
-}
-
-
-
-void
-StylesheetExecutionContextDefault::message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const XalanNode* styleNode) const
-{
- m_xpathExecutionContext.message(msg, sourceNode, styleNode);
-}
-
-
-
-XalanNode*
-StylesheetExecutionContextDefault::getParentOfNode(const XalanNode& theNode) const
-{
- return m_xpathExecutionContext.getParentOfNode(theNode);
-}
-
-
-
-XPathExecutionContext&
-StylesheetExecutionContextDefault::getXPathExecutionContext()
-{
- return m_xpathExecutionContext;
-}
-
-
-
-const NodeRefListBase&
-StylesheetExecutionContextDefault::getContextNodeList() const
-{
- return m_xpathExecutionContext.getContextNodeList();
-}
-
-
-
-void
-StylesheetExecutionContextDefault::setContextNodeList(const NodeRefListBase& theContextNodeList)
-{
- m_xpathExecutionContext.setContextNodeList(theContextNodeList);
-}
-
-
-
XObject*
StylesheetExecutionContextDefault::getTopLevelVariable(const XalanDOMString& theName) const
{
@@ -385,7 +332,7 @@
return m_xsltProcessor.evalXPathStr(str,
contextNode,
resolver,
- m_xpathExecutionContext);
+ *this);
}
@@ -399,7 +346,7 @@
return m_xsltProcessor.evalXPathStr(str,
contextNode,
resolver,
- m_xpathExecutionContext);
+ *this);
}
@@ -423,7 +370,7 @@
return m_xsltProcessor.evaluateAttrVal(contextNode,
namespaceContext,
stringedValue,
- m_xpathExecutionContext);
+ *this);
}
@@ -496,19 +443,27 @@
{
return m_xsltProcessor.getParamVariable(theName);
}
+
+
-int StylesheetExecutionContextDefault::getCurrentStackFrameIndex() const
+int
+StylesheetExecutionContextDefault::getCurrentStackFrameIndex() const
{
return m_xsltProcessor.getVariableStacks().getCurrentStackFrameIndex();
}
+
-void StylesheetExecutionContextDefault::setCurrentStackFrameIndex(int
- currentStackFrameIndex)
+
+void
+StylesheetExecutionContextDefault::setCurrentStackFrameIndex(int currentStackFrameIndex)
{
m_xsltProcessor.getVariableStacks().setCurrentStackFrameIndex(currentStackFrameIndex);
}
+
-void StylesheetExecutionContextDefault::markGlobalStackFrame()
+
+void
+StylesheetExecutionContextDefault::markGlobalStackFrame()
{
m_xsltProcessor.getVariableStacks().markGlobalStackFrame();
}
@@ -631,7 +586,11 @@
XalanNode* sourceNode,
const QName& mode)
{
- std::auto_ptr<ResultTreeFragBase>
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+
+ auto_ptr<ResultTreeFragBase>
theFragment(m_xsltProcessor.createResultTreeFrag(*this,
templateChild,
sourceTree,
@@ -687,10 +646,14 @@
bool
StylesheetExecutionContextDefault::findOnElementRecursionStack(const ElemTemplateElement* theElement) const
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
+
const ElementRecursionStackType::const_iterator i =
- std::find(m_elementRecursionStack.begin(),
- m_elementRecursionStack.end(),
- theElement);
+ find(m_elementRecursionStack.begin(),
+ m_elementRecursionStack.end(),
+ theElement);
return i == m_elementRecursionStack.end() ? false : true;
}
@@ -718,4 +681,368 @@
m_elementRecursionStack.pop_back();
return theTemp;
+}
+
+
+
+XalanNode*
+StylesheetExecutionContextDefault::getCurrentNode() const
+{
+ return m_xpathExecutionContextDefault.getCurrentNode();
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setCurrentNode(XalanNode* theCurrentNode)
+{
+ m_xpathExecutionContextDefault.setCurrentNode(theCurrentNode);
+}
+
+
+
+XObjectFactory&
+StylesheetExecutionContextDefault::getXObjectFactory() const
+{
+ return m_xpathExecutionContextDefault.getXObjectFactory();
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getNamespaceOfNode(const XalanNode& n) const
+{
+ return m_xpathExecutionContextDefault.getNamespaceOfNode(n);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getLocalNameOfNode(const XalanNode& n) const
+{
+ return m_xpathExecutionContextDefault.getLocalNameOfNode(n);
+}
+
+
+
+XalanNode*
+StylesheetExecutionContextDefault::getParentOfNode(const XalanNode& theNode) const
+{
+ return m_xpathExecutionContextDefault.getParentOfNode(theNode);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getNodeData(const XalanNode& n) const
+{
+ return m_xpathExecutionContextDefault.getNodeData(n);
+}
+
+
+
+XalanElement*
+StylesheetExecutionContextDefault::getElementByID(
+ const XalanDOMString& id,
+ const XalanDocument& doc) const
+{
+ return m_xpathExecutionContextDefault.getElementByID(id, doc);
+}
+
+
+
+const NodeRefListBase&
+StylesheetExecutionContextDefault::getContextNodeList() const
+{
+ return m_xpathExecutionContextDefault.getContextNodeList();
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setContextNodeList(const NodeRefListBase& theContextNodeList)
+{
+ m_xpathExecutionContextDefault.setContextNodeList(theContextNodeList);
+}
+
+
+
+int
+StylesheetExecutionContextDefault::getContextNodeListLength() const
+{
+ return m_xpathExecutionContextDefault.getContextNodeListLength();
+}
+
+
+
+int
+StylesheetExecutionContextDefault::getContextNodeListPosition(const XalanNode& contextNode) const
+{
+ return m_xpathExecutionContextDefault.getContextNodeListPosition(contextNode);
+}
+
+
+
+bool
+StylesheetExecutionContextDefault::elementAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const
+{
+ return m_xpathExecutionContextDefault.elementAvailable(theNamespace, extensionName);
+}
+
+
+
+bool
+StylesheetExecutionContextDefault::functionAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const
+{
+ return m_xpathExecutionContextDefault.functionAvailable(theNamespace, extensionName);
+}
+
+
+
+XObject*
+StylesheetExecutionContextDefault::extFunction(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec)
+{
+ return m_xpathExecutionContextDefault.extFunction(theNamespace, extensionName, argVec);
+}
+
+
+
+XLocator*
+StylesheetExecutionContextDefault::getXLocatorFromNode(const XalanNode* node) const
+{
+ return m_xpathExecutionContextDefault.getXLocatorFromNode(node);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::associateXLocatorToNode(
+ const XalanNode* node,
+ XLocator* xlocator)
+{
+ m_xpathExecutionContextDefault.associateXLocatorToNode(node, xlocator);
+}
+
+
+
+XalanDocument*
+StylesheetExecutionContextDefault::parseXML(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const
+{
+ return m_xpathExecutionContextDefault.parseXML(urlString, base);
+}
+
+
+
+MutableNodeRefList
+StylesheetExecutionContextDefault::createMutableNodeRefList() const
+{
+ return m_xpathExecutionContextDefault.createMutableNodeRefList();
+}
+
+
+
+bool
+StylesheetExecutionContextDefault::getProcessNamespaces() const
+{
+ return m_xpathExecutionContextDefault.getProcessNamespaces();
+}
+
+
+
+const NodeRefListBase*
+StylesheetExecutionContextDefault::getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext)
+{
+ return m_xpathExecutionContextDefault.getNodeSetByKey(doc, name, ref, nscontext);
+}
+
+
+
+const NodeRefListBase*
+StylesheetExecutionContextDefault::getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref)
+{
+ return m_xpathExecutionContextDefault.getNodeSetByKey(doc, name, ref);
+}
+
+
+
+const NodeRefListBase*
+StylesheetExecutionContextDefault::getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const PrefixResolver& resolver)
+{
+ return m_xpathExecutionContextDefault.getNodeSetByKey(doc, name, ref, resolver);
+}
+
+
+
+XObject*
+StylesheetExecutionContextDefault::getVariable(const QName& name) const
+{
+ return m_xpathExecutionContextDefault.getVariable(name);
+}
+
+
+
+const PrefixResolver*
+StylesheetExecutionContextDefault::getPrefixResolver() const
+{
+ return m_xpathExecutionContextDefault.getPrefixResolver();
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setPrefixResolver(const PrefixResolver* thePrefixResolver)
+{
+ m_xpathExecutionContextDefault.setPrefixResolver(thePrefixResolver);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getNamespaceForPrefix(const XalanDOMString& prefix) const
+{
+ return m_xpathExecutionContextDefault.getNamespaceForPrefix(prefix);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::findURIFromDoc(const XalanDocument* owner) const
+{
+ return m_xpathExecutionContextDefault.findURIFromDoc(owner);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
+{
+ return m_xpathExecutionContextDefault.getUnparsedEntityURI(theName, theDocument);
+}
+
+
+
+bool
+StylesheetExecutionContextDefault::shouldStripSourceNode(const XalanNode& node) const
+{
+ return m_xpathExecutionContextDefault.shouldStripSourceNode(node);
+}
+
+
+
+bool
+StylesheetExecutionContextDefault::getThrowFoundIndex() const
+{
+ return m_xpathExecutionContextDefault.getThrowFoundIndex();
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setThrowFoundIndex(bool fThrow)
+{
+ m_xpathExecutionContextDefault.setThrowFoundIndex(fThrow);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setCurrentPattern(const XalanDOMString& thePattern)
+{
+ m_xpathExecutionContextDefault.setCurrentPattern(thePattern);
+}
+
+
+
+XalanDOMString
+StylesheetExecutionContextDefault::getCurrentPattern() const
+{
+ return m_xpathExecutionContextDefault.getCurrentPattern();
+}
+
+
+
+XalanDocument*
+StylesheetExecutionContextDefault::getSourceDocument(const XalanDOMString& theURI) const
+{
+ return m_xpathExecutionContextDefault.getSourceDocument(theURI);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setSourceDocument(
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument)
+{
+ m_xpathExecutionContextDefault.setSourceDocument(theURI, theDocument);
+}
+
+
+
+const DecimalFormatSymbols*
+StylesheetExecutionContextDefault::getDecimalFormatSymbols(const XalanDOMString& name)
+{
+ if (m_stylesheetRoot == 0)
+ {
+ return m_xpathExecutionContextDefault.getDecimalFormatSymbols(name);
+ }
+ else
+ {
+ return m_stylesheetRoot->getDecimalFormatSymbols(name);
+ }
+}
+
+
+
+void
+StylesheetExecutionContextDefault::error(
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ m_xpathExecutionContextDefault.error(msg, sourceNode, styleNode);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::warn(
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ m_xpathExecutionContextDefault.warn(msg, sourceNode, styleNode);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::message(
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ m_xpathExecutionContextDefault.message(msg, sourceNode, styleNode);
}
1.7 +164 -18 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StylesheetExecutionContextDefault.hpp 2000/04/12 19:41:01 1.6
+++ StylesheetExecutionContextDefault.hpp 2000/04/20 16:47:35 1.7
@@ -69,6 +69,10 @@
+#include <XPath/XPathExecutionContextDefault.hpp>
+
+
+
class XPathProcessor;
class XPathSupport;
class XObjectFactory;
@@ -84,26 +88,19 @@
public:
StylesheetExecutionContextDefault(
- XPathExecutionContext& xpathExecutionContext,
- XSLTEngineImpl& xsltProcessor);
+ XSLTEngineImpl& xsltProcessor,
+ XPathEnvSupport& theXPathEnvSupport,
+ XPathSupport& theXPathSupport,
+ XObjectFactory& theXObjectFactory,
+ XalanNode* theCurrentNode = 0,
+ const NodeRefListBase& theContextNodeList = NodeRefList(),
+ const PrefixResolver* thePrefixResolver = 0);
virtual
~StylesheetExecutionContextDefault();
// These interfaces are inherited from StylesheetExecutionContext...
- virtual XalanNode*
- getParentOfNode(const XalanNode& theNode) const;
-
- virtual XPathExecutionContext&
- getXPathExecutionContext();
-
- virtual const NodeRefListBase&
- getContextNodeList() const;
-
- virtual void
- setContextNodeList(const NodeRefListBase& theContextNodeList);
-
virtual XObject*
getTopLevelVariable(const XalanDOMString& theName) const;
@@ -241,11 +238,14 @@
virtual XObject*
getParamVariable(const QName& theName) const;
- virtual int getCurrentStackFrameIndex() const;
+ virtual int
+ getCurrentStackFrameIndex() const;
- virtual void setCurrentStackFrameIndex(int currentStackFrameIndex = -1);
+ virtual void
+ setCurrentStackFrameIndex(int currentStackFrameIndex = -1);
- virtual void markGlobalStackFrame();
+ virtual void
+ markGlobalStackFrame();
virtual void
startDocument();
@@ -329,6 +329,148 @@
popElementRecursionStack();
+ // These interfaces are inherited from XPathExecutionContext...
+
+ virtual XalanNode*
+ getCurrentNode() const;
+
+ virtual void
+ setCurrentNode(XalanNode* theCurrentNode);
+
+ virtual XObjectFactory&
+ getXObjectFactory() const;
+
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const;
+
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const;
+
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& n) const;
+
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const;
+
+ virtual XalanElement*
+ getElementByID(
+ const XalanDOMString& id,
+ const XalanDocument& doc) const;
+
+ virtual const NodeRefListBase&
+ getContextNodeList() const;
+
+ virtual void
+ setContextNodeList(const NodeRefListBase& theList);
+
+ virtual int
+ getContextNodeListLength() const;
+
+ virtual int
+ getContextNodeListPosition(const XalanNode& contextNode) const;
+
+ virtual bool
+ elementAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const;
+
+ virtual bool
+ functionAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const;
+
+ virtual XObject*
+ extFunction(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec);
+
+ virtual XLocator*
+ getXLocatorFromNode(const XalanNode* node) const;
+
+ virtual void
+ associateXLocatorToNode(
+ const XalanNode* node,
+ XLocator* xlocator);
+
+ virtual XalanDocument*
+ parseXML(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const;
+
+ virtual MutableNodeRefList
+ createMutableNodeRefList() const;
+
+ virtual bool
+ getProcessNamespaces() const;
+
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext);
+
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref);
+
+ virtual const NodeRefListBase*
+ getNodeSetByKey(
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const PrefixResolver& resolver);
+
+ virtual XObject*
+ getVariable(const QName& name) const;
+
+ virtual const PrefixResolver*
+ getPrefixResolver() const;
+
+ virtual void
+ setPrefixResolver(const PrefixResolver* thePrefixResolver);
+
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
+
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const;
+
+ virtual XalanDOMString
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const;
+
+ virtual bool
+ shouldStripSourceNode(const XalanNode& node) const;
+
+ virtual bool
+ getThrowFoundIndex() const;
+
+ virtual void
+ setThrowFoundIndex(bool fThrow);
+
+ virtual void
+ setCurrentPattern(const XalanDOMString& thePattern);
+
+ virtual XalanDOMString
+ getCurrentPattern() const;
+
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const;
+
+ virtual void
+ setSourceDocument(
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument);
+
+
+ virtual const DecimalFormatSymbols*
+ getDecimalFormatSymbols(const XalanDOMString& name);
+
// These interfaces are inherited from ExecutionContext...
virtual void
@@ -351,12 +493,16 @@
private:
- XPathExecutionContext& m_xpathExecutionContext;
+ XPathExecutionContextDefault m_xpathExecutionContextDefault;
// $$ ToDo: Try to remove this dependency, and rely only on XSLTProcessor...
XSLTEngineImpl& m_xsltProcessor;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<const ElemTemplateElement*> ElementRecursionStackType;
+#else
typedef std::vector<const ElemTemplateElement*> ElementRecursionStackType;
+#endif
ElementRecursionStackType m_elementRecursionStack;
1.20 +2 -2 xml-xalan/c/src/XSLT/StylesheetHandler.cpp
Index: StylesheetHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- StylesheetHandler.cpp 2000/04/13 17:13:37 1.19
+++ StylesheetHandler.cpp 2000/04/20 16:47:35 1.20
@@ -594,9 +594,9 @@
if (fVersionFound == false)
{
-// const XalanDOMString msg("The stylesheet element did not specify a version attribute!");
+ const XalanDOMString msg("The stylesheet element did not specify a version attribute!");
-// throw SAXException(toCharArray(msg));
+ throw SAXException(toCharArray(msg));
}
}
break;
1.12 +7 -8 xml-xalan/c/src/XSLT/StylesheetHandler.hpp
Index: StylesheetHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StylesheetHandler.hpp 2000/04/13 16:49:00 1.11
+++ StylesheetHandler.hpp 2000/04/20 16:47:35 1.12
@@ -394,14 +394,13 @@
XalanDOMString m_pendingException;
bool m_exceptionPending;
- typedef std::vector<ElemTemplateElement*> ElemTemplateStackType;
-
- /**
- * Need to keep a stack of found whitespace elements so that
- * whitespace elements next to non-whitespace elements can
- * be merged. For instance: <out> <![CDATA[test]]> </out>
- */
- typedef std::vector<ElemTextLiteral*> ElemTextLiteralStackType;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<ElemTemplateElement*> ElemTemplateStackType;
+ typedef vector<ElemTextLiteral*> ElemTextLiteralStackType;
+#else
+ typedef std::vector<ElemTemplateElement*> ElemTemplateStackType;
+ typedef std::vector<ElemTextLiteral*> ElemTextLiteralStackType;
+#endif
/**
* The XSLT Processor for needed services.
1.10 +31 -11 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StylesheetRoot.cpp 2000/04/12 19:41:02 1.9
+++ StylesheetRoot.cpp 2000/04/20 16:47:35 1.10
@@ -146,13 +146,17 @@
// For some reason, the imports aren't working right if I
// don't set the baseIdent to full url. I think this is OK,
// and probably safer and faster in general.
- std::auto_ptr<XMLURL> url(constructionContext.getURLFromString(m_baseIdent));
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+ auto_ptr<XMLURL> url(constructionContext.getURLFromString(m_baseIdent));
+
if (url.get() != 0)
{
m_baseIdent = url->getURLText();
- std::auto_ptr<XMLURL> url2(constructionContext.getURLFromString(m_baseIdent));
+ auto_ptr<XMLURL> url2(constructionContext.getURLFromString(m_baseIdent));
if (url2.get() != 0)
{
@@ -168,10 +172,14 @@
StylesheetRoot::~StylesheetRoot()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
// Clean up all entries in the vector.
- std::for_each(m_importStack.begin(),
- m_importStack.end(),
- DeleteFunctor<XMLURL>());
+ for_each(m_importStack.begin(),
+ m_importStack.end(),
+ DeleteFunctor<XMLURL>());
delete m_defaultRule;
delete m_defaultTextRule;
@@ -209,8 +217,12 @@
if(0 != outputTarget.getDocumentHandler())
{
// Stuff a DocumentHandler into a FormatterListener
- flistener =
- dynamic_cast<FormatterListener *>(outputTarget.getDocumentHandler());
+ flistener =
+#if defined(XALAN_OLD_STYLE_CASTS) || !defined(XALAN_RTTI_AVAILABLE)
+ (FormatterListener*)outputTarget.getDocumentHandler();
+#else
+ dynamic_cast<FormatterListener*>(outputTarget.getDocumentHandler());
+#endif
}
/*
* Output target has a character or byte stream or file
@@ -269,8 +281,12 @@
}
else
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::cout;
+#endif
+
// $$$ ToDo: THIS IS A MEMORY LEAK!!!
- pw = new XercesDOMPrintWriter(*new XercesStdTextOutputStream(std::cout));
+ pw = new XercesDOMPrintWriter(*new XercesStdTextOutputStream(cout));
newPW = true;
}
}
@@ -691,10 +707,14 @@
void
StylesheetRoot::removeTraceListener(TraceListener* theListener)
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
+
const ListenersVectorType::iterator it =
- std::find(m_traceListeners.begin(),
- m_traceListeners.end(),
- theListener);
+ find(m_traceListeners.begin(),
+ m_traceListeners.end(),
+ theListener);
if (it != m_traceListeners.end())
{
1.28 +20 -28 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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XSLTEngineImpl.cpp 2000/04/18 15:29:40 1.27
+++ XSLTEngineImpl.cpp 2000/04/20 16:47:35 1.28
@@ -353,7 +353,7 @@
void
XSLTEngineImpl::process(
- XSLTInputSource* inputSource,
+ XSLTInputSource& inputSource,
XSLTInputSource* stylesheetSource,
XSLTResultTarget& outputTarget,
StylesheetConstructionContext& constructionContext,
@@ -369,8 +369,7 @@
XalanNode* sourceTree = 0;
- if(0 != inputSource)
- sourceTree = getSourceTreeFromInput(inputSource);
+ sourceTree = getSourceTreeFromInput(inputSource);
if(0 != stylesheetSource)
{
@@ -449,9 +448,8 @@
Stylesheet* prevStylesheet = 0;
while(!hrefs.empty())
{
- const XMLCh *pxch = (0 != inputSource) ?
- inputSource->getSystemId() : 0;
- const XalanDOMString sysid(pxch);
+ const XMLCh* const pxch = inputSource.getSystemId();
+ const XalanDOMString sysid(pxch);
const XalanDOMString& ref = hrefs.back();
Stylesheet* stylesheet =
@@ -569,9 +567,8 @@
if(0 != stylesheetSource.getNode())
{
- FormatterListener& flistener =
- dynamic_cast<FormatterListener&>(stylesheetProcessor);
- FormatterTreeWalker tw(flistener);
+ FormatterTreeWalker tw(stylesheetProcessor);
+
tw.traverse(stylesheetSource.getNode());
}
else
@@ -616,19 +613,17 @@
//==========================================================
XalanNode*
-XSLTEngineImpl::getSourceTreeFromInput(XSLTInputSource *inputSource)
+XSLTEngineImpl::getSourceTreeFromInput(XSLTInputSource& inputSource)
{
- XalanNode* sourceTree = 0;
-
- const XalanDOMString ds(XALAN_STATIC_UCODE_STRING("Input XML"));
+ XalanNode* sourceTree = 0;
- XalanDOMString xmlIdentifier = ((0 == inputSource) ||
- (0 == inputSource->getSystemId())) ?
- ds : inputSource->getSystemId();
+ XalanDOMString xmlIdentifier = 0 != inputSource.getSystemId() ?
+ inputSource.getSystemId() :
+ XALAN_STATIC_UCODE_STRING("Input XML");
- if(0 != inputSource->getNode())
+ if(0 != inputSource.getNode())
{
- sourceTree = inputSource->getNode();
+ sourceTree = inputSource.getNode();
}
else
{
@@ -643,7 +638,7 @@
pushTime(&xmlIdentifier);
XalanDocument* const theDocument =
- m_parserLiaison.parseXMLStream(*inputSource,
+ m_parserLiaison.parseXMLStream(inputSource,
xmlIdentifier);
assert(theDocument != 0);
@@ -850,11 +845,8 @@
addTraceListenersToStylesheet();
StylesheetHandler stylesheetProcessor(*this, *stylesheet, constructionContext);
-
- FormatterListener& flistener =
- dynamic_cast<FormatterListener&>(stylesheetProcessor);
- FormatterTreeWalker tw(flistener);
+ FormatterTreeWalker tw(stylesheetProcessor);
tw.traverse(frag);
@@ -2043,7 +2035,7 @@
XalanNode* sourceNode,
const QName& mode)
{
- DocumentHandler* const savedFormatterListener = m_flistener;
+ FormatterListener* const savedFormatterListener = m_flistener;
#if !defined(XALAN_NO_NAMESPACES)
using std::auto_ptr;
@@ -2083,7 +2075,7 @@
{
flushPending();
- DocumentHandler* savedFormatterListener = m_flistener;
+ FormatterListener* const savedFormatterListener = m_flistener;
XalanDOMString savedPendingName = m_pendingElementName;
m_pendingElementName = 0;
AttributeListImpl savedPendingAttributes = m_pendingAttributes;
@@ -3853,7 +3845,7 @@
FormatterListener*
XSLTEngineImpl::getFormatterListener() const
{
- return dynamic_cast<FormatterListener*>(m_flistener);
+ return m_flistener;
}
@@ -4192,7 +4184,7 @@
XObject* const theXObject =
pxpath->execute(sourceNode,
*xslParamElement,
- executionContext.getXPathExecutionContext());
+ executionContext);
theArg = new Arg(xslParamElement->getQName(), theXObject, true);
}
@@ -4327,7 +4319,7 @@
if(theEntry->getType() == StackEntry::eArgument)
{
const Arg* const theArg =
- dynamic_cast<const Arg*>(theEntry);
+ static_cast<const Arg*>(theEntry);
if(theArg->getName().equals(qname))
{
1.25 +2 -9 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- XSLTEngineImpl.hpp 2000/04/18 15:29:40 1.24
+++ XSLTEngineImpl.hpp 2000/04/20 16:47:35 1.25
@@ -257,7 +257,7 @@
virtual void
process(
- XSLTInputSource* inputSource,
+ XSLTInputSource& inputSource,
XSLTInputSource* stylesheetSource,
XSLTResultTarget& outputTarget,
StylesheetConstructionContext& constructionContext,
@@ -274,7 +274,7 @@
StylesheetConstructionContext& constructionContext);
virtual XalanNode*
- getSourceTreeFromInput(XSLTInputSource *inputSource);
+ getSourceTreeFromInput(XSLTInputSource& inputSource);
virtual void
outputToResultTree(const XObject& xobj);
@@ -2376,14 +2376,7 @@
* The listener for formatting events. This should be
* supplied by the Formatter object.
*/
-
- // For now, we have to use the FormatterListener class,
- // since we can't use RTTI to determine what we have.
-#if 1
- DocumentHandler* m_flistener;
-#else
FormatterListener* m_flistener;
-#endif
/**
* This holds the current context node list. This should arguably be
1.7 +2 -2 xml-xalan/c/src/XSLT/XSLTProcessor.hpp
Index: XSLTProcessor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessor.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSLTProcessor.hpp 2000/04/11 15:09:31 1.6
+++ XSLTProcessor.hpp 2000/04/20 16:47:35 1.7
@@ -138,7 +138,7 @@
*/
virtual void
process(
- XSLTInputSource* inputSource,
+ XSLTInputSource& inputSource,
XSLTInputSource* stylesheetSource,
XSLTResultTarget& outputTarget,
StylesheetConstructionContext& constructionContext,
@@ -194,7 +194,7 @@
* @return source tree
*/
virtual XalanNode*
- getSourceTreeFromInput(XSLTInputSource* inputSource) = 0;
+ getSourceTreeFromInput(XSLTInputSource& inputSource) = 0;
/**
* Output an object to the result tree by doing the right conversions.