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 2004/04/03 04:27:22 UTC
cvs commit: xml-xalan/c/src/xalanc/XSLT StylesheetRoot.cpp
dbertoni 2004/04/02 18:27:22
Modified: c/src/xalanc/XSLT StylesheetRoot.cpp
Log:
Cleanup inefficiencies and bug in shouldStripSourceNode().
Revision Changes Path
1.14 +53 -61 xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- StylesheetRoot.cpp 26 Feb 2004 22:58:58 -0000 1.13
+++ StylesheetRoot.cpp 3 Apr 2004 02:27:22 -0000 1.14
@@ -808,75 +808,67 @@
{
bool strip = false;
- XalanNode* parent = DOMServices::getParentOfNode(textNode);
+ XalanNode* const parent = textNode.getParentNode();
+ assert(parent != 0 && parent->getNodeType() == XalanNode::ELEMENT_NODE);
+
+ XPath::eMatchScore highPreserveScore = XPath::eMatchScoreNone;
+ XPath::eMatchScore highStripScore = XPath::eMatchScoreNone;
- while(0 != parent)
{
- if(parent->getNodeType() == XalanNode::ELEMENT_NODE)
+ const XPathVectorType& theElements =
+ m_whitespacePreservingElements;
+
+ const XPathVectorType::size_type nTests =
+ theElements.size();
+
+ for(XPathVectorType::size_type i = 0; i < nTests; i++)
{
- XPath::eMatchScore highPreserveScore = XPath::eMatchScoreNone;
- XPath::eMatchScore highStripScore = XPath::eMatchScoreNone;
+ const XPath* const matchPat = theElements[i];
+ assert(matchPat != 0);
+
+ const XPath::eMatchScore score = matchPat->getMatchScore(parent, executionContext);
+
+ if(score > highPreserveScore)
+ highPreserveScore = score;
+ }
+ }
+
+ {
+ const XPathVectorType& theElements =
+ m_whitespaceStrippingElements;
+
+ const XPathVectorType::size_type nTests =
+ theElements.size();
- {
- const XPathVectorType& theElements =
- m_whitespacePreservingElements;
-
- const XPathVectorType::size_type nTests =
- theElements.size();
-
- for(XPathVectorType::size_type i = 0; i < nTests; i++)
- {
- const XPath* const matchPat = theElements[i];
- assert(matchPat != 0);
-
- const XPath::eMatchScore score = matchPat->getMatchScore(parent, executionContext);
-
- if(score > highPreserveScore)
- highPreserveScore = score;
- }
- }
-
- {
- const XPathVectorType& theElements =
- m_whitespaceStrippingElements;
-
- const XPathVectorType::size_type nTests =
- theElements.size();
-
- for(XPathVectorType::size_type i = 0; i < nTests; i++)
- {
- const XPath* const matchPat =
+ for(XPathVectorType::size_type i = 0; i < nTests; i++)
+ {
+ const XPath* const matchPat =
theElements[i];
- assert(matchPat != 0);
+ assert(matchPat != 0);
- const XPath::eMatchScore score = matchPat->getMatchScore(parent, executionContext);
+ const XPath::eMatchScore score = matchPat->getMatchScore(parent, executionContext);
- if(score > highStripScore)
- highStripScore = score;
- }
- }
-
- if(highPreserveScore > XPath::eMatchScoreNone ||
- highStripScore > XPath::eMatchScoreNone)
- {
- if(highPreserveScore > highStripScore)
- {
- strip = false;
- }
- else if(highStripScore > highPreserveScore)
- {
- strip = true;
- }
- else
- {
- executionContext.warn(
- XalanMessageLoader::getMessage(XalanMessages::MatchConflictBetween_strip_space_preserve_space));
- }
- break;
- }
+ if(score > highStripScore)
+ highStripScore = score;
+ }
+ }
+
+ if(highPreserveScore > XPath::eMatchScoreNone ||
+ highStripScore > XPath::eMatchScoreNone)
+ {
+ if(highPreserveScore > highStripScore)
+ {
+ strip = false;
+ }
+ else if(highStripScore > highPreserveScore)
+ {
+ strip = true;
+ }
+ else
+ {
+ executionContext.warn(
+ XalanMessageLoader::getMessage(XalanMessages::MatchConflictBetween_strip_space_preserve_space));
}
-
- parent = parent->getParentNode();
}
return strip;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org