dbertoni 01/02/10 21:15:14
Modified: c/src/XSLT ElemAttribute.cpp
Log:
Fixed bug where xml namespace was being added to the result tree.
Revision Changes Path
1.18 +41 -26 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ElemAttribute.cpp 2001/02/09 23:24:11 1.17
+++ ElemAttribute.cpp 2001/02/11 05:15:13 1.18
@@ -272,43 +272,58 @@
}
}
// Note we are using original attribute name for these tests.
- else if(executionContext.isElementPending() == true
- && !equals(origAttrName,
DOMServices::s_XMLNamespace))
+ else if(executionContext.isElementPending() == true &&
+ !equals(origAttrName,
DOMServices::s_XMLNamespace))
{
- // make sure that if a prefix is specified on the
attribute name, it is valid
- indexOfNSSep = indexOf(origAttrName,
XalanUnicode::charColon);
-
- if(indexOfNSSep < origAttrNameLength)
+ // Don't try to create a namespace declaration for
anything that
+ // starts with xml:
+ if (startsWith(origAttrName, DOMServices::s_XMLString)
== true)
{
- const XalanDOMString nsprefix =
substring(origAttrName, 0, indexOfNSSep);
-
- assign(attrNameSpace,
getNamespaceForPrefix(nsprefix));
+ // This just fakes out the test below. It
would be better if
+ // we had a better way of testing this...
+ indexOfNSSep = origAttrNameLength;
+ }
+ else
+ {
+ // make sure that if a prefix is specified on
the attribute name, it is valid
+ indexOfNSSep = indexOf(origAttrName,
XalanUnicode::charColon);
- if (isEmpty(attrNameSpace))
+ if(indexOfNSSep < origAttrNameLength)
{
- // Could not resolve prefix
- executionContext.warn("Warning: Could
not resolve prefix " + nsprefix, sourceNode, this);
- }
- else
- {
- // Check to see if there's already a
namespace declaration in scope...
- const XalanDOMString& prefix =
executionContext.getResultPrefixForNamespace(attrNameSpace);
+
StylesheetExecutionContext::GetAndReleaseCachedString
nsprefixGuard(executionContext);
+
+ XalanDOMString& nsprefix =
nsprefixGuard.get();
- if (length(prefix) == 0)
+ nsprefix = substring(origAttrName, 0,
indexOfNSSep);
+
+ assign(attrNameSpace,
getNamespaceForPrefix(nsprefix));
+
+ if (isEmpty(attrNameSpace))
{
- // We need to generate a
namespace declaration...
-
StylesheetExecutionContext::GetAndReleaseCachedString
nsDeclGuard(executionContext);
+ // Could not resolve prefix
+ executionContext.warn("Warning:
Could not resolve prefix " + nsprefix, sourceNode, this);
+ }
+ else
+ {
+ // Check to see if there's
already a namespace declaration in scope...
+ const XalanDOMString& prefix
= executionContext.getResultPrefixForNamespace(attrNameSpace);
+
+ if (length(prefix) == 0)
+ {
+ // We need to generate
a namespace declaration...
+
StylesheetExecutionContext::GetAndReleaseCachedString
nsDeclGuard(executionContext);
- XalanDOMString& nsDecl
= nsDeclGuard.get();
+ XalanDOMString&
nsDecl = nsDeclGuard.get();
- reserve(nsDecl,
DOMServices::s_XMLNamespaceWithSeparatorLength + length(nsprefix) + 1);
+ reserve(nsDecl,
DOMServices::s_XMLNamespaceWithSeparatorLength + length(nsprefix) + 1);
- assign(nsDecl,
DOMServices::s_XMLNamespaceWithSeparator);
+ assign(nsDecl,
DOMServices::s_XMLNamespaceWithSeparator);
- append(nsDecl, nsprefix);
+ append(nsDecl,
nsprefix);
- // Add the namespace
declaration...
-
executionContext.addResultAttribute(nsDecl, attrNameSpace);
+ // Add the namespace
declaration...
+
executionContext.addResultAttribute(nsDecl, attrNameSpace);
+ }
}
}
}