dbertoni 2002/07/10 00:31:03 Modified: c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp Log: Temporary fix for copying namespace nodes. Revision Changes Path 1.148 +30 -5 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.147 retrieving revision 1.148 diff -u -r1.147 -r1.148 --- XSLTEngineImpl.cpp 10 Jul 2002 00:43:01 -0000 1.147 +++ XSLTEngineImpl.cpp 10 Jul 2002 07:31:02 -0000 1.148 @@ -2985,7 +2985,7 @@ -void +bool XSLTEngineImpl::addResultNamespace( const XalanDOMString& thePrefix, const XalanDOMString& theName, @@ -3003,13 +3003,23 @@ { addResultAttribute(thePendingAttributes, theName, srcURI); addResultNamespaceDecl(thePrefix, srcURI); + + return true; + } + else + { + return false; } } + else + { + return false; + } } -void +bool XSLTEngineImpl::addResultNamespace( const XalanNode& theNode, AttributeListImpl& thePendingAttributes, @@ -3023,7 +3033,7 @@ if (equals(aname, DOMServices::s_XMLNamespace) == true) { // Default namespace declaration... - addResultNamespace(s_emptyString, aname, theNode, thePendingAttributes, fOnlyIfPrefixNotPresent); + return addResultNamespace(s_emptyString, aname, theNode, thePendingAttributes, fOnlyIfPrefixNotPresent); } else if (startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator)) { @@ -3033,7 +3043,11 @@ substring(aname, thePrefix, DOMServices::s_XMLNamespaceWithSeparatorLength); - addResultNamespace(thePrefix, aname, theNode, thePendingAttributes, fOnlyIfPrefixNotPresent); + return addResultNamespace(thePrefix, aname, theNode, thePendingAttributes, fOnlyIfPrefixNotPresent); + } + else + { + return false; } } @@ -3044,6 +3058,10 @@ { const XalanNode* parent = &src; + XalanDOMStringPointerSetType names; + + XalanDOMStringPointerSetType::iterator end = names.end(); + while (parent != 0 && parent->getNodeType() == XalanNode::ELEMENT_NODE) { @@ -3063,7 +3081,14 @@ const XalanNode* const attr = nnm->item(i); assert(attr != 0); - addResultNamespace(*attr, thePendingAttributes, true); + const XalanDOMString& nodeName = attr->getNodeName(); + + if (names.find(&nodeName) == end) + { + addResultNamespace(*attr, thePendingAttributes, true); + + names.insert(&nodeName); + } } parent = parent->getParentNode(); 1.89 +28 -2 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.88 retrieving revision 1.89 diff -u -r1.88 -r1.89 --- XSLTEngineImpl.hpp 10 Jul 2002 00:43:01 -0000 1.88 +++ XSLTEngineImpl.hpp 10 Jul 2002 07:31:02 -0000 1.89 @@ -158,6 +158,28 @@ typedef clock_t ClockType; #endif + struct CompareXalanDOMStringPointers + { + bool + operator()( + const XalanDOMString* theLHS, + const XalanDOMString* theRHS) const + { + if (theLHS == 0 && theRHS != 0) + { + return true; + } + else if (theRHS == 0) + { + return false; + } + else + { + return theLHS->compare(*theRHS) < 0 ? true : false; + } + } + }; + #if defined(XALAN_NO_NAMESPACES) typedef map<XalanDOMString, int, @@ -171,6 +193,8 @@ typedef vector<const Locator*> LocatorStack; typedef vector<TraceListener*> TraceListenerVectorType; typedef vector<bool> BoolVectorType; + typedef set<const XalanDOMString*, + CompareXalanDOMStringPointers> XalanDOMStringPointerSetType; #else typedef std::map<XalanDOMString, int> AttributeKeysMapType; typedef std::map<XalanDOMString, int> ElementKeysMapType; @@ -178,6 +202,8 @@ typedef std::vector<const Locator*> LocatorStack; typedef std::vector<TraceListener*> TraceListenerVectorType; typedef std::vector<bool> BoolVectorType; + typedef std::set<const XalanDOMString*, + CompareXalanDOMStringPointers> XalanDOMStringPointerSetType; #endif typedef XalanAutoPtr<XPathProcessor> XPathProcessorPtrType; @@ -1490,7 +1516,7 @@ bool pendingAttributesHasDefaultNS() const; - void + bool addResultNamespace( const XalanDOMString& thePrefix, const XalanDOMString& theName, @@ -1498,7 +1524,7 @@ AttributeListImpl& thePendingAttributes, bool fOnlyIfPrefixNotPresent); - void + bool addResultNamespace( const XalanNode& theNode, AttributeListImpl& thePendingAttributes,
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]