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...@apache.org on 2002/05/16 02:48:20 UTC
cvs commit: xml-xalan/c/src/XSLT ElemElement.cpp ElemLiteralResult.cpp ElemLiteralResult.hpp
dbertoni 02/05/15 17:48:20
Modified: c/src/XSLT ElemElement.cpp ElemLiteralResult.cpp
ElemLiteralResult.hpp
Log:
Avoid mucking with default namespace unless necessary.
Revision Changes Path
1.38 +11 -2 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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- ElemElement.cpp 6 May 2002 05:31:57 -0000 1.37
+++ ElemElement.cpp 16 May 2002 00:48:20 -0000 1.38
@@ -277,9 +277,18 @@
{
if (namespaceLen > 0)
{
- outputResultNamespaces(executionContext, hasUnresolvedPrefix);
+ outputResultNamespaces(executionContext, hasUnresolvedPrefix, true);
- executionContext.addResultAttribute(DOMServices::s_XMLNamespace, elemNameSpace);
+ const XalanDOMString* const theDefaultNamespace =
+ executionContext.getResultNamespaceForPrefix(s_emptyString);
+
+ if (theDefaultNamespace == 0 ||
+ equals(*theDefaultNamespace, elemNameSpace) == false)
+ {
+ executionContext.addResultAttribute(
+ DOMServices::s_XMLNamespace,
+ elemNameSpace);
+ }
}
else
{
1.49 +20 -16 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.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- ElemLiteralResult.cpp 6 May 2002 05:31:57 -0000 1.48
+++ ElemLiteralResult.cpp 16 May 2002 00:48:20 -0000 1.49
@@ -101,7 +101,8 @@
columnNumber,
xslToken),
m_elementName(name),
- m_avts()
+ m_avts(),
+ m_hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ? true : false)
{
const unsigned int nAttrs = atts.getLength();
@@ -296,24 +297,27 @@
m_namespacesHandler.outputResultNamespaces(executionContext);
- // OK, let's check to make sure we don't have to change the default namespace...
- const XalanDOMString* const theCurrentDefaultNamespace =
- executionContext.getResultNamespaceForPrefix(s_emptyString);
-
- if (theCurrentDefaultNamespace != 0)
+ if (m_hasPrefix == false)
{
- const XalanDOMString* const theElementDefaultNamespace =
- m_namespacesHandler.getNamespace(s_emptyString);
+ // OK, let's check to make sure we don't have to change the default namespace...
+ const XalanDOMString* const theCurrentDefaultNamespace =
+ executionContext.getResultNamespaceForPrefix(s_emptyString);
- if (theElementDefaultNamespace == 0)
- {
- // There was no default namespace, so we have to turn the
- // current one off.
- executionContext.addResultAttribute(DOMServices::s_XMLNamespace, s_emptyString);
- }
- else if (equals(*theCurrentDefaultNamespace, *theElementDefaultNamespace) == false)
+ if (theCurrentDefaultNamespace != 0)
{
- executionContext.addResultAttribute(DOMServices::s_XMLNamespace, *theElementDefaultNamespace);
+ const XalanDOMString* const theElementDefaultNamespace =
+ m_namespacesHandler.getNamespace(s_emptyString);
+
+ if (theElementDefaultNamespace == 0)
+ {
+ // There was no default namespace, so we have to turn the
+ // current one off.
+ executionContext.addResultAttribute(DOMServices::s_XMLNamespace, s_emptyString);
+ }
+ else if (equals(*theCurrentDefaultNamespace, *theElementDefaultNamespace) == false)
+ {
+ executionContext.addResultAttribute(DOMServices::s_XMLNamespace, *theElementDefaultNamespace);
+ }
}
}
1.24 +5 -0 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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ElemLiteralResult.hpp 4 Jan 2002 01:59:49 -0000 1.23
+++ ElemLiteralResult.hpp 16 May 2002 00:48:20 -0000 1.24
@@ -188,6 +188,11 @@
* A vector to keep track of the attribute elements.
*/
AVTVectorType m_avts;
+
+ /**
+ * If true, the literal result element has a namespace prefix...
+ */
+ const bool m_hasPrefix;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org