dbertoni 01/01/30 14:03:43
Modified: c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Added flag to prevent overwriting prefix mapping that already exists.
Revision Changes Path
1.83 +27 -10 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.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- XSLTEngineImpl.cpp 2001/01/26 22:02:34 1.82
+++ XSLTEngineImpl.cpp 2001/01/30 22:03:40 1.83
@@ -2243,7 +2243,8 @@
void
XSLTEngineImpl::addResultNamespace(
const XalanNode& theNode,
- AttributeListImpl& thePendingAttributes)
+ AttributeListImpl& thePendingAttributes,
+ bool fOnlyIfPrefixNotPresent)
{
assert(theNode.getNodeType() == XalanNode::ATTRIBUTE_NODE);
@@ -2251,17 +2252,33 @@
const bool isPrefix = startsWith(aname,
DOMServices::s_XMLNamespaceWithSeparator);
- if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
- {
- const XalanDOMString prefix = isPrefix == true ?
+ const XalanDOMString prefix = isPrefix == true ?
substring(aname,
DOMServices::s_XMLNamespaceWithSeparatorLength) : XalanDOMString();
- const XalanDOMString& desturi =
getResultNamespaceForPrefix(prefix);
- const XalanDOMString& srcURI = theNode.getNodeValue();
-
- if(equals(srcURI, desturi) == false)
+ if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
+ {
+ if (fOnlyIfPrefixNotPresent == true)
+ {
+ if
(m_resultNamespacesStack.prefixIsPresentLocal(prefix) == false)
+ {
+ const XalanDOMString& desturi =
getResultNamespaceForPrefix(prefix);
+ const XalanDOMString& srcURI =
theNode.getNodeValue();
+
+ if(equals(srcURI, desturi) == false)
+ {
+
addResultAttribute(thePendingAttributes, aname, srcURI);
+ }
+ }
+ }
+ else
{
- addResultAttribute(thePendingAttributes, aname, srcURI);
+ const XalanDOMString& desturi =
getResultNamespaceForPrefix(prefix);
+ const XalanDOMString& srcURI = theNode.getNodeValue();
+
+ if(equals(srcURI, desturi) == false)
+ {
+ addResultAttribute(thePendingAttributes, aname,
srcURI);
+ }
}
}
}
@@ -2294,7 +2311,7 @@
const XalanNode* const attr = nnm->item(i);
assert(attr != 0);
- addResultNamespace(*attr, thePendingAttributes);
+ addResultNamespace(*attr, thePendingAttributes, true);
}
parent = parent->getParentNode();
1.60 +2 -1 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.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- XSLTEngineImpl.hpp 2001/01/26 22:02:36 1.59
+++ XSLTEngineImpl.hpp 2001/01/30 22:03:41 1.60
@@ -1473,7 +1473,8 @@
void
addResultNamespace(
const XalanNode& theNode,
- AttributeListImpl& thePendingAttributes);
+ AttributeListImpl& thePendingAttributes,
+ bool fOnlyIfPrefixNotPresent
= false);
/**
* The top of this stack should contain the currently processed