auriemma 01/03/01 11:14:00
Modified: c/src/XSLT ElemPI.cpp ElemPI.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
XSLTProcessor.hpp
Log:
Removed evaluateAttrVal.
Revision Changes Path
1.8 +9 -9 xml-xalan/c/src/XSLT/ElemPI.cpp
Index: ElemPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemPI.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemPI.cpp 2001/02/12 02:34:53 1.7
+++ ElemPI.cpp 2001/03/01 19:13:44 1.8
@@ -65,7 +65,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
-
+#include "AVT.hpp"
#include "Constants.hpp"
#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
@@ -83,7 +83,7 @@
lineNumber,
columnNumber,
Constants::ELEMNAME_PI),
- m_name_atv()
+ m_nameAVT(0)
{
const unsigned int nAttrs = atts.getLength();
@@ -92,8 +92,9 @@
const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_NAME))
- {
- m_name_atv = atts.getValue(i);
+ {
+ m_nameAVT = new AVT(aname, atts.getType(i),
atts.getValue(i),
+ *this, constructionContext);
}
else if(isAttrOK(aname, atts, i, constructionContext) == false
|| processSpaceAttr(aname, atts, i))
{
@@ -101,7 +102,7 @@
}
}
- if(isEmpty(m_name_atv) == true)
+ if(0 == m_nameAVT)
{
constructionContext.error(Constants::ELEMNAME_PI_WITH_PREFIX_STRING + " must
have a name attribute.");
}
@@ -131,11 +132,10 @@
const QName& mode)
const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode,
mode);
+
+ XalanDOMString piName;
- const XalanDOMString piName =
- executionContext.evaluateAttrVal(sourceNode,
-
*this,
-
m_name_atv);
+ m_nameAVT->evaluate(piName, sourceNode, *this, executionContext);
if(equalsIgnoreCase(piName, XALAN_STATIC_UCODE_STRING("xml")))
{
1.8 +5 -1 xml-xalan/c/src/XSLT/ElemPI.hpp
Index: ElemPI.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemPI.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemPI.hpp 2001/02/12 02:34:53 1.7
+++ ElemPI.hpp 2001/03/01 19:13:46 1.8
@@ -69,6 +69,10 @@
+class AVT;
+
+
+
class ElemPI: public ElemTemplateElement
{
public:
@@ -112,7 +116,7 @@
private:
- XalanDOMString m_name_atv;
+ const AVT* m_nameAVT;
};
1.47 +0 -14 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- StylesheetExecutionContext.hpp 2001/01/26 22:03:10 1.46
+++ StylesheetExecutionContext.hpp 2001/03/01 19:13:47 1.47
@@ -475,20 +475,6 @@
const XPath* m_xpath;
};
- /**
- * Evaluate the value of an attribute within the context of a specified
- * context node and namespace
- *
- * @param contextNode current context node
- * @param namespaceContext context for namespace resolution
- * @param stringedValue value to evaluate
- */
- virtual const XalanDOMString
- evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue) = 0;
-
#if defined(XALAN_NO_NAMESPACES)
typedef vector<TopLevelArg> ParamVectorType;
#else
1.55 +0 -14
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- StylesheetExecutionContextDefault.cpp 2001/01/31 01:42:20 1.54
+++ StylesheetExecutionContextDefault.cpp 2001/03/01 19:13:48 1.55
@@ -440,20 +440,6 @@
-const XalanDOMString
-StylesheetExecutionContextDefault::evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue)
-{
- return m_xsltProcessor.evaluateAttrVal(contextNode,
-
namespaceContext,
-
stringedValue,
-
*this);
-}
-
-
-
void
StylesheetExecutionContextDefault::pushTopLevelVariables(const
ParamVectorType& topLevelParams)
{
1.49 +0 -6
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- StylesheetExecutionContextDefault.hpp 2001/01/31 01:42:20 1.48
+++ StylesheetExecutionContextDefault.hpp 2001/03/01 19:13:49 1.49
@@ -303,12 +303,6 @@
virtual void
returnXPath(const XPath* xpath);
- virtual const XalanDOMString
- evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue);
-
virtual void
pushTopLevelVariables(const ParamVectorType& topLevelParams);
1.90 +0 -185 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.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- XSLTEngineImpl.cpp 2001/02/16 19:50:22 1.89
+++ XSLTEngineImpl.cpp 2001/03/01 19:13:50 1.90
@@ -2507,185 +2507,6 @@
-// $$$ ToDo: Get rid of this!!! See ElemPI, ElemSort, etc. These have
strings instead of
-// AVT instances...
-XalanDOMString
-XSLTEngineImpl::evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue,
- XPathExecutionContext& executionContext)
-{
- XalanDOMString expressedValue;
-
- StringTokenizer tokenizer(stringedValue,
theTokenDelimiterCharacters, true);
-
- const unsigned int nTokens = tokenizer.countTokens();
-
- if(nTokens < 2)
- {
- expressedValue = stringedValue; // then do the simple thing
- }
- else
- {
- XalanDOMString buffer;
- XalanDOMString t; // base token
- XalanDOMString lookahead; // next token
- XalanDOMString error; // if not empty, break from loop
-
- while(tokenizer.hasMoreTokens())
- {
- if(length(lookahead) != 0)
- {
- t = lookahead;
- clear(lookahead);
- }
- else t = tokenizer.nextToken();
-
- if(length(t) == 1)
- {
- switch(charAt(t, 0))
- {
- case XalanUnicode::charApostrophe:
- case XalanUnicode::charQuoteMark:
- {
- // just keep on going, since
we're not in an attribute template
- append(buffer, t);
- break;
- }
-
case(XalanUnicode::charLeftCurlyBracket):
- {
- // Attr template start
- lookahead =
tokenizer.nextToken();
- if(equals(lookahead,
theLeftCurlyBracketString))
- {
- // Double curlys mean
escape to show curly
- append(buffer,
lookahead);
- clear(lookahead);
- break; // from switch
- }
- /*
- else if(equals(lookahead,
XalanUnicode::charQuoteMar) ||
-
equals(lookahead, XalanUnicode::charApostrophe))
- {
- // Error. Expressions
can not begin with quotes.
- error = "Expressions
can not begin with quotes.";
- break; // from switch
- }
- */
- else
- {
- XalanDOMString
expression = lookahead; // Probably should make into StringBuffer
-
- while(0 !=
length(lookahead) && !equals(lookahead, theRightCurlyBracketString))
- {
- lookahead =
tokenizer.nextToken();
-
if(length(lookahead) == 1)
- {
-
switch(charAt(lookahead, 0))
- {
-
case XalanUnicode::charApostrophe:
-
case XalanUnicode::charQuoteMark:
-
{
-
// String start
-
expression += lookahead;
-
XalanDOMString quote = lookahead;
-
// Consume stuff 'till next quote
-
lookahead = tokenizer.nextToken();
-
while(!equals(lookahead, quote))
-
{
-
expression += lookahead;
-
lookahead = tokenizer.nextToken();
-
}
-
expression += lookahead;
-
break;
-
}
-
case XalanUnicode::charLeftCurlyBracket:
-
{
-
// What's another curly doing here?
-
error = TranscodeFromLocalCodePage("Error: Can not have \"{\" within
expression.");
-
break;
-
}
-
case XalanUnicode::charRightCurlyBracket:
-
{
-
// Proper close of attribute template.
-
// Evaluate the expression.
-
const XObjectPtr xobj =
-
evalXPathStr(expression, contextNode, namespaceContext,
executionContext);
-
-
append(buffer, xobj->str());
-
-
clear(lookahead); // breaks out of inner while loop
-
break;
-
}
-
default:
-
{
-
// part of the template stuff, just add it.
-
expression += lookahead;
-
}
- } //
end inner switch
- } // end if
lookahead length == 1
- else
- {
- // part
of the template stuff, just add it.
-
expression += lookahead;
- }
- } // (0 !=
length(lookahead) && !equals(lookahead, "}"))
-
- if(length(error) != 0)
- {
- break; // from
inner while loop
- }
- }
- break;
- }
-
case(XalanUnicode::charRightCurlyBracket):
- {
- lookahead =
tokenizer.nextToken();
- if(equals(lookahead,
theRightCurlyBracketString))
- {
- // Double curlys mean
escape to show curly
- append(buffer,
lookahead);
- clear(lookahead); //
swallow
- }
- else
- {
- // Illegal, I think...
- warn("Found \"}\" but
no attribute template open!");
- append(buffer,
theRightCurlyBracketString);
- // leave the lookahead
to be processed by the next round.
- }
- break;
- }
- default:
- {
- // Anything else just add to
string.
- append(buffer, t);
- }
- } // end switch t
- } // end if length == 1
- else
- {
- // Anything else just add to string.
- append(buffer, t);
- }
-
- if(0 != length(error))
- {
- warn("Attr Template, " + error);
-
- break;
- }
- } // end while(tokenizer.hasMoreTokens())
-
- expressedValue = buffer;
- } // end else nTokens > 1
-
- return expressedValue;
-}
-
-
-
void
XSLTEngineImpl::copyAttributeToTarget(
const XalanAttr& attr,
@@ -2697,13 +2518,7 @@
const XalanDOMString attrName = trim(attr.getName());
XalanDOMString stringedValue = attr.getValue();
-// stringedValue = evaluateAttrVal(contextNode,
-//
namespaceContext,
-//
stringedValue);
- // evaluateAttrVal might return a null value if the template expression
- // did not turn up a result, in which case I'm going to not add the
- // attribute.
// TODO: Find out about empty attribute template expression handling.
if(0 != length(stringedValue))
{
1.62 +0 -7 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.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- XSLTEngineImpl.hpp 2001/01/31 01:42:20 1.61
+++ XSLTEngineImpl.hpp 2001/03/01 19:13:51 1.62
@@ -260,13 +260,6 @@
XalanNode* sourceTree,
XalanNode* xmlNode);
- virtual XalanDOMString
- evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue,
- XPathExecutionContext& executionContext);
-
virtual void
resolveTopLevelParams(StylesheetExecutionContext&
executionContext);
1.19 +0 -20 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XSLTProcessor.hpp 2001/01/16 02:50:03 1.18
+++ XSLTProcessor.hpp 2001/03/01 19:13:52 1.19
@@ -256,26 +256,6 @@
setExecutionContext(StylesheetExecutionContext*
theExecutionContext) = 0;
/**
- * Evaluates attribute values for attribute templates (Stuff in curly {}
- * braces that hold expressions).
- *
- * @param contextNode current node in the source tree
- * @param namespaceContext current namespace context for the
- * pattern-by-example
structures when parsing
- * expressions
- * @param stringedValue attribute value to be processed
- * @param executionContext current execution context
- * @return processed stringedValue with attribute templates resolved
- * @exception XSLProcessorException
- */
- virtual XalanDOMString
- evaluateAttrVal(
- XalanNode* contextNode,
- const PrefixResolver& namespaceContext,
- const XalanDOMString& stringedValue,
- XPathExecutionContext& executionContext) = 0;
-
- /**
* Resolve the params that were pushed by the caller.
*/
virtual void