dbertoni 2002/11/05 21:09:49
Modified: c/src/XSLT ElemApplyTemplates.cpp ElemApplyTemplates.hpp
ElemAttribute.cpp ElemAttribute.hpp ElemCopy.hpp
ElemCopyOf.cpp ElemCopyOf.hpp ElemLiteralResult.cpp
ElemLiteralResult.hpp ElemTemplateElement.cpp
ElemTemplateElement.hpp ElemText.cpp ElemText.hpp
ElemTextLiteral.cpp ElemTextLiteral.hpp
ElemValueOf.cpp ElemValueOf.hpp SelectionEvent.cpp
SelectionEvent.hpp Stylesheet.cpp Stylesheet.hpp
StylesheetConstructionContext.hpp
StylesheetConstructionContextDefault.cpp
StylesheetConstructionContextDefault.hpp
StylesheetHandler.cpp StylesheetRoot.cpp
StylesheetRoot.hpp TraceListenerDefault.cpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
XSLTProcessor.hpp XalanElemTextLiteralAllocator.cpp
XalanElemTextLiteralAllocator.hpp
Log:
More cleanup and block allocators for stylesheet elements.
Revision Changes Path
1.28 +1 -12 xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp
Index: ElemApplyTemplates.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ElemApplyTemplates.cpp 5 Nov 2002 05:19:24 -0000 1.27
+++ ElemApplyTemplates.cpp 6 Nov 2002 05:09:48 -0000 1.28
@@ -91,7 +91,6 @@
lineNumber,
columnNumber,
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES),
- m_isDefaultTemplate(false),
m_mode(0)
{
const unsigned int nAttrs = atts.getLength();
@@ -157,16 +156,6 @@
void
-ElemApplyTemplates::setDefaultTemplate(bool value)
-{
- m_isDefaultTemplate = value;
-
- ParentType::setDefaultTemplate(value);
-}
-
-
-
-void
ElemApplyTemplates::execute(StylesheetExecutionContext&
executionContext) const
{
assert(m_selectPattern != 0 && m_mode != 0);
@@ -192,7 +181,7 @@
const XalanQName* const currentMode =
executionContext.getCurrentMode();
assert(currentMode != 0);
- if (m_isDefaultTemplate == false &&
+ if (isDefaultTemplate() == false &&
!m_mode->equals(*currentMode))
{
executionContext.setCurrentMode(m_mode);
1.14 +1 -17 xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp
Index: ElemApplyTemplates.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ElemApplyTemplates.hpp 5 Nov 2002 05:19:24 -0000 1.13
+++ ElemApplyTemplates.hpp 6 Nov 2002 05:09:48 -0000 1.14
@@ -104,20 +104,6 @@
virtual
~ElemApplyTemplates();
- /**
- * Determines whether this is the default template
- *
- * @return true if the template is the default
- */
- bool
- isDefaultTemplate() const
- {
- return m_isDefaultTemplate;
- }
-
- virtual void
- setDefaultTemplate(bool value);
-
// These methods are inherited from ElemTemplateElement ...
virtual const XalanDOMString&
@@ -132,8 +118,6 @@
childTypeAllowed(int xslToken) const;
private:
-
- bool m_isDefaultTemplate;
const XalanQName* m_mode;
};
1.42 +9 -9 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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- ElemAttribute.cpp 31 Oct 2002 07:15:56 -0000 1.41
+++ ElemAttribute.cpp 6 Nov 2002 05:09:48 -0000 1.42
@@ -89,8 +89,8 @@
lineNumber,
columnNumber,
StylesheetConstructionContext::ELEMNAME_ATTRIBUTE),
- m_pNameAVT(0),
- m_pNamespaceAVT(0)
+ m_nameAVT(0),
+ m_namespaceAVT(0)
{
const unsigned int nAttrs = atts.getLength();
@@ -100,12 +100,12 @@
if(equals(aname, Constants::ATTRNAME_NAME))
{
- m_pNameAVT =
+ m_nameAVT =
constructionContext.createAVT(getLocator(),
aname, atts.getValue(i), *this);
}
else if(equals(aname, Constants::ATTRNAME_NAMESPACE))
{
- m_pNamespaceAVT =
+ m_namespaceAVT =
constructionContext.createAVT(getLocator(),
aname, atts.getValue(i), *this);
}
else if(!(isAttrOK(aname, atts, i, constructionContext) ||
@@ -118,7 +118,7 @@
}
}
- if(0 == m_pNameAVT)
+ if(0 == m_nameAVT)
{
constructionContext.error(
"xsl:attribute must have a 'name' attribute",
@@ -146,7 +146,7 @@
void
ElemAttribute::execute(StylesheetExecutionContext&
executionContext) const
{
- assert(m_pNameAVT != 0);
+ assert(m_nameAVT != 0);
ElemTemplateElement::execute(executionContext);
@@ -156,7 +156,7 @@
XalanNode* sourceNode = executionContext.getCurrentNode();
- m_pNameAVT->evaluate(attrName, sourceNode, *this, executionContext);
+ m_nameAVT->evaluate(attrName, sourceNode, *this, executionContext);
if(XalanQName::isValidQName(attrName) == false)
{
@@ -182,9 +182,9 @@
XalanDOMString& attrNameSpace =
attrNameSpaceGuard.get();
- if(0 != m_pNamespaceAVT)
+ if(0 != m_namespaceAVT)
{
- m_pNamespaceAVT->evaluate(attrNameSpace, sourceNode,
*this, executionContext);
+ m_namespaceAVT->evaluate(attrNameSpace, sourceNode,
*this, executionContext);
indexOfNSSep = indexOf(origAttrName,
XalanUnicode::charColon);
1.11 +3 -3 xml-xalan/c/src/XSLT/ElemAttribute.hpp
Index: ElemAttribute.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ElemAttribute.hpp 6 Jun 2001 21:55:18 -0000 1.10
+++ ElemAttribute.hpp 6 Nov 2002 05:09:48 -0000 1.11
@@ -123,8 +123,8 @@
ElemAttribute(const ElemAttribute &);
ElemAttribute& operator=(const ElemAttribute &);
- const AVT* m_pNameAVT;
- const AVT* m_pNamespaceAVT;
+ const AVT* m_nameAVT;
+ const AVT* m_namespaceAVT;
};
1.10 +0 -1 xml-xalan/c/src/XSLT/ElemCopy.hpp
Index: ElemCopy.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ElemCopy.hpp 9 Mar 2001 16:20:05 -0000 1.9
+++ ElemCopy.hpp 6 Nov 2002 05:09:48 -0000 1.10
@@ -96,7 +96,6 @@
virtual void
execute(StylesheetExecutionContext& executionContext) const;
-
};
1.29 +16 -11 xml-xalan/c/src/XSLT/ElemCopyOf.cpp
Index: ElemCopyOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ElemCopyOf.cpp 24 Sep 2002 01:42:34 -0000 1.28
+++ ElemCopyOf.cpp 6 Nov 2002 05:09:48 -0000 1.29
@@ -89,9 +89,10 @@
lineNumber,
columnNumber,
StylesheetConstructionContext::ELEMNAME_COPY_OF),
- m_selectPattern(0),
- m_isDot(false)
+ m_selectPattern(0)
{
+ bool isSelectCurrentNode = false;
+
const unsigned int nAttrs = atts.getLength();
for(unsigned int i = 0; i < nAttrs; ++i)
@@ -105,10 +106,12 @@
if (avalue[0] == XalanUnicode::charFullStop &&
avalue[1] == 0)
{
- m_isDot = true;
+ isSelectCurrentNode = true;
+ }
+ else
+ {
+ m_selectPattern =
constructionContext.createXPath(getLocator(), avalue, *this);
}
-
- m_selectPattern =
constructionContext.createXPath(getLocator(), avalue, *this);
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
@@ -119,7 +122,7 @@
}
}
- if (m_selectPattern == 0)
+ if (isSelectCurrentNode == false && m_selectPattern == 0)
{
constructionContext.error(
"xsl:copy-of must have a 'select' attribute",
@@ -143,23 +146,25 @@
{
ElemTemplateElement::execute(executionContext);
- assert(m_selectPattern != 0);
-
XalanNode* const sourceNode = executionContext.getCurrentNode();
assert(sourceNode != 0);
- if (m_isDot == true)
+ if (m_selectPattern == 0)
{
if(0 != executionContext.getTraceListeners())
{
+
StylesheetExecutionContext::BorrowReturnMutableNodeRefList
theNodeList(executionContext);
+
+ theNodeList->addNode(sourceNode);
+
executionContext.fireSelectEvent(
SelectionEvent(
executionContext,
sourceNode,
*this,
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
- *m_selectPattern,
- XObjectPtr()));
+
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING(".")),
+
executionContext.getXObjectFactory().createNodeSet(theNodeList)));
}
executionContext.cloneToResultTree(*sourceNode, this);
1.13 +1 -3 xml-xalan/c/src/XSLT/ElemCopyOf.hpp
Index: ElemCopyOf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemCopyOf.hpp 10 Jul 2002 06:49:07 -0000 1.12
+++ ElemCopyOf.hpp 6 Nov 2002 05:09:48 -0000 1.13
@@ -112,8 +112,6 @@
private:
const XPath* m_selectPattern;
-
- bool m_isDot;
};
1.57 +10 -7 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.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- ElemLiteralResult.cpp 31 Oct 2002 07:15:56 -0000 1.56
+++ ElemLiteralResult.cpp 6 Nov 2002 05:09:48 -0000 1.57
@@ -92,10 +92,9 @@
StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT),
m_elementName(constructionContext.getPooledString(name)),
m_avts(0),
- m_avtsCount(0),
- m_hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ?
true : false)
+ m_avtsCount(0)
{
- init(constructionContext, stylesheetTree, atts);
+ init(constructionContext, stylesheetTree, name, atts);
}
@@ -115,10 +114,9 @@
xslToken),
m_elementName(constructionContext.getPooledString(name)),
m_avts(0),
- m_avtsCount(0),
- m_hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ?
true : false)
+ m_avtsCount(0)
{
- init(constructionContext, stylesheetTree, atts);
+ init(constructionContext, stylesheetTree, name, atts);
}
@@ -127,8 +125,13 @@
ElemLiteralResult::init(
StylesheetConstructionContext& constructionContext,
Stylesheet&
stylesheetTree,
+ const XalanDOMChar* name,
const AttributeList& atts)
{
+ assert(name != 0);
+
+ hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ? true
: false);
+
const unsigned int nAttrs = atts.getLength();
// This over-allocates, but we probably won't waste that much space.
@@ -295,7 +298,7 @@
m_namespacesHandler.outputResultNamespaces(executionContext);
- if (m_hasPrefix == false)
+ if (hasPrefix() == false)
{
// OK, let's check to make sure we don't have to change the
default namespace...
const XalanDOMString* const
theCurrentDefaultNamespace =
1.30 +5 -8 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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- ElemLiteralResult.hpp 31 Oct 2002 07:15:56 -0000 1.29
+++ ElemLiteralResult.hpp 6 Nov 2002 05:09:48 -0000 1.30
@@ -123,14 +123,16 @@
/**
* Do common initialization.
*
- * @param constructionContext context for construction of object
- * @param stylesheetTree stylesheet containing element
- * @param atts list of attributes for element
+ * @param constructionContext The current onstruction context.
+ * @param stylesheetTree The stylesheet containing the element.
+ * @param name The name of the element.
+ * @param atts The list of attributes for the element.
*/
void
init(
StylesheetConstructionContext& constructionContext,
Stylesheet&
stylesheetTree,
+ const XalanDOMChar* name,
const AttributeList& atts);
/**
@@ -191,11 +193,6 @@
* The size of m_avts, once the stylesheet is compiled...
*/
unsigned int m_avtsCount;
-
- /**
- * If true, the literal result element has a namespace prefix...
- */
- const bool m_hasPrefix;
};
1.84 +17 -23 xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
Index: ElemTemplateElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- ElemTemplateElement.cpp 5 Nov 2002 05:19:24 -0000 1.83
+++ ElemTemplateElement.cpp 6 Nov 2002 05:09:48 -0000 1.84
@@ -125,7 +125,6 @@
int
xslToken) :
XalanElement(),
PrefixResolver(),
- m_finishedConstruction(false),
m_namespacesHandler(
constructionContext,
stylesheetTree.getNamespacesHandler(),
@@ -134,16 +133,14 @@
m_stylesheet(stylesheetTree),
m_lineNumber(lineNumber),
m_columnNumber(columnNumber),
- m_defaultSpace(true),
m_xslToken(xslToken),
m_parentNode(0),
m_nextSibling(0),
m_previousSibling(0),
m_firstChild(0),
- m_surrogateChildren(*this),
m_baseIndentifier(constructionContext.getPooledString(stylesheetTree.getCurrentIncludeBaseIdentifier())),
- m_optimizationFlags(eCanGenerateAttributes),
- m_locatorProxy(*this)
+ m_locatorProxy(*this),
+ m_flags(eCanGenerateAttributes)
{
}
@@ -156,20 +153,17 @@
int
xslToken) :
XalanElement(),
PrefixResolver(),
- m_finishedConstruction(false),
m_namespacesHandler(),
m_stylesheet(stylesheetTree),
m_lineNumber(lineNumber),
m_columnNumber(columnNumber),
- m_defaultSpace(true),
m_xslToken(xslToken),
m_parentNode(0),
m_nextSibling(0),
m_previousSibling(0),
m_firstChild(0),
- m_surrogateChildren(*this),
m_baseIndentifier(s_emptyString),
- m_optimizationFlags(eCanGenerateAttributes),
+ m_flags(eCanGenerateAttributes),
m_locatorProxy(*this)
{
}
@@ -228,15 +222,11 @@
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
- if (equals(spaceVal, Constants::ATTRVAL_DEFAULT))
- {
- m_defaultSpace = true;
- }
- else if(equals(spaceVal, Constants::ATTRVAL_PRESERVE) == true)
+ if(equals(spaceVal, Constants::ATTRVAL_PRESERVE) == true)
{
- m_defaultSpace = false;
+ m_flags |= eSpacePreserve;
}
- else
+ else if (equals(spaceVal, Constants::ATTRVAL_DEFAULT) == false)
{
constructionContext.error(
"xml:space has an illegal value",
@@ -359,6 +349,8 @@
void
ElemTemplateElement::setDefaultTemplate(bool value)
{
+ m_flags |= eDefaultTemplate;
+
for (ElemTemplateElement* node = m_firstChild; node != 0; node =
node->m_nextSibling)
{
node->setDefaultTemplate(value);
@@ -851,7 +843,9 @@
const XalanNodeList*
ElemTemplateElement::getChildNodes() const
{
- return &m_surrogateChildren;
+ throw XalanDOMException(XalanDOMException::NOT_SUPPORTED_ERR);
+
+ return 0;
}
@@ -1097,13 +1091,13 @@
(theToken ==
StylesheetConstructionContext::ELEMNAME_VARIABLE ||
theToken ==
StylesheetConstructionContext::ELEMNAME_PARAM))
{
- m_optimizationFlags |= eHasVariables;
+ m_flags |= eHasVariables;
}
if (hasParams() == false &&
theToken ==
StylesheetConstructionContext::ELEMNAME_WITH_PARAM)
{
- m_optimizationFlags |= eHasParams;
+ m_flags |= eHasParams;
}
}
@@ -1116,7 +1110,7 @@
if (theToken ==
StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT &&
m_firstChild->getNextSibling() == 0)
{
- m_optimizationFlags |= eHasSingleTextChild;
+ m_flags |= eHasSingleTextChild;
}
else if (theToken ==
StylesheetConstructionContext::ELEMNAME_CALL_TEMPLATE &&
m_firstChild->getNextSibling() == 0)
@@ -1126,7 +1120,7 @@
// template directly...
if (m_firstChild->hasParams() == false)
{
- m_optimizationFlags |= eHasDirectTemplate;
+ m_flags |= eHasDirectTemplate;
ElemCallTemplate* const
theCallTemplateChild =
#if defined(XALAN_OLD_STYLE_CASTS)
@@ -1143,7 +1137,7 @@
else if (canGenerateAttributes() == false &&
theToken !=
StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT)
{
- m_optimizationFlags |= eCanGenerateAttributes;
+ m_flags |= eCanGenerateAttributes;
}
}
}
@@ -1272,7 +1266,7 @@
if (isEmpty(prefix) == false)
{
- if(m_finishedConstruction == true)
+ if(finishedConstruction() == true)
{
if (equals(prefix, DOMServices::s_XMLString) == true)
{
1.51 +126 -66 xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
Index: ElemTemplateElement.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- ElemTemplateElement.hpp 5 Nov 2002 05:19:25 -0000 1.50
+++ ElemTemplateElement.hpp 6 Nov 2002 05:09:48 -0000 1.51
@@ -72,7 +72,6 @@
#include <XalanDOM/XalanDOMString.hpp>
#include <XalanDOM/XalanElement.hpp>
#include <XalanDOM/XalanEmptyNamedNodeMap.hpp>
-#include <XalanDOM/XalanNodeListSurrogate.hpp>
@@ -408,12 +407,21 @@
}
/**
- * Set a flag indicating construction of the element is completed.
+ * Set the flag indicating construction of the element is completed.
*/
void
finishedConstruction()
{
- m_finishedConstruction = true;
+ setFlag(eFinishedConstruction, true);
+ }
+
+ /**
+ * Get the flag indicating construction of the element is completed.
+ */
+ bool
+ finishedConstruction() const
+ {
+ return getFlag(eFinishedConstruction);
}
/**
@@ -704,24 +712,58 @@
virtual const XalanDOMString&
getURI() const;
+ class LocatorProxy : public XalanLocator
+ {
+ public:
+
+ LocatorProxy(const ElemTemplateElement& theElement);
+
+ virtual
+ ~LocatorProxy();
+
+ virtual const XMLCh*
+ getPublicId() const;
+
+ virtual const XMLCh*
+ getSystemId() const;
+
+ virtual size_type
+ getLineNumber() const;
+
+ virtual size_type
+ getColumnNumber() const;
+
+ private:
+
+ // Not implemented...
+ LocatorProxy(const LocatorProxy&);
+
+ LocatorProxy&
+ operator=(const LocatorProxy&);
+
+ bool
+ operator==(const LocatorProxy&) const;
+
+ // data members...
+ const ElemTemplateElement& m_element;
+ };
- // These optimization interfaces are new to ElemTemplateElement...
bool
hasParams() const
{
- return m_optimizationFlags & eHasParams ? true : false;
+ return getFlag(eHasParams);
}
bool
hasVariables() const
{
- return m_optimizationFlags & eHasVariables ? true : false;
+ return getFlag(eHasVariables);
}
bool
hasSingleTextChild() const
{
- return m_optimizationFlags & eHasSingleTextChild ? true : false;
+ return getFlag(eHasSingleTextChild);
}
bool
@@ -733,68 +775,63 @@
bool
hasDirectTemplate() const
{
- return m_optimizationFlags & eHasDirectTemplate ? true : false;
+ return getFlag(eHasDirectTemplate);
}
- /**
- *
- * Determine whether or not the instance can generate
- */
bool
canGenerateAttributes() const
{
- return m_optimizationFlags & eCanGenerateAttributes ? true :
false;
+ return getFlag(eCanGenerateAttributes);
}
- class LocatorProxy : public XalanLocator
+ bool
+ isDefaultTemplate() const
{
- public:
-
- LocatorProxy(const ElemTemplateElement& theElement);
-
- virtual
- ~LocatorProxy();
-
- virtual const XMLCh*
- getPublicId() const;
-
- virtual const XMLCh*
- getSystemId() const;
-
- virtual size_type
- getLineNumber() const;
-
- virtual size_type
- getColumnNumber() const;
+ return getFlag(eDefaultTemplate);
+ }
- private:
+protected:
- // Not implemented...
- LocatorProxy(const LocatorProxy&);
+ void
+ canGenerateAttributes(bool value)
+ {
+ setFlag(eCanGenerateAttributes, value);
+ }
- LocatorProxy&
- operator=(const LocatorProxy&);
+ void
+ hasPrefix(bool value)
+ {
+ setFlag(eHasPrefix, value);
+ }
- bool
- operator==(const LocatorProxy&) const;
+ bool
+ hasPrefix() const
+ {
+ return getFlag(eHasPrefix);
+ }
- // data members...
- const ElemTemplateElement& m_element;
- };
+ void
+ preserveSpace(bool value)
+ {
+ setFlag(eSpacePreserve, value);
+ }
-protected:
+ bool
+ preserveSpace() const
+ {
+ return getFlag(eSpacePreserve);
+ }
void
- canGenerateAttributes(bool value)
+ disableOutputEscaping(bool value)
{
- if (value == true)
- {
- m_optimizationFlags |= eCanGenerateAttributes;
- }
- else
- {
- m_optimizationFlags &= ~eCanGenerateAttributes;
- }
+ setFlag(eDisableOutputEscaping, value);
+ }
+
+ bool
+ disableOutputEscaping() const
+ {
+ return getFlag(eDisableOutputEscaping);
}
/**
@@ -840,8 +877,6 @@
virtual bool
childTypeAllowed(int xslToken) const;
- bool m_finishedConstruction;
-
/*
* This object handles all result tree namespace processing.
*/
@@ -851,6 +886,41 @@
private:
+ enum eFlags
+ {
+ eHasParams = 1,
+ eHasSingleTextChild = 2,
+ eHasVariables = 4,
+ eHasDirectTemplate = 8,
+ eCanGenerateAttributes = 16,
+ eDefaultTemplate = 32,
+ eSpacePreserve = 64,
+ eFinishedConstruction = 128,
+ eHasPrefix = 256,
+ eDisableOutputEscaping = 512
+ };
+
+ bool
+ getFlag(eFlags theFlag) const
+ {
+ return m_flags & theFlag ? true : false;
+ }
+
+ void
+ setFlag(
+ eFlags theFlag,
+ bool theValue)
+ {
+ if (theValue == true)
+ {
+ m_flags |= theFlag;
+ }
+ else
+ {
+ m_flags &= ~theFlag;
+ }
+ }
+
/**
* Take the contents of a template element, process it, and
* convert it to a string.
@@ -869,8 +939,6 @@
const int m_lineNumber;
const int m_columnNumber;
- bool m_defaultSpace;
-
const int m_xslToken;
ElemTemplateElement* m_parentNode;
@@ -884,19 +952,11 @@
const ElemTextLiteral* m_textLiteralChild;
};
- const XalanNodeListSurrogate m_surrogateChildren;
-
const XalanDOMString& m_baseIndentifier;
- enum { eHasParams = 1,
- eHasSingleTextChild = 2,
- eHasVariables = 4,
- eHasDirectTemplate = 8,
- eCanGenerateAttributes = 16 };
-
- unsigned m_optimizationFlags;
-
LocatorProxy m_locatorProxy;
+
+ unsigned short m_flags;
static const XalanEmptyNamedNodeMap s_fakeAttributes;
1.10 +6 -6 xml-xalan/c/src/XSLT/ElemText.cpp
Index: ElemText.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemText.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ElemText.cpp 3 Nov 2002 05:51:47 -0000 1.9
+++ ElemText.cpp 6 Nov 2002 05:09:48 -0000 1.10
@@ -86,8 +86,7 @@
stylesheetTree,
lineNumber,
columnNumber,
-
StylesheetConstructionContext::ELEMNAME_TEXT),
- m_disableOutputEscaping(false)
+
StylesheetConstructionContext::ELEMNAME_TEXT)
{
const unsigned int nAttrs = atts.getLength();
@@ -97,10 +96,11 @@
if(equals(aname, Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING))
{
- m_disableOutputEscaping =
- stylesheetTree.getYesOrNo(aname,
-
atts.getValue(i),
-
constructionContext);
+ disableOutputEscaping(
+ stylesheetTree.getYesOrNo(
+ aname,
+ atts.getValue(i),
+ constructionContext));
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
1.7 +2 -4 xml-xalan/c/src/XSLT/ElemText.hpp
Index: ElemText.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemText.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemText.hpp 12 Feb 2001 02:34:53 -0000 1.6
+++ ElemText.hpp 6 Nov 2002 05:09:48 -0000 1.7
@@ -112,7 +112,7 @@
bool
getDisableOutputEscaping() const
{
- return m_disableOutputEscaping;
+ return disableOutputEscaping();
}
virtual const XalanDOMString&
@@ -126,8 +126,6 @@
childTypeAllowed(int xslToken) const;
private:
-
- bool m_disableOutputEscaping; // = false;
};
1.21 +5 -7 xml-xalan/c/src/XSLT/ElemTextLiteral.cpp
Index: ElemTextLiteral.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ElemTextLiteral.cpp 5 Nov 2002 05:19:25 -0000 1.20
+++ ElemTextLiteral.cpp 6 Nov 2002 05:09:48 -0000 1.21
@@ -80,22 +80,20 @@
const XMLCh* ch,
XalanDOMString::size_type start,
XalanDOMString::size_type length,
- bool isCData,
- bool
preserveSpace,
- bool
disableOutputEscaping) :
+ bool
fPreserveSpace,
+ bool
fDisableOutputEscaping) :
ElemTemplateElement(
stylesheetTree,
lineNumber,
columnNumber,
StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT),
- m_isCData(isCData),
- m_preserveSpace(preserveSpace),
- m_disableOutputEscaping(disableOutputEscaping),
m_isWhitespace(isXMLWhitespace(ch, start, length)),
// Always null-terminate our buffer, since we may need it that way.
m_ch(constructionContext.allocateXalanDOMCharVector(ch + start, length,
true)),
m_length(length)
{
+ disableOutputEscaping(fDisableOutputEscaping);
+ preserveSpace(fPreserveSpace);
}
@@ -127,7 +125,7 @@
{
ElemTemplateElement::execute(executionContext);
- if(!m_disableOutputEscaping)
+ if(disableOutputEscaping() == false)
{
executionContext.characters(m_ch, 0, m_length);
}
1.16 +6 -11 xml-xalan/c/src/XSLT/ElemTextLiteral.hpp
Index: ElemTextLiteral.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ElemTextLiteral.hpp 21 Sep 2002 01:24:41 -0000 1.15
+++ ElemTextLiteral.hpp 6 Nov 2002 05:09:48 -0000 1.16
@@ -86,9 +86,8 @@
* @param ch pointer to character string for element
* @param start starting offset of element
* @param length number of characters in element
- * @param isCData true if a CDATA element
- * @param preserveSpace true is space should be preserved
- * @param disableOutputEscaping true if output escaping should be
disabled
+ * @param fPreserveSpace true is space should be preserved
+ * @param fDisableOutputEscaping true if output escaping should be
disabled
*/
ElemTextLiteral(
StylesheetConstructionContext& constructionContext,
@@ -98,9 +97,8 @@
const XalanDOMChar* ch,
XalanDOMString::size_type start,
XalanDOMString::size_type length,
- bool isCData,
- bool
preserveSpace,
- bool
disableOutputEscaping);
+ bool
fPreserveSpace,
+ bool
fDisableOutputEscaping);
virtual
~ElemTextLiteral();
@@ -113,7 +111,7 @@
bool
isPreserveSpace() const
{
- return m_preserveSpace;
+ return preserveSpace();
}
const XalanDOMChar*
@@ -147,10 +145,7 @@
ElemTextLiteral&
operator=(const ElemTextLiteral&);
- const bool m_isCData;
- const bool m_preserveSpace;
- const bool m_disableOutputEscaping;
- const bool m_isWhitespace;
+ const bool m_isWhitespace;
const XalanDOMChar* const m_ch;
const XalanDOMString::size_type m_length;
1.32 +35 -24 xml-xalan/c/src/XSLT/ElemValueOf.cpp
Index: ElemValueOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ElemValueOf.cpp 24 Sep 2002 05:59:38 -0000 1.31
+++ ElemValueOf.cpp 6 Nov 2002 05:09:48 -0000 1.32
@@ -95,10 +95,10 @@
lineNumber,
columnNumber,
StylesheetConstructionContext::ELEMNAME_VALUE_OF),
- m_selectPattern(0),
- m_disableOutputEscaping(false),
- m_isDot(false)
+ m_selectPattern(0)
{
+ bool isSelectCurrentNode = false;
+
const unsigned int nAttrs = atts.getLength();
for(unsigned int i = 0; i < nAttrs; i++)
@@ -112,19 +112,24 @@
if (avalue[0] == XalanUnicode::charFullStop &&
avalue[1] == 0)
{
- m_isDot = true;
+ isSelectCurrentNode = true;
+ }
+ else
+ {
+ m_selectPattern =
+ constructionContext.createXPath(
+ getLocator(),
+ avalue,
+ *this);
}
-
- m_selectPattern =
- constructionContext.createXPath(
- getLocator(),
- avalue,
- *this);
}
else if (equals(aname,
Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING))
{
- m_disableOutputEscaping =
-
getStylesheet().getYesOrNo(aname, atts.getValue(i), constructionContext);
+ disableOutputEscaping(
+ getStylesheet().getYesOrNo(
+ aname,
+ atts.getValue(i),
+ constructionContext));
}
else if(!(isAttrOK(aname, atts, i, constructionContext) ||
processSpaceAttr(aname, atts, i,
constructionContext)))
@@ -136,7 +141,7 @@
}
}
- if(0 == m_selectPattern)
+ if(isSelectCurrentNode == false && m_selectPattern == 0)
{
constructionContext.error(
"xsl:value-of requires a 'select' attribute",
@@ -169,9 +174,9 @@
XalanNode* const sourceNode = executionContext.getCurrentNode();
assert(sourceNode != 0);
- if (m_isDot == true)
+ if (m_selectPattern == 0)
{
- if (m_disableOutputEscaping == false)
+ if (disableOutputEscaping() == false)
{
executionContext.characters(*sourceNode);
}
@@ -182,7 +187,11 @@
if(0 != executionContext.getTraceListeners())
{
- fireSelectionEvent(executionContext, sourceNode,
DOMServices::getNodeData(*sourceNode));
+ const
StylesheetExecutionContext::GetAndReleaseCachedString
theString(executionContext);
+
+ DOMServices::getNodeData(*sourceNode, theString.get());
+
+ fireSelectionEvent(executionContext, sourceNode,
theString.get());
}
}
else
@@ -200,7 +209,7 @@
if (XObject::eTypeNull != type)
{
- if (m_disableOutputEscaping == false)
+ if (disableOutputEscaping() == false)
{
executionContext.characters(value);
}
@@ -235,11 +244,13 @@
const XObjectPtr
theValue) const
{
executionContext.fireSelectEvent(
- SelectionEvent(
- executionContext,
- sourceNode,
- *this,
-
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
- *m_selectPattern,
- theValue));
+ SelectionEvent(
+ executionContext,
+ sourceNode,
+ *this,
+
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
+ m_selectPattern == 0 ?
+
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING(".")) :
+
m_selectPattern->getExpression().getCurrentPattern(),
+ theValue));
}
1.14 +0 -10 xml-xalan/c/src/XSLT/ElemValueOf.hpp
Index: ElemValueOf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ElemValueOf.hpp 2 May 2001 15:55:50 -0000 1.13
+++ ElemValueOf.hpp 6 Nov 2002 05:09:48 -0000 1.14
@@ -124,16 +124,6 @@
* The select pattern used to locate the value.
*/
const XPath* m_selectPattern;
-
- /**
- * Tells if this element should disable escaping.
- */
- bool m_disableOutputEscaping;
-
- /**
- * True if the select pattern is '.'
- */
- bool m_isDot;
};
1.7 +23 -9 xml-xalan/c/src/XSLT/SelectionEvent.cpp
Index: SelectionEvent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/SelectionEvent.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SelectionEvent.cpp 6 Mar 2001 21:22:56 -0000 1.6
+++ SelectionEvent.cpp 6 Nov 2002 05:09:48 -0000 1.7
@@ -57,14 +57,10 @@
#include "SelectionEvent.hpp"
- /**
- * Create an event originating at the given node of the style tree.
- * @param processor The XSLT Processor.
- * @param sourceTree The input source tree.
- * @param sourceNode The current context node.
- * @param m_styleNode node in the style tree reference for the event.
- * Should not be null. That is not enforced.
- */
+
+#include <XPath/XPath.hpp>
+
+
SelectionEvent::SelectionEvent(
StylesheetExecutionContext&
executionContext,
@@ -77,7 +73,25 @@
m_sourceNode(sourceNode),
m_styleNode(styleNode),
m_attributeName(attributeName),
- m_xpath(xpath),
+ m_xpathExpression(xpath.getExpression().getCurrentPattern()),
+ m_selection(selection)
+{
+}
+
+
+
+SelectionEvent::SelectionEvent(
+ StylesheetExecutionContext&
executionContext,
+ const XalanNode*
sourceNode,
+ const ElemTemplateElement& styleNode,
+ const XalanDOMString& attributeName,
+ const XalanDOMString& xpathExpression,
+ const XObjectPtr
selection) :
+ m_executionContext(executionContext),
+ m_sourceNode(sourceNode),
+ m_styleNode(styleNode),
+ m_attributeName(attributeName),
+ m_xpathExpression(xpathExpression),
m_selection(selection)
{
}
1.8 +33 -13 xml-xalan/c/src/XSLT/SelectionEvent.hpp
Index: SelectionEvent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/SelectionEvent.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SelectionEvent.hpp 8 Jul 2001 18:48:39 -0000 1.7
+++ SelectionEvent.hpp 6 Nov 2002 05:09:48 -0000 1.8
@@ -82,16 +82,17 @@
{
public:
- /**
- * Create an event originating at the given node of the style tree.
- *
- * @param processor XSLT Processor.
- * @param sourceTree input source tree.
- * @param sourceNode current context node.
- * @param mode current mode.
- * @param m_styleNode node in the style tree reference for the event
- * (should not be null, not enforced)
- */
+ /**
+ * Create an event originating at the given node of the style tree.
+ *
+ * @param executionContext The current execution context
+ * @param sourceNode The source node selected.
+ * @param styleNode The node in the style tree reference for the event
+ * @param attributeName The attribute name where the XPath expression
was supplied
+ * @param xpath The XPath instance executed
+ * @param selection The result of evaluating the XPath
+ *
+ */
SelectionEvent(
StylesheetExecutionContext&
executionContext,
const XalanNode*
sourceNode,
@@ -100,6 +101,25 @@
const XPath& xpath,
const XObjectPtr
selection);
+ /**
+ * Create an event originating at the given node of the style tree.
+ *
+ * @param executionContext The current execution context
+ * @param sourceNode The source node selected.
+ * @param styleNode The node in the style tree reference for the event
+ * @param attributeName The attribute name where the XPath expression
was supplied
+ * @param xpathExpression The XPath expression executed
+ * @param selection The result of evaluating the XPath
+ *
+ */
+ SelectionEvent(
+ StylesheetExecutionContext&
executionContext,
+ const XalanNode*
sourceNode,
+ const ElemTemplateElement& styleNode,
+ const XalanDOMString& attributeName,
+ const XalanDOMString& xpathExpression,
+ const XObjectPtr
selection);
+
virtual
~SelectionEvent();
@@ -121,12 +141,12 @@
/**
* The attribute name from which the selection is made.
*/
- const XalanDOMString m_attributeName;
+ const XalanDOMString& m_attributeName;
/**
- * The XPath that executed the selection.
+ * The XPath expression evaluated.
*/
- const XPath& m_xpath;
+ const XalanDOMString& m_xpathExpression;
/**
* The result of the selection. If it's null, m_sourceNode
1.86 +3 -3 xml-xalan/c/src/XSLT/Stylesheet.cpp
Index: Stylesheet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- Stylesheet.cpp 5 Nov 2002 05:19:25 -0000 1.85
+++ Stylesheet.cpp 6 Nov 2002 05:09:48 -0000 1.86
@@ -126,8 +126,6 @@
m_baseIdent(baseIdentifier),
m_keyDeclarations(),
m_XSLTNamespaceURI(constructionContext.getXSLTNamespaceURI()),
- m_whitespacePreservingElements(),
- m_whitespaceStrippingElements(),
m_imports(),
m_importsSize(0),
m_namespaces(),
@@ -712,7 +710,9 @@
if(nTargets != 0)
{
- XalanDOMString tempString;
+
StylesheetConstructionContext::GetAndReleaseCachedString
theGuard(constructionContext);
+
+ XalanDOMString& tempString = theGuard.get();
for(TargetDataVectorType::size_type i = 0;
i < nTargets;
++i)
1.54 +2 -41 xml-xalan/c/src/XSLT/Stylesheet.hpp
Index: Stylesheet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Stylesheet.hpp 5 Nov 2002 05:19:25 -0000 1.53
+++ Stylesheet.hpp 6 Nov 2002 05:09:48 -0000 1.54
@@ -150,7 +150,6 @@
less<const XalanNode*> >
KeyTablesTableType;
typedef vector<Stylesheet*>
StylesheetVectorType;
typedef vector<XalanDOMString>
URLStackType;
- typedef vector<const XPath*>
XPathVectorType;
typedef vector<ElemDecimalFormat*>
ElemDecimalFormatVectorType;
#else
typedef std::map<XalanDOMString, ExtensionNSHandler*>
ExtensionNamespacesMapType;
@@ -163,7 +162,6 @@
typedef std::map<const XalanNode*, KeyTable*>
KeyTablesTableType;
typedef std::vector<Stylesheet*>
StylesheetVectorType;
typedef std::vector<XalanDOMString>
URLStackType;
- typedef std::vector<const XPath*>
XPathVectorType;
typedef std::vector<ElemDecimalFormat*>
ElemDecimalFormatVectorType;
#endif
@@ -539,14 +537,11 @@
* Add an imported stylesheet.
*
* @param theStylesheet The stylesheet to add.
- * @param fFront If true, the stylesheet is added to the front of the
imports, instead of the end.
*/
void
- addImport(
- Stylesheet* theStylesheet,
- bool fFront)
+ addImport(Stylesheet* theStylesheet)
{
- m_imports.insert(fFront ? m_imports.begin() : m_imports.end(),
theStylesheet);
+ m_imports.insert(m_imports.begin(), theStylesheet);
}
/**
@@ -885,30 +880,6 @@
StylesheetExecutionContext& executionContext,
const ParamVectorType& topLevelParams)
const;
- const XPathVectorType&
- getWhitespacePreservingElements() const
- {
- return m_whitespacePreservingElements;
- }
-
- void
- pushWhitespacePreservingElement(const XPath* theXPath)
- {
- m_whitespacePreservingElements.push_back(theXPath);
- }
-
- const XPathVectorType&
- getWhitespaceStrippingElements() const
- {
- return m_whitespaceStrippingElements;
- }
-
- void
- pushWhitespaceStrippingElement(const XPath* theXPath)
- {
- m_whitespaceStrippingElements.push_back(theXPath);
- }
-
// These interfaces are inherited from XalanDocument...
virtual const XalanDOMString&
@@ -1132,16 +1103,6 @@
* found.
*/
XalanDOMString
m_XSLTNamespaceURI;
-
- /**
- * A lookup table of all space preserving elements.
- */
- XPathVectorType
m_whitespacePreservingElements;
-
- /**
- * A lookup table of all space stripping elements.
- */
- XPathVectorType
m_whitespaceStrippingElements;
/**
* A vector of the -imported- XSL Stylesheets.
1.20 +0 -2 xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
Index: StylesheetConstructionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- StylesheetConstructionContext.hpp 5 Nov 2002 05:19:25 -0000 1.19
+++ StylesheetConstructionContext.hpp 6 Nov 2002 05:09:48 -0000 1.20
@@ -681,7 +681,6 @@
* @param stylesheetTree The stylesheet containing the element
* @param chars The pointer to character string for element
* @param length length of the chars parameter.
- * @param isCData true if a CDATA element
* @param preserveSpace true is space should be preserved
* @param disableOutputEscaping true if output escaping should be
disabled
* @param locator The Locator instance for error reporting. May be 0.
@@ -693,7 +692,6 @@
Stylesheet&
stylesheetTree,
const XalanDOMChar* chars,
XalanDOMString::size_type length,
- bool isCData,
bool
preserveSpace,
bool
disableOutputEscaping,
const Locator* locator = 0) =
0;
1.30 +20 -26
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
Index: StylesheetConstructionContextDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- StylesheetConstructionContextDefault.cpp 5 Nov 2002 05:19:25 -0000
1.29
+++ StylesheetConstructionContextDefault.cpp 6 Nov 2002 05:09:48 -0000
1.30
@@ -87,30 +87,21 @@
#include "Constants.hpp"
#include "ElemApplyImport.hpp"
-#include "ElemApplyTemplates.hpp"
-#include "ElemAttribute.hpp"
-#include "ElemAttributeSet.hpp"
-#include "ElemCallTemplate.hpp"
#include "ElemChoose.hpp"
#include "ElemComment.hpp"
#include "ElemCopy.hpp"
#include "ElemCopyOf.hpp"
#include "ElemDecimalFormat.hpp"
-#include "ElemElement.hpp"
#include "ElemExtensionCall.hpp"
#include "ElemFallback.hpp"
#include "ElemForEach.hpp"
#include "ElemIf.hpp"
-#include "ElemLiteralResult.hpp"
#include "ElemMessage.hpp"
#include "ElemNumber.hpp"
#include "ElemOtherwise.hpp"
#include "ElemParam.hpp"
#include "ElemPI.hpp"
#include "ElemSort.hpp"
-#include "ElemTemplate.hpp"
-#include "ElemTextLiteral.hpp"
-#include "ElemValueOf.hpp"
#include "ElemWhen.hpp"
#include "ElemWithParam.hpp"
#include "StylesheetRoot.hpp"
@@ -145,6 +136,11 @@
m_useAttributeSetsQName(XSLTEngineImpl::getXSLNameSpaceURL(),
Constants::ATTRNAME_USEATTRIBUTESETS),
m_pointerVectorAllocator(thePointerVectorAllocatorBlockSize),
m_allocatedElements(),
+ m_elemApplyTemplatesAllocator(eDefaultElemApplyTemplatesBlockSize),
+ m_elemAttributeAllocator(eDefaultElemAttributeBlockSize),
+ m_elemAttributeSetAllocator(eDefaultElemAttributeSetBlockSize),
+ m_elemCallTemplateAllocator(eDefaultElemCallTemplateBlockSize),
+ m_elemElementAllocator(eDefaultElemElementBlockSize),
m_elemLiteralResultAllocator(eDefaultElemLiteralResultBlockSize),
m_elemTemplateAllocator(eDefaultElemTemplateBlockSize),
m_elemTextLiteralAllocator(eDefaultElemTextLiteralBlockSize),
@@ -352,6 +348,16 @@
m_pointerVectorAllocator.reset();
+ m_elemApplyTemplatesAllocator.reset();
+
+ m_elemAttributeAllocator.reset();
+
+ m_elemAttributeSetAllocator.reset();
+
+ m_elemCallTemplateAllocator.reset();
+
+ m_elemElementAllocator.reset();
+
m_elemLiteralResultAllocator.reset();
m_elemTemplateAllocator.reset();
@@ -717,9 +723,7 @@
break;
case ELEMNAME_APPLY_TEMPLATES:
- m_allocatedElements.push_back(0);
-
- theElement = new ElemApplyTemplates(
+ return m_elemApplyTemplatesAllocator.create(
*this,
stylesheetTree,
atts,
@@ -728,9 +732,7 @@
break;
case ELEMNAME_ATTRIBUTE:
- m_allocatedElements.push_back(0);
-
- theElement = new ElemAttribute(
+ return m_elemAttributeAllocator.create(
*this,
stylesheetTree,
atts,
@@ -739,9 +741,7 @@
break;
case ELEMNAME_ATTRIBUTE_SET:
- m_allocatedElements.push_back(0);
-
- theElement = new ElemAttributeSet(
+ return m_elemAttributeSetAllocator.create(
*this,
stylesheetTree,
atts,
@@ -750,9 +750,7 @@
break;
case ELEMNAME_CALL_TEMPLATE:
- m_allocatedElements.push_back(0);
-
- theElement = new ElemCallTemplate(
+ return m_elemCallTemplateAllocator.create(
*this,
stylesheetTree,
atts,
@@ -816,9 +814,7 @@
break;
case ELEMNAME_ELEMENT:
- m_allocatedElements.push_back(0);
-
- theElement = new ElemElement(
+ return m_elemElementAllocator.create(
*this,
stylesheetTree,
atts,
@@ -1042,7 +1038,6 @@
Stylesheet&
stylesheetTree,
const XalanDOMChar* chars,
XalanDOMString::size_type length,
- bool isCData,
bool
preserveSpace,
bool
disableOutputEscaping,
const Locator* locator)
@@ -1058,7 +1053,6 @@
chars,
0,
length,
- isCData,
preserveSpace,
disableOutputEscaping);
}
1.29 +20 -1
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
Index: StylesheetConstructionContextDefault.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- StylesheetConstructionContextDefault.hpp 5 Nov 2002 05:19:25 -0000
1.28
+++ StylesheetConstructionContextDefault.hpp 6 Nov 2002 05:09:48 -0000
1.29
@@ -107,6 +107,11 @@
#include <XSLT/XalanAVTPartSimpleAllocator.hpp>
#include <XSLT/AVTPartXPath.hpp>
#include <XSLT/XalanAVTPartXPathAllocator.hpp>
+#include <XSLT/XalanElemApplyTemplatesAllocator.hpp>
+#include <XSLT/XalanElemAttributeAllocator.hpp>
+#include <XSLT/XalanElemAttributeSetAllocator.hpp>
+#include <XSLT/XalanElemCallTemplateAllocator.hpp>
+#include <XSLT/XalanElemElementAllocator.hpp>
#include <XSLT/XalanElemLiteralResultAllocator.hpp>
#include <XSLT/XalanElemTemplateAllocator.hpp>
#include <XSLT/XalanElemTextLiteralAllocator.hpp>
@@ -144,6 +149,11 @@
eDefaultAVTPartXPathBlockSize = 128,
eDefaultXalanQNameByValueBlockSize = 32,
eDefaultPointerVectorBlockSize = 512,
+ eDefaultElemApplyTemplatesBlockSize = 10,
+ eDefaultElemAttributeBlockSize = 10,
+ eDefaultElemAttributeSetBlockSize = 10,
+ eDefaultElemCallTemplateBlockSize = 10,
+ eDefaultElemElementBlockSize = 10,
eDefaultElemLiteralResultBlockSize = 20,
eDefaultElemTemplateBlockSize = 10,
eDefaultElemTextLiteralBlockSize = 20,
@@ -452,7 +462,6 @@
Stylesheet&
stylesheetTree,
const XalanDOMChar* chars,
XalanDOMString::size_type length,
- bool isCData,
bool
preserveSpace,
bool
disableOutputEscaping,
const Locator* locator = 0);
@@ -548,6 +557,16 @@
PointerVectorAllocatorType
m_pointerVectorAllocator;
ElemTemplateElementVectorType m_allocatedElements;
+
+ XalanElemApplyTemplatesAllocator
m_elemApplyTemplatesAllocator;
+
+ XalanElemAttributeAllocator
m_elemAttributeAllocator;
+
+ XalanElemAttributeSetAllocator
m_elemAttributeSetAllocator;
+
+ XalanElemCallTemplateAllocator
m_elemCallTemplateAllocator;
+
+ XalanElemElementAllocator
m_elemElementAllocator;
XalanElemLiteralResultAllocator
m_elemLiteralResultAllocator;
1.96 +4 -3 xml-xalan/c/src/XSLT/StylesheetHandler.cpp
Index: StylesheetHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- StylesheetHandler.cpp 5 Nov 2002 05:19:25 -0000 1.95
+++ StylesheetHandler.cpp 6 Nov 2002 05:09:48 -0000 1.96
@@ -1199,8 +1199,10 @@
m_constructionContext.parseXML(hrefUrl, &tp, 0);
- // Add it to the front of the imports, releasing the
XalanAutoPtr...
- m_stylesheet.addImport(importedStylesheet.release(),
true);
+ // Add it to the imports, releasing the XalanAutoPtr...
+ m_stylesheet.addImport(importedStylesheet.get());
+
+ importedStylesheet.release();
assert(equals(importStack.back(), hrefUrl));
importStack.pop_back();
@@ -1460,7 +1462,6 @@
m_stylesheet,
chars,
length,
- true,
preserveSpace,
disableOutputEscaping,
locator);
1.68 +89 -1 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- StylesheetRoot.cpp 5 Nov 2002 05:19:25 -0000 1.67
+++ StylesheetRoot.cpp 6 Nov 2002 05:09:48 -0000 1.68
@@ -86,6 +86,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/XalanQNameByReference.hpp>
#include <XPath/XPathFactory.hpp>
#include <XPath/XPathProcessor.hpp>
@@ -143,7 +147,9 @@
m_outputEscapeURLs(true),
m_indentAmount(-1),
m_omitMETATag(false),
- m_elemNumberNextID(0)
+ m_elemNumberNextID(0),
+ m_whitespacePreservingElements(),
+ m_whitespaceStrippingElements()
{
// Our base class has already resolved the URI and pushed it on
// the back of the include stack, so get it from there...
@@ -779,4 +785,86 @@
}
}
}
+}
+
+
+
+bool
+StylesheetRoot::shouldStripSourceNode(
+ StylesheetExecutionContext&
executionContext,
+ const XalanText&
textNode) const
+{
+ bool strip = false;
+
+ XalanNode* parent = DOMServices::getParentOfNode(textNode);
+
+ while(0 != parent)
+ {
+ if(parent->getNodeType() == XalanNode::ELEMENT_NODE)
+ {
+ XPath::eMatchScore highPreserveScore =
XPath::eMatchScoreNone;
+ XPath::eMatchScore highStripScore =
XPath::eMatchScoreNone;
+
+ {
+ 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 =
+
theElements[i];
+ assert(matchPat != 0);
+
+ 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("Match conflict
between xsl:strip-space and xsl:preserve-space");
+ }
+ break;
+ }
+ }
+
+ parent = parent->getParentNode();
+ }
+
+ return strip;
}
1.24 +37 -0 xml-xalan/c/src/XSLT/StylesheetRoot.hpp
Index: StylesheetRoot.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- StylesheetRoot.hpp 5 Nov 2002 05:19:25 -0000 1.23
+++ StylesheetRoot.hpp 6 Nov 2002 05:09:48 -0000 1.24
@@ -77,6 +77,7 @@
class StylesheetConstructionContext;
+class XalanText;
class XSLTResultTarget;
@@ -92,8 +93,10 @@
#if defined(XALAN_NO_NAMESPACES)
typedef vector<const XalanQName*> XalanQNameVectorType;
+ typedef vector<const XPath*> XPathVectorType;
#else
typedef std::vector<const XalanQName*> XalanQNameVectorType;
+ typedef std::vector<const XPath*> XPathVectorType;
#endif
/**
@@ -402,6 +405,30 @@
return m_elemNumberNextID;
}
+ bool
+ hasPreserveOrStripSpaceElements() const
+ {
+ return m_whitespacePreservingElements.empty() == false ||
+ m_whitespaceStrippingElements.empty() == false;
+ }
+
+ void
+ pushWhitespacePreservingElement(const XPath* theXPath)
+ {
+ m_whitespacePreservingElements.push_back(theXPath);
+ }
+
+ void
+ pushWhitespaceStrippingElement(const XPath* theXPath)
+ {
+ m_whitespaceStrippingElements.push_back(theXPath);
+ }
+
+ bool
+ shouldStripSourceNode(
+ StylesheetExecutionContext&
executionContext,
+ const XalanText&
textNode) const;
+
private:
/**
@@ -531,6 +558,16 @@
* This is set to true if we should omit the META tag in HTML output
(the default is false)
*/
unsigned long m_elemNumberNextID;
+
+ /**
+ * A lookup table of all space preserving elements.
+ */
+ XPathVectorType m_whitespacePreservingElements;
+
+ /**
+ * A lookup table of all space stripping elements.
+ */
+ XPathVectorType m_whitespaceStrippingElements;
// Not implemented...
StylesheetRoot(const StylesheetRoot&);
1.14 +1 -1 xml-xalan/c/src/XSLT/TraceListenerDefault.cpp
Index: TraceListenerDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/TraceListenerDefault.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TraceListenerDefault.cpp 3 Nov 2002 03:36:25 -0000 1.13
+++ TraceListenerDefault.cpp 6 Nov 2002 05:09:48 -0000 1.14
@@ -241,7 +241,7 @@
m_printWriter.print(XALAN_STATIC_UCODE_STRING(", "));
m_printWriter.print(ev.m_attributeName);
m_printWriter.print(XALAN_STATIC_UCODE_STRING("=\""));
-
m_printWriter.print(ev.m_xpath.getExpression().getCurrentPattern());
+ m_printWriter.print(ev.m_xpathExpression);
m_printWriter.print(XALAN_STATIC_UCODE_STRING("\": "));
if (ev.m_selection.null() == true)
1.163 +12 -88 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.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- XSLTEngineImpl.cpp 3 Nov 2002 03:36:25 -0000 1.162
+++ XSLTEngineImpl.cpp 6 Nov 2002 05:09:48 -0000 1.163
@@ -381,8 +381,7 @@
theFormatter->setPrefixResolver(this);
}
- m_hasStripOrPreserveSpace =
m_stylesheetRoot->getWhitespacePreservingElements().empty() == false ||
-
m_stylesheetRoot->getWhitespaceStrippingElements().empty() == false;
+ m_hasStripOrPreserveSpace =
m_stylesheetRoot->hasPreserveOrStripSpaceElements();
m_hasCDATASectionElements =
m_stylesheetRoot->hasCDATASectionElements();
@@ -427,8 +426,7 @@
theFormatter->setPrefixResolver(this);
}
- m_hasStripOrPreserveSpace =
m_stylesheetRoot->getWhitespacePreservingElements().empty() == false ||
-
m_stylesheetRoot->getWhitespaceStrippingElements().empty() == false;
+ m_hasStripOrPreserveSpace =
m_stylesheetRoot->hasPreserveOrStripSpaceElements();
m_hasCDATASectionElements =
m_stylesheetRoot->hasCDATASectionElements();
@@ -2439,7 +2437,7 @@
}
else
{
- XalanNode* const top = pos;
+ XalanNode* const top = pos;
while(0 != pos)
{
@@ -2979,8 +2977,8 @@
bool
XSLTEngineImpl::shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& textNode) const
+ StylesheetExecutionContext&
executionContext,
+ const XalanNode&
textNode) const
{
if (m_hasStripOrPreserveSpace == false || m_stylesheetRoot == 0)
{
@@ -2990,8 +2988,7 @@
{
bool strip = false;
-
assert(m_stylesheetRoot->getWhitespacePreservingElements().empty() == false ||
-
m_stylesheetRoot->getWhitespaceStrippingElements().empty() == false);
+ assert(m_stylesheetRoot->hasPreserveOrStripSpaceElements() ==
true);
const XalanNode::NodeType type = textNode.getNodeType();
@@ -3010,88 +3007,15 @@
if(0 == length(data))
{
- return true;
- }
- else if(!isXMLWhitespace(data))
- {
- return false;
+ strip = true;
}
}
-
- XalanNode* parent =
DOMServices::getParentOfNode(textNode);
-
- while(0 != parent)
+ else
{
- if(parent->getNodeType() ==
XalanNode::ELEMENT_NODE)
- {
- XPath::eMatchScore
highPreserveScore = XPath::eMatchScoreNone;
- XPath::eMatchScore highStripScore
= XPath::eMatchScoreNone;
-
- {
- // $$$ ToDo: All of this
should be moved into a member of
- // Stylesheet, so as not to
expose these two data members...
- typedef
Stylesheet::XPathVectorType XPathVectorType;
-
- const XPathVectorType&
theElements =
-
m_stylesheetRoot->getWhitespacePreservingElements();
-
- 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;
- }
- }
-
- {
- typedef
Stylesheet::XPathVectorType XPathVectorType;
-
- const XPathVectorType&
theElements =
-
m_stylesheetRoot->getWhitespaceStrippingElements();
-
- 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 >
highStripScore)
- highStripScore
= score;
- }
- }
-
- if(highPreserveScore >
XPath::eMatchScoreNone ||
- highStripScore >
XPath::eMatchScoreNone)
- {
- if(highPreserveScore >
highStripScore)
- {
- strip = false;
- }
- else if(highStripScore >
highPreserveScore)
- {
- strip = true;
- }
- else
- {
- warn("Match conflict
between xsl:strip-space and xsl:preserve-space");
- }
- break;
- }
- }
-
- parent = parent->getParentNode();
+ strip =
+ m_stylesheetRoot->shouldStripSourceNode(
+ executionContext,
+ theTextNode);
}
}
1.102 +2 -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.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- XSLTEngineImpl.hpp 3 Nov 2002 03:36:25 -0000 1.101
+++ XSLTEngineImpl.hpp 6 Nov 2002 05:09:48 -0000 1.102
@@ -317,8 +317,8 @@
virtual bool
shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& node) const;
+ StylesheetExecutionContext&
executionContext,
+ const XalanNode& node)
const;
virtual FormatterListener*
getFormatterListener() const;
1.32 +2 -2 xml-xalan/c/src/XSLT/XSLTProcessor.hpp
Index: XSLTProcessor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessor.hpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- XSLTProcessor.hpp 3 Nov 2002 03:36:25 -0000 1.31
+++ XSLTProcessor.hpp 6 Nov 2002 05:09:48 -0000 1.32
@@ -299,8 +299,8 @@
*/
virtual bool
shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& node) const = 0;
+ StylesheetExecutionContext&
executionContext,
+ const XalanNode& node)
const = 0;
/**
* Get the current formatter listener.
1.2 +0 -2 xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.cpp
Index: XalanElemTextLiteralAllocator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanElemTextLiteralAllocator.cpp 5 Nov 2002 05:19:25 -0000 1.1
+++ XalanElemTextLiteralAllocator.cpp 6 Nov 2002 05:09:48 -0000 1.2
@@ -82,7 +82,6 @@
const XalanDOMChar* ch,
XalanDOMString::size_type start,
XalanDOMString::size_type length,
- bool isCData,
bool
preserveSpace,
bool
disableOutputEscaping)
{
@@ -98,7 +97,6 @@
ch,
start,
length,
- isCData,
preserveSpace,
disableOutputEscaping);
1.2 +0 -2 xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.hpp
Index: XalanElemTextLiteralAllocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanElemTextLiteralAllocator.hpp 5 Nov 2002 05:19:25 -0000 1.1
+++ XalanElemTextLiteralAllocator.hpp 6 Nov 2002 05:09:48 -0000 1.2
@@ -108,7 +108,6 @@
* @param ch pointer to character string for element
* @param start starting offset of element
* @param length number of characters in element
- * @param isCData true if a CDATA element
* @param preserveSpace true is space should be preserved
* @param disableOutputEscaping true if output escaping should be
disabled
*
@@ -123,7 +122,6 @@
const XalanDOMChar* ch,
XalanDOMString::size_type start,
XalanDOMString::size_type length,
- bool isCData,
bool
preserveSpace,
bool
disableOutputEscaping);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]