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...@locus.apache.org on 2000/04/11 17:09:54 UTC
cvs commit: xml-xalan/c/src/XSLT AVT.cpp AVT.hpp AVTPart.hpp AVTPartSimple.cpp AVTPartSimple.hpp AVTPartXPath.cpp AVTPartXPath.hpp Arg.cpp Arg.hpp Constants.cpp Constants.hpp ContextMarker.cpp ContextMarker.hpp ContextState.cpp ContextState.hpp DecimalToRoman.cpp DecimalToRoman.hpp ElemApplyImport.cpp ElemApplyImport.hpp ElemApplyTemplates.cpp ElemApplyTemplates.hpp ElemAttribute.cpp ElemAttribute.hpp ElemAttributeSet.cpp ElemAttributeSet.hpp ElemCallTemplate.cpp ElemCallTemplate.hpp ElemChoose.cpp ElemChoose.hpp ElemComment.cpp ElemComment.hpp ElemCopy.cpp ElemCopy.hpp ElemCopyOf.cpp ElemCopyOf.hpp ElemElement.cpp ElemElement.hpp ElemEmpty.cpp ElemEmpty.hpp ElemExtensionCall.cpp ElemExtensionCall.hpp ElemForEach.cpp ElemForEach.hpp ElemIf.cpp ElemIf.hpp ElemLiteralResult.cpp ElemLiteralResult.hpp ElemMessage.cpp ElemMessage.hpp ElemNumber.cpp ElemNumber.hpp ElemOtherwise.cpp ElemOtherwise.hpp ElemPI.cpp ElemPI.hpp ElemParam.cpp ElemParam.hpp ElemSort.cpp ElemSort.hpp ElemTemplate.cpp ElemTemplate.hpp ElemTemplateElement.cpp ElemTemplateElement.hpp ElemText.cpp ElemText.hpp ElemTextLiteral.cpp ElemTextLiteral.hpp ElemUse.cpp ElemUse.hpp ElemValueOf.cpp ElemValueOf.hpp ElemVariable.cpp ElemVariable.hpp ElemWhen.cpp ElemWhen.hpp ElemWithParam.cpp ElemWithParam.hpp ElementMarker.cpp ElementMarker.hpp FunctionCurrent.cpp FunctionCurrent.hpp FunctionDocument.cpp FunctionDocument.hpp FunctionFormatNumber.cpp FunctionFormatNumber.hpp FunctionGenerateID.cpp FunctionGenerateID.hpp FunctionKey.cpp FunctionKey.hpp FunctionSystemProperty.cpp FunctionSystemProperty.hpp FunctionUnparsedEntityURI.cpp FunctionUnparsedEntityURI.hpp GenerateEvent.cpp GenerateEvent.hpp KeyDeclaration.hpp KeyTable.cpp KeyTable.hpp NodeSortKey.cpp NodeSortKey.hpp NodeSorter.cpp NodeSorter.hpp NumeratorFormatter.cpp ProblemListener.hpp ProblemListenerDefault.cpp ProblemListenerDefault.hpp SelectionEvent.cpp SelectionEvent.hpp Stylesheet.cpp Stylesheet.hpp StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp StylesheetHandler.cpp StylesheetHandler.hpp StylesheetRoot.cpp StylesheetRoot.hpp TracerEvent.cpp TracerEvent.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp XSLTInputSource.cpp XSLTInputSource.hpp XSLTProcessor.hpp XSLTProcessorEnvSupportDefault.cpp XSLTProcessorEnvSupportDefault.hpp XSLTProcessorException.hpp XSLTResultTarget.cpp XSLTResultTarget.hpp
dbertoni 00/04/11 08:09:53
Modified: c/src/XSLT AVT.cpp AVT.hpp AVTPart.hpp AVTPartSimple.cpp
AVTPartSimple.hpp AVTPartXPath.cpp AVTPartXPath.hpp
Arg.cpp Arg.hpp Constants.cpp Constants.hpp
ContextMarker.cpp ContextMarker.hpp
ContextState.cpp ContextState.hpp
DecimalToRoman.cpp DecimalToRoman.hpp
ElemApplyImport.cpp ElemApplyImport.hpp
ElemApplyTemplates.cpp ElemApplyTemplates.hpp
ElemAttribute.cpp ElemAttribute.hpp
ElemAttributeSet.cpp ElemAttributeSet.hpp
ElemCallTemplate.cpp ElemCallTemplate.hpp
ElemChoose.cpp ElemChoose.hpp ElemComment.cpp
ElemComment.hpp ElemCopy.cpp ElemCopy.hpp
ElemCopyOf.cpp ElemCopyOf.hpp ElemElement.cpp
ElemElement.hpp ElemEmpty.cpp ElemEmpty.hpp
ElemExtensionCall.cpp ElemExtensionCall.hpp
ElemForEach.cpp ElemForEach.hpp ElemIf.cpp
ElemIf.hpp ElemLiteralResult.cpp
ElemLiteralResult.hpp ElemMessage.cpp
ElemMessage.hpp ElemNumber.cpp ElemNumber.hpp
ElemOtherwise.cpp ElemOtherwise.hpp ElemPI.cpp
ElemPI.hpp ElemParam.cpp ElemParam.hpp ElemSort.cpp
ElemSort.hpp ElemTemplate.cpp ElemTemplate.hpp
ElemTemplateElement.cpp ElemTemplateElement.hpp
ElemText.cpp ElemText.hpp ElemTextLiteral.cpp
ElemTextLiteral.hpp ElemUse.cpp ElemUse.hpp
ElemValueOf.cpp ElemValueOf.hpp ElemVariable.cpp
ElemVariable.hpp ElemWhen.cpp ElemWhen.hpp
ElemWithParam.cpp ElemWithParam.hpp
ElementMarker.cpp ElementMarker.hpp
FunctionCurrent.cpp FunctionCurrent.hpp
FunctionDocument.cpp FunctionDocument.hpp
FunctionFormatNumber.cpp FunctionFormatNumber.hpp
FunctionGenerateID.cpp FunctionGenerateID.hpp
FunctionKey.cpp FunctionKey.hpp
FunctionSystemProperty.cpp
FunctionSystemProperty.hpp
FunctionUnparsedEntityURI.cpp
FunctionUnparsedEntityURI.hpp GenerateEvent.cpp
GenerateEvent.hpp KeyDeclaration.hpp KeyTable.cpp
KeyTable.hpp NodeSortKey.cpp NodeSortKey.hpp
NodeSorter.cpp NodeSorter.hpp
NumeratorFormatter.cpp ProblemListener.hpp
ProblemListenerDefault.cpp
ProblemListenerDefault.hpp SelectionEvent.cpp
SelectionEvent.hpp Stylesheet.cpp Stylesheet.hpp
StylesheetConstructionContext.hpp
StylesheetConstructionContextDefault.cpp
StylesheetConstructionContextDefault.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
StylesheetHandler.cpp StylesheetHandler.hpp
StylesheetRoot.cpp StylesheetRoot.hpp
TracerEvent.cpp TracerEvent.hpp XSLTEngineImpl.cpp
XSLTEngineImpl.hpp XSLTInputSource.cpp
XSLTInputSource.hpp XSLTProcessor.hpp
XSLTProcessorEnvSupportDefault.cpp
XSLTProcessorEnvSupportDefault.hpp
XSLTProcessorException.hpp XSLTResultTarget.cpp
XSLTResultTarget.hpp
Log:
Changes for new Xalan DOM.
Revision Changes Path
1.5 +37 -33 xml-xalan/c/src/XSLT/AVT.cpp
Index: AVT.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVT.cpp 2000/03/16 20:52:58 1.4
+++ AVT.cpp 2000/04/11 15:09:19 1.5
@@ -57,24 +57,27 @@
#include "AVT.hpp"
+
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
+
#include "AVTPartSimple.hpp"
#include "AVTPartXPath.hpp"
#include "StylesheetConstructionContext.hpp"
+
/**
* Construct an AVT by parsing the string, and either
* constructing a vector of AVTParts, or simply hold
* on to the string if the AVT is simple.
*/
AVT::AVT(
- const DOMString& name,
- const XMLCh* type,
- const XMLCh* stringedValue,
+ const XalanDOMString& name,
+ const XalanDOMChar* type,
+ const XalanDOMChar* stringedValue,
const PrefixResolver& resolver,
StylesheetConstructionContext& constructionContext) :
AVTPart(),
@@ -82,7 +85,7 @@
m_simpleString(),
m_pcType(type)
{
- StringTokenizer tokenizer(stringedValue, "{}\"\'", true);
+ StringTokenizer tokenizer(stringedValue, XALAN_STATIC_UCODE_STRING("{}\"\'"), true);
const int nTokens = tokenizer.countTokens();
@@ -96,35 +99,36 @@
{
m_parts.reserve(nTokens + 1);
- DOMString buffer;
- DOMString exprBuffer;
- DOMString t; // base token
- DOMString lookahead; // next token
- DOMString error; // if non-null, break from loop
+ XalanDOMString buffer;
+ XalanDOMString exprBuffer;
+ XalanDOMString t; // base token
+ XalanDOMString lookahead; // next token
+ XalanDOMString error; // if non-null, break from loop
while(tokenizer.hasMoreTokens())
{
if(length(lookahead))
{
t = lookahead;
- lookahead = DOMString();
+ lookahead = XalanDOMString();
}
else t = tokenizer.nextToken();
if(length(t) == 1)
{
- XMLCh theChar = t.charAt(0);
+ const XalanDOMChar theChar = t.charAt(0);
+
switch(theChar)
{
case('{'):
{
// Attribute Value Template start
lookahead = tokenizer.nextToken();
- if(equals(lookahead, "{"))
+ if(equals(lookahead, XALAN_STATIC_UCODE_STRING("{")))
{
// Double curlys mean escape to show curly
append(buffer,lookahead);
- lookahead = DOMString();
+ lookahead = XalanDOMString();
break; // from switch
}
else
@@ -132,11 +136,11 @@
if(length(buffer) > 0)
{
m_parts.push_back(new AVTPartSimple(buffer));
- buffer = DOMString();
+ buffer = XalanDOMString();
}
- exprBuffer = DOMString();
- while(length(lookahead) > 0 && !equals(lookahead, "}"))
+ exprBuffer = XalanDOMString();
+ while(length(lookahead) > 0 && !equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
{
if(length(lookahead) == 1)
{
@@ -147,7 +151,7 @@
{
// String start
append(exprBuffer,lookahead);
- const DOMString quote = lookahead;
+ const XalanDOMString quote = lookahead;
// Consume stuff 'till next quote
lookahead = tokenizer.nextToken();
while(!equals(lookahead, quote))
@@ -177,15 +181,15 @@
append(exprBuffer,lookahead);
}
lookahead = tokenizer.nextToken();
- } // end while(!lookahead.equals("}"))
- assert(equals(lookahead, "}"));
+ } // end while(!equals(lookahead, "}"))
+ assert(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")));
// Proper close of attribute template. Evaluate the
// expression.
- buffer = DOMString();
+ buffer = XalanDOMString();
XPath *xpath = constructionContext.createXPath(exprBuffer, resolver);
m_parts.push_back(new AVTPartXPath(xpath));
- lookahead = DOMString(); // breaks out of inner while loop
+ lookahead = XalanDOMString(); // breaks out of inner while loop
if(length(error) > 0)
{
break; // from inner while loop
@@ -196,17 +200,17 @@
case('}'):
{
lookahead = tokenizer.nextToken();
- if(equals(lookahead, "}"))
+ if(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
{
// Double curlys mean escape to show curly
append(buffer,lookahead);
- lookahead = DOMString(); // swallow
+ lookahead = XalanDOMString(); // swallow
}
else
{
// Illegal, I think...
constructionContext.warn("Found \"}\" but no attribute template open!");
- append(buffer,"}");
+ append(buffer, XALAN_STATIC_UCODE_STRING("}"));
// leave the lookahead to be processed by the next round.
}
break;
@@ -230,7 +234,7 @@
if(length(error) > 0)
{
- constructionContext.warn("Attr Template, "+error);
+ constructionContext.warn("Attr Template, " + error);
break;
}
} // end while(tokenizer.hasMoreTokens())
@@ -239,7 +243,7 @@
{
m_parts.push_back(new AVTPartSimple(buffer));
- buffer = DOMString();
+ clear(buffer);
}
} // end else nTokens > 1
@@ -247,7 +251,7 @@
if(m_parts.empty() && length(m_simpleString) == 0)
{
// Error?
- m_simpleString = DOMString();
+ clear(m_simpleString);
}
}
@@ -267,8 +271,8 @@
void
AVT::evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const
{
@@ -278,11 +282,11 @@
}
else if(!m_parts.empty())
{
- buf = DOMString();
+ buf = XalanDOMString();
- const int n = m_parts.size();
+ const AVTPartPtrVectorType::size_type n = m_parts.size();
- for(int i = 0; i < n; i++)
+ for(AVTPartPtrVectorType::size_type i = 0; i < n; i++)
{
assert(m_parts[i] != 0);
@@ -291,6 +295,6 @@
}
else
{
- buf = DOMString();
+ buf = XalanDOMString();
}
}
1.5 +18 -34 xml-xalan/c/src/XSLT/AVT.hpp
Index: AVT.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVT.hpp 2000/03/01 20:43:40 1.4
+++ AVT.hpp 2000/04/11 15:09:19 1.5
@@ -58,7 +58,7 @@
#define XALAN_AVT_HEADER_GUARD
/**
- * $Id: AVT.hpp,v 1.4 2000/03/01 20:43:40 jdonohue Exp $
+ * $Id: AVT.hpp,v 1.5 2000/04/11 15:09:19 dbertoni Exp $
*
* $State: Exp $
*
@@ -73,7 +73,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -93,16 +93,6 @@
{
public:
-#if defined(XALAN_NO_NAMESPACES)
-# define XALAN_STD
-#else
-# define XALAN_STD std::
-#endif
-
-typedef XALAN_STD vector<AVTPart*> AVTPartPtrVectorType;
-
-#undef XALAN_STD
-
/**
* Construct an Attribute Value Template(AVT) by parsing the string, and
* either constructing a vector of AVTParts, or simply hold on to the
@@ -115,9 +105,9 @@
* @param constructionContext context for construction of AVT
*/
AVT(
- const DOMString& name,
- const XMLCh* type,
- const XMLCh* stringedValue,
+ const XalanDOMString& name,
+ const XalanDOMChar* type,
+ const XalanDOMChar* stringedValue,
const PrefixResolver& resolver,
StylesheetConstructionContext& constructionContext);
@@ -129,7 +119,7 @@
*
* @return name of AVT
*/
- const DOMString&
+ const XalanDOMString&
getName() const
{
return m_name;
@@ -140,7 +130,7 @@
*
* @return type of AVT
*/
- const XMLCh*
+ const XalanDOMChar*
getType() const
{
return m_pcType;
@@ -150,8 +140,8 @@
virtual void
evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const;
@@ -161,26 +151,20 @@
AVT(const AVT &);
AVT& operator=(const AVT &);
-/**
- * If the AVT is not complex, just hold the simple string.
- */
- DOMString m_simpleString;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<AVTPart*> AVTPartPtrVectorType;
+#else
+ typedef std::vector<AVTPart*> AVTPartPtrVectorType;
+#endif
-/**
- * If the AVT is complex, hold a Vector of AVTParts.
- */
+ XalanDOMString m_simpleString;
+
AVTPartPtrVectorType m_parts;
-/**
- * The name of the attribute.
- */
- DOMString m_name;
+ XalanDOMString m_name;
-/**
- * The attribute type;
- */
// $$$ ToDO: Is this OK just to hold a pointer?
- const XMLCh* m_pcType;
+ const XalanDOMChar* m_pcType;
};
1.4 +7 -10 xml-xalan/c/src/XSLT/AVTPart.hpp
Index: AVTPart.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPart.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AVTPart.hpp 2000/02/29 20:54:19 1.3
+++ AVTPart.hpp 2000/04/11 15:09:19 1.4
@@ -58,7 +58,7 @@
#define XALAN_AVTPART_HEADER_GUARD
/**
- * $Id: AVTPart.hpp,v 1.3 2000/02/29 20:54:19 jdonohue Exp $
+ * $Id: AVTPart.hpp,v 1.4 2000/04/11 15:09:19 dbertoni Exp $
*
* $State: Exp $
*
@@ -67,17 +67,14 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
-//#include <dom/DOMString.hpp>
-//#include <dom/DOM_Node.hpp>
-//#include <dom/DOM_Element.hpp>
-//#include <xpath/XPathSupport.hpp>
-//#include <xpath/NodeRefListBase.hpp>
+// $$$ ToDo: This is necessary while XalanDOMString is still a typedef...
+#include <XalanDOM/XalanDOMString.hpp>
-class DOM_Node;
-class DOMString;
+
+class XalanNode;
class PrefixResolver;
class XPathExecutionContext;
@@ -106,8 +103,8 @@
*/
virtual void
evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const = 0;
};
1.3 +3 -3 xml-xalan/c/src/XSLT/AVTPartSimple.cpp
Index: AVTPartSimple.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartSimple.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AVTPartSimple.cpp 2000/01/26 14:28:06 1.2
+++ AVTPartSimple.cpp 2000/04/11 15:09:19 1.3
@@ -65,7 +65,7 @@
/**
* Simple string part of a complex AVT.
*/
-AVTPartSimple::AVTPartSimple(const DOMString& val) :
+AVTPartSimple::AVTPartSimple(const XalanDOMString& val) :
AVTPart(),
m_val(val)
{
@@ -75,8 +75,8 @@
void
AVTPartSimple::evaluate(
- DOMString& buf,
- const DOM_Node& /* contextNode */,
+ XalanDOMString& buf,
+ XalanNode* /* contextNode */,
const PrefixResolver& /* prefixResolver */,
XPathExecutionContext& /* executionContext */) const
1.4 +6 -6 xml-xalan/c/src/XSLT/AVTPartSimple.hpp
Index: AVTPartSimple.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartSimple.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AVTPartSimple.hpp 2000/02/29 20:54:19 1.3
+++ AVTPartSimple.hpp 2000/04/11 15:09:19 1.4
@@ -58,7 +58,7 @@
#define XALAN_AVTPARTSIMPLE_HEADER_GUARD
/**
- * $Id: AVTPartSimple.hpp,v 1.3 2000/02/29 20:54:19 jdonohue Exp $
+ * $Id: AVTPartSimple.hpp,v 1.4 2000/04/11 15:09:19 dbertoni Exp $
*
* $State: Exp $
*
@@ -69,7 +69,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -89,15 +89,15 @@
*
* @param val A pure string section of an AVT
*/
- AVTPartSimple(const DOMString& val);
+ AVTPartSimple(const XalanDOMString& val);
// These methods are inherited from AVTPart ...
virtual void
evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const;
@@ -106,7 +106,7 @@
/**
* Simple string value;
*/
- const DOMString m_val;
+ const XalanDOMString m_val;
};
1.4 +5 -5 xml-xalan/c/src/XSLT/AVTPartXPath.cpp
Index: AVTPartXPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartXPath.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AVTPartXPath.cpp 2000/01/26 20:32:43 1.3
+++ AVTPartXPath.cpp 2000/04/11 15:09:20 1.4
@@ -69,7 +69,7 @@
* Construct a simple AVT part.
* @param val A pure string section of an AVT.
*/
-AVTPartXPath::AVTPartXPath(const XPath* xpath) :
+AVTPartXPath::AVTPartXPath(const XPath* xpath) :
AVTPart(),
m_pXPath(xpath)
{
@@ -79,7 +79,7 @@
static const XPath*
createAndInitXPath(
- const DOMString& val,
+ const XalanDOMString& val,
const PrefixResolver& resolver,
XObjectFactory& xobjectFactory,
XPathEnvSupport& xpathEnvSupport,
@@ -96,7 +96,7 @@
AVTPartXPath::AVTPartXPath(
- const DOMString& val,
+ const XalanDOMString& val,
const PrefixResolver& resolver,
XObjectFactory& xobjectFactory,
XPathEnvSupport& xpathEnvSupport,
@@ -116,8 +116,8 @@
void
AVTPartXPath:: evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const
{
1.4 +4 -4 xml-xalan/c/src/XSLT/AVTPartXPath.hpp
Index: AVTPartXPath.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVTPartXPath.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AVTPartXPath.hpp 2000/02/29 20:54:19 1.3
+++ AVTPartXPath.hpp 2000/04/11 15:09:20 1.4
@@ -58,7 +58,7 @@
#define XALAN_AVTPARTXPATH_HEADER_GUARD
/**
- * $Id: AVTPartXPath.hpp,v 1.3 2000/02/29 20:54:19 jdonohue Exp $
+ * $Id: AVTPartXPath.hpp,v 1.4 2000/04/11 15:09:20 dbertoni Exp $
*
* $State: Exp $
*
@@ -107,7 +107,7 @@
* @param xpathFactory factory class instance for XPaths
*/
AVTPartXPath(
- const DOMString& val,
+ const XalanDOMString& val,
const PrefixResolver& resolver,
XObjectFactory& xobjectFactory,
XPathEnvSupport& xpathEnvSupport,
@@ -119,8 +119,8 @@
virtual void
evaluate(
- DOMString& buf,
- const DOM_Node& contextNode,
+ XalanDOMString& buf,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const;
1.4 +9 -20 xml-xalan/c/src/XSLT/Arg.cpp
Index: Arg.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Arg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Arg.cpp 2000/03/01 20:43:40 1.3
+++ Arg.cpp 2000/04/11 15:09:20 1.4
@@ -62,18 +62,14 @@
-// Other XSL4C header files.
#include <PlatformSupport/DOMStringHelper.hpp>
-/*
- * Construct an arg that represents an expression
- */
Arg::Arg(
- const QName& name,
- const DOMString& expr,
- bool isParamVar) :
+ const QName& name,
+ const XalanDOMString& expr,
+ bool isParamVar) :
StackEntry(eArgument),
m_qname(name),
m_argType(eExpression),
@@ -83,24 +79,23 @@
{
}
-/*
- * Construct an arg from an XObject
- * NOTE: this should also be able to handle the case of a result tree
- * fragment as an XRTreeFrag
- */
+
+
Arg::Arg(
const QName& name,
- XObject* val) :
+ XObject* val,
+ bool isParamVar) :
StackEntry(eArgument),
m_qname(name),
m_argType(eXObject),
- m_isParamVar(false),
+ m_isParamVar(isParamVar),
m_val(val),
m_expression()
{
}
+
Arg::Arg(const Arg& theSource) :
StackEntry(theSource),
m_qname(theSource.m_qname),
@@ -115,7 +110,6 @@
Arg::~Arg()
{
- m_val = 0;
}
@@ -149,8 +143,3 @@
{
return new Arg(*this);
}
-
-
-/*
- * $ Log: $
- */
1.5 +26 -15 xml-xalan/c/src/XSLT/Arg.hpp
Index: Arg.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Arg.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Arg.hpp 2000/03/01 20:43:40 1.4
+++ Arg.hpp 2000/04/11 15:09:20 1.5
@@ -64,17 +64,25 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
-#include <dom/DOMString.hpp>
+
+
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
#include <XPath/QName.hpp>
+
+
// Base class header file.
#include "StackEntry.hpp"
+
-#include <cassert>
class XObject;
-class DOMString;
+
+
/**
* This class holds an instance of an argument on the stack.
*/
@@ -94,21 +102,24 @@
* @param isParamVar true if expression is a parameter variable
*/
Arg(
- const QName& name,
- const DOMString& expr,
- bool isParamVar);
+ const QName& name,
+ const XalanDOMString& expr,
+ bool isParamVar);
/**
* Construct an argument object from an XObject
*
* @param name name of argument
* @param val XObject argument represents
+ * @param isParamVar true if expression is a parameter variable
*/
Arg(
const QName& name,
- XObject* val);
+ XObject* val,
+ bool isParamVar);
- virtual ~Arg();
+ virtual
+ ~Arg();
/**
* Override equals and agree that we're equal if the passed object is a
@@ -180,7 +191,7 @@
*
* @return string representation of expression
*/
- const DOMString&
+ const XalanDOMString&
getExpression() const
{
return m_expression;
@@ -192,7 +203,7 @@
* @param pexpr string representation of expression
*/
void
- setExpression(const DOMString& pexpr)
+ setExpression(const XalanDOMString& pexpr)
{
m_expression = pexpr;
};
@@ -210,11 +221,11 @@
private:
- QName m_qname;
- eArgumentType m_argType;
- bool m_isParamVar;
- XObject* m_val;
- DOMString m_expression;
+ QName m_qname;
+ eArgumentType m_argType;
+ bool m_isParamVar;
+ XObject* m_val;
+ XalanDOMString m_expression;
};
1.3 +190 -171 xml-xalan/c/src/XSLT/Constants.cpp
Index: Constants.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Constants.cpp 2000/03/23 12:59:36 1.2
+++ Constants.cpp 2000/04/11 15:09:21 1.3
@@ -63,174 +63,193 @@
-const DOMString Constants::ELEMNAME_ANCHOR_STRING(XALAN_STATIC_UCODE_STRING("anchor"));
-const DOMString Constants::ELEMNAME_ANY_STRING(XALAN_STATIC_UCODE_STRING("any"));
-const DOMString Constants::ELEMNAME_APPLY_IMPORTS_STRING(XALAN_STATIC_UCODE_STRING("apply-imports"));
-const DOMString Constants::ELEMNAME_APPLY_TEMPLATES_STRING(XALAN_STATIC_UCODE_STRING("apply-templates"));
-const DOMString Constants::ELEMNAME_ARG_STRING(XALAN_STATIC_UCODE_STRING("arg"));
-const DOMString Constants::ELEMNAME_ATTRIBUTESET_STRING(XALAN_STATIC_UCODE_STRING("attribute-set"));
-const DOMString Constants::ELEMNAME_ATTRIBUTE_STRING(XALAN_STATIC_UCODE_STRING("attribute"));
-const DOMString Constants::ELEMNAME_CALLTEMPLATEARG_STRING(XALAN_STATIC_UCODE_STRING("invoke-arg"));
-const DOMString Constants::ELEMNAME_CALLTEMPLATE_STRING(XALAN_STATIC_UCODE_STRING("call-template"));
-const DOMString Constants::ELEMNAME_CALL_STRING(XALAN_STATIC_UCODE_STRING("call"));
-const DOMString Constants::ELEMNAME_CHILDREN_STRING(XALAN_STATIC_UCODE_STRING("children"));
-const DOMString Constants::ELEMNAME_CHOOSE_STRING(XALAN_STATIC_UCODE_STRING("choose"));
-const DOMString Constants::ELEMNAME_COMMENT_STRING(XALAN_STATIC_UCODE_STRING("comment"));
-const DOMString Constants::ELEMNAME_CONSTRUCT_STRING(XALAN_STATIC_UCODE_STRING("construct"));
-const DOMString Constants::ELEMNAME_CONTENTS_STRING(XALAN_STATIC_UCODE_STRING("contents"));
-const DOMString Constants::ELEMNAME_COPY_OF_STRING(XALAN_STATIC_UCODE_STRING("copy-of"));
-const DOMString Constants::ELEMNAME_COPY_STRING(XALAN_STATIC_UCODE_STRING("copy"));
-const DOMString Constants::ELEMNAME_COUNTERINCREMENT_STRING(XALAN_STATIC_UCODE_STRING("counter-increment"));
-const DOMString Constants::ELEMNAME_COUNTERRESET_STRING(XALAN_STATIC_UCODE_STRING("counter-reset"));
-const DOMString Constants::ELEMNAME_COUNTERSCOPE_STRING(XALAN_STATIC_UCODE_STRING("counter-scope"));
-const DOMString Constants::ELEMNAME_COUNTERS_STRING(XALAN_STATIC_UCODE_STRING("counters"));
-const DOMString Constants::ELEMNAME_COUNTER_STRING(XALAN_STATIC_UCODE_STRING("counter"));
-const DOMString Constants::ELEMNAME_DISPLAYIF_STRING(XALAN_STATIC_UCODE_STRING("display-if"));
-const DOMString Constants::ELEMNAME_ELEMENT_STRING(XALAN_STATIC_UCODE_STRING("element"));
-const DOMString Constants::ELEMNAME_EMPTY_STRING(XALAN_STATIC_UCODE_STRING("empty"));
-const DOMString Constants::ELEMNAME_EVAL_STRING(XALAN_STATIC_UCODE_STRING("eval"));
-const DOMString Constants::ELEMNAME_EXPECTEDCHILDREN_STRING(XALAN_STATIC_UCODE_STRING("expectedchildren"));
-const DOMString Constants::ELEMNAME_EXTENSIONHANDLER_STRING(XALAN_STATIC_UCODE_STRING("code-dispatcher"));
-const DOMString Constants::ELEMNAME_EXTENSION_STRING(XALAN_STATIC_UCODE_STRING("functions"));
-const DOMString Constants::ELEMNAME_FALLBACK_STRING(XALAN_STATIC_UCODE_STRING("fallback"));
-const DOMString Constants::ELEMNAME_FOREACH_STRING(XALAN_STATIC_UCODE_STRING("for-each"));
-const DOMString Constants::ELEMNAME_IF_STRING(XALAN_STATIC_UCODE_STRING("if"));
-const DOMString Constants::ELEMNAME_IMPORT_STRING(XALAN_STATIC_UCODE_STRING("import"));
-const DOMString Constants::ELEMNAME_INCLUDE_STRING(XALAN_STATIC_UCODE_STRING("include"));
-const DOMString Constants::ELEMNAME_KEY_STRING(XALAN_STATIC_UCODE_STRING("key"));
-const DOMString Constants::ELEMNAME_LOCALE_STRING(XALAN_STATIC_UCODE_STRING("locale"));
-const DOMString Constants::ELEMNAME_MESSAGE_STRING(XALAN_STATIC_UCODE_STRING("message"));
-const DOMString Constants::ELEMNAME_NUMBER_STRING(XALAN_STATIC_UCODE_STRING("number"));
-const DOMString Constants::ELEMNAME_OTHERWISE_STRING(XALAN_STATIC_UCODE_STRING("otherwise"));
-const DOMString Constants::ELEMNAME_PARAM_STRING(XALAN_STATIC_UCODE_STRING("param"));
-const DOMString Constants::ELEMNAME_PRESERVESPACE_STRING(XALAN_STATIC_UCODE_STRING("preserve-space"));
-const DOMString Constants::ELEMNAME_ROOT_STRING(XALAN_STATIC_UCODE_STRING("root"));
-const DOMString Constants::ELEMNAME_SORT_STRING(XALAN_STATIC_UCODE_STRING("sort"));
-const DOMString Constants::ELEMNAME_STRIPSPACE_STRING(XALAN_STATIC_UCODE_STRING("strip-space"));
-const DOMString Constants::ELEMNAME_STYLESHEET_STRING(XALAN_STATIC_UCODE_STRING("stylesheet"));
-const DOMString Constants::ELEMNAME_TARGETATTRIBUTE_STRING(XALAN_STATIC_UCODE_STRING("target-attribute"));
-const DOMString Constants::ELEMNAME_TARGETCOMMENT_STRING(XALAN_STATIC_UCODE_STRING("target-comment"));
-const DOMString Constants::ELEMNAME_TARGETELEMENT_STRING(XALAN_STATIC_UCODE_STRING("target-element"));
-const DOMString Constants::ELEMNAME_TARGETPI_STRING(XALAN_STATIC_UCODE_STRING("target-pi"));
-const DOMString Constants::ELEMNAME_TARGETTEXT_STRING(XALAN_STATIC_UCODE_STRING("target-text"));
-const DOMString Constants::ELEMNAME_TEMPLATE_STRING(XALAN_STATIC_UCODE_STRING("template"));
-const DOMString Constants::ELEMNAME_TEXT_STRING(XALAN_STATIC_UCODE_STRING("text"));
-const DOMString Constants::ELEMNAME_TRANSFORM_STRING(XALAN_STATIC_UCODE_STRING("transform"));
-const DOMString Constants::ELEMNAME_URL_STRING(XALAN_STATIC_UCODE_STRING("uri"));
-const DOMString Constants::ELEMNAME_USE_STRING(XALAN_STATIC_UCODE_STRING("use"));
-const DOMString Constants::ELEMNAME_VALUEOF_STRING(XALAN_STATIC_UCODE_STRING("value-of"));
-const DOMString Constants::ELEMNAME_VARIABLE_STRING(XALAN_STATIC_UCODE_STRING("variable"));
-const DOMString Constants::ELEMNAME_WHEN_STRING(XALAN_STATIC_UCODE_STRING("when"));
-const DOMString Constants::ELEMNAME_COMPONENT_STRING(XALAN_STATIC_UCODE_STRING("component"));
-const DOMString Constants::ELEMNAME_CSSSTYLECONVERSION_STRING(XALAN_STATIC_UCODE_STRING("css-style-conversion"));
-const DOMString Constants::ELEMNAME_OUTPUT_STRING(XALAN_STATIC_UCODE_STRING("output"));
-const DOMString Constants::ELEMNAME_PARAMVARIABLE_OLD_STRING(XALAN_STATIC_UCODE_STRING("param-variable"));
-const DOMString Constants::ELEMNAME_PARAMVARIABLE_STRING(XALAN_STATIC_UCODE_STRING("param"));
-const DOMString Constants::ELEMNAME_PI_OLD_STRING(XALAN_STATIC_UCODE_STRING("pi"));
-const DOMString Constants::ELEMNAME_PI_STRING(XALAN_STATIC_UCODE_STRING("processing-instruction"));
-const DOMString Constants::ELEMNAME_SCRIPT_STRING(XALAN_STATIC_UCODE_STRING("script"));
-const DOMString Constants::ELEMNAME_WITHPARAM_STRING(XALAN_STATIC_UCODE_STRING("with-param"));
-
-
-
-const DOMString Constants::ATTRNAME_CLASS(XALAN_STATIC_UCODE_STRING("class"));
-const DOMString Constants::ATTRNAME_ATTRIBUTE(XALAN_STATIC_UCODE_STRING("attribute"));
-const DOMString Constants::ATTRNAME_ATTRIBUTE_SET(XALAN_STATIC_UCODE_STRING("attribute-set"));
-const DOMString Constants::ATTRNAME_AMOUNT(XALAN_STATIC_UCODE_STRING("amount"));
-const DOMString Constants::ATTRNAME_ANCESTOR(XALAN_STATIC_UCODE_STRING("ancestor"));
-const DOMString Constants::ATTRNAME_CASEORDER(XALAN_STATIC_UCODE_STRING("case-order"));
-const DOMString Constants::ATTRNAME_CONDITION(XALAN_STATIC_UCODE_STRING("condition"));
-const DOMString Constants::ATTRNAME_COPYTYPE(XALAN_STATIC_UCODE_STRING("copy-type"));
-const DOMString Constants::ATTRNAME_COUNT(XALAN_STATIC_UCODE_STRING("count"));
-const DOMString Constants::ATTRNAME_DATATYPE(XALAN_STATIC_UCODE_STRING("data-type"));
-const DOMString Constants::ATTRNAME_DEFAULTSPACE(XALAN_STATIC_UCODE_STRING("default-space"));
-const DOMString Constants::ATTRNAME_DEFAULT(XALAN_STATIC_UCODE_STRING("default"));
-const DOMString Constants::ATTRNAME_DEPTH(XALAN_STATIC_UCODE_STRING("with-children"));
-const DOMString Constants::ATTRNAME_DIGITGROUPSEP(XALAN_STATIC_UCODE_STRING("digit-group-sep"));
-const DOMString Constants::ATTRNAME_ELEMENT(XALAN_STATIC_UCODE_STRING("element"));
-const DOMString Constants::ATTRNAME_ELEMENTS(XALAN_STATIC_UCODE_STRING("elements"));
-const DOMString Constants::ATTRNAME_EXPR(XALAN_STATIC_UCODE_STRING("expr"));
-const DOMString Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES(XALAN_STATIC_UCODE_STRING("extension-element-prefixes"));
-const DOMString Constants::ATTRNAME_FORMAT(XALAN_STATIC_UCODE_STRING("format"));
-const DOMString Constants::ATTRNAME_FROM(XALAN_STATIC_UCODE_STRING("from"));
-const DOMString Constants::ATTRNAME_GROUPINGSEPARATOR(XALAN_STATIC_UCODE_STRING("grouping-separator"));
-const DOMString Constants::ATTRNAME_GROUPINGSIZE(XALAN_STATIC_UCODE_STRING("grouping-size"));
-const DOMString Constants::ATTRNAME_HREF(XALAN_STATIC_UCODE_STRING("href"));
-const DOMString Constants::ATTRNAME_ID(XALAN_STATIC_UCODE_STRING("id"));
-const DOMString Constants::ATTRNAME_IMPORTANCE(XALAN_STATIC_UCODE_STRING("importance"));
-const DOMString Constants::ATTRNAME_INDENTRESULT(XALAN_STATIC_UCODE_STRING("indent-result"));
-const DOMString Constants::ATTRNAME_LETTERVALUE(XALAN_STATIC_UCODE_STRING("letter-value"));
-const DOMString Constants::ATTRNAME_LEVEL(XALAN_STATIC_UCODE_STRING("level"));
-const DOMString Constants::ATTRNAME_LANG(XALAN_STATIC_UCODE_STRING("lang"));
-//const DOMString Constants::ATTRNAME_MACRO(XALAN_STATIC_UCODE_STRING("macro"));
-const DOMString Constants::ATTRNAME_MATCH(XALAN_STATIC_UCODE_STRING("match"));
-const DOMString Constants::ATTRNAME_MODE(XALAN_STATIC_UCODE_STRING("mode"));
-const DOMString Constants::ATTRNAME_NAME(XALAN_STATIC_UCODE_STRING("name"));
-const DOMString Constants::ATTRNAME_NAMESPACE(XALAN_STATIC_UCODE_STRING("namespace"));
-const DOMString Constants::ATTRNAME_NDIGITSPERGROUP(XALAN_STATIC_UCODE_STRING("n-digits-per-group"));
-const DOMString Constants::ATTRNAME_ONLY(XALAN_STATIC_UCODE_STRING("only"));
-const DOMString Constants::ATTRNAME_ORDER(XALAN_STATIC_UCODE_STRING("order"));
-const DOMString Constants::ATTRNAME_PRIORITY(XALAN_STATIC_UCODE_STRING("priority"));
-const DOMString Constants::ATTRNAME_REFID(XALAN_STATIC_UCODE_STRING("refID"));
-const DOMString Constants::ATTRNAME_RESULTNS(XALAN_STATIC_UCODE_STRING("result-ns"));
-const DOMString Constants::ATTRNAME_SELECT(XALAN_STATIC_UCODE_STRING("select"));
-const DOMString Constants::ATTRNAME_SEQUENCESRC(XALAN_STATIC_UCODE_STRING("sequence-src"));
-const DOMString Constants::ATTRNAME_STYLE(XALAN_STATIC_UCODE_STRING("style"));
-const DOMString Constants::ATTRNAME_TEST(XALAN_STATIC_UCODE_STRING("test"));
-const DOMString Constants::ATTRNAME_TOSTRING(XALAN_STATIC_UCODE_STRING("to-string"));
-const DOMString Constants::ATTRNAME_TYPE(XALAN_STATIC_UCODE_STRING("type"));
-const DOMString Constants::ATTRNAME_USE(XALAN_STATIC_UCODE_STRING("use"));
-const DOMString Constants::ATTRNAME_USEATTRIBUTESETS(XALAN_STATIC_UCODE_STRING("use-attribute-sets"));
-const DOMString Constants::ATTRNAME_VALUE(XALAN_STATIC_UCODE_STRING("value"));
-const DOMString Constants::ATTRNAME_XMLNSDEF(XALAN_STATIC_UCODE_STRING("xmlns"));
-const DOMString Constants::ATTRNAME_XMLNS(XALAN_STATIC_UCODE_STRING("xmlns:"));
-const DOMString Constants::ATTRNAME_XMLSPACE(XALAN_STATIC_UCODE_STRING("xml:space"));
-const DOMString Constants::ATTRNAME_NS(XALAN_STATIC_UCODE_STRING("ns"));
-const DOMString Constants::ATTRNAME_CLASSID(XALAN_STATIC_UCODE_STRING("classid"));
-const DOMString Constants::ATTRNAME_ARCHIVE(XALAN_STATIC_UCODE_STRING("archive"));
-const DOMString Constants::ATTRNAME_CODETYPE(XALAN_STATIC_UCODE_STRING("type"));
-const DOMString Constants::ATTRNAME_CODEBASE(XALAN_STATIC_UCODE_STRING("codebase"));
-const DOMString Constants::ATTRNAME_METHOD(XALAN_STATIC_UCODE_STRING("calls"));
-const DOMString Constants::ATTRVAL_PRESERVE(XALAN_STATIC_UCODE_STRING("preserve"));
-const DOMString Constants::ATTRVAL_STRIP(XALAN_STATIC_UCODE_STRING("strip"));
-const DOMString Constants::ATTRVAL_YES(XALAN_STATIC_UCODE_STRING("yes"));
-const DOMString Constants::ATTRVAL_NO(XALAN_STATIC_UCODE_STRING("no"));
-const DOMString Constants::ATTRVAL_ALPHABETIC(XALAN_STATIC_UCODE_STRING("alphabetic"));
-const DOMString Constants::ATTRVAL_OTHER(XALAN_STATIC_UCODE_STRING("other"));
-const DOMString Constants::ATTRVAL_SINGLE(XALAN_STATIC_UCODE_STRING("single"));
-const DOMString Constants::ATTRVAL_MULTI(XALAN_STATIC_UCODE_STRING("multiple"));
-const DOMString Constants::ATTRVAL_ANY(XALAN_STATIC_UCODE_STRING("any"));
-const DOMString Constants::ATTRNAME_OUTPUT_METHOD(XALAN_STATIC_UCODE_STRING("method"));
-const DOMString Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING (XALAN_STATIC_UCODE_STRING("disable-output-escaping"));
-const DOMString Constants::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS (XALAN_STATIC_UCODE_STRING("cdata-section-elements"));
-const DOMString Constants::ATTRNAME_OUTPUT_DOCTYPE_PUBLIC(XALAN_STATIC_UCODE_STRING("doctype-public"));
-const DOMString Constants::ATTRNAME_OUTPUT_DOCTYPE_SYSTEM(XALAN_STATIC_UCODE_STRING("doctype-system"));
-const DOMString Constants::ATTRNAME_OUTPUT_ENCODING(XALAN_STATIC_UCODE_STRING("encoding"));
-const DOMString Constants::ATTRNAME_OUTPUT_INDENT(XALAN_STATIC_UCODE_STRING("indent"));
-const DOMString Constants::ATTRNAME_OUTPUT_MEDIATYPE(XALAN_STATIC_UCODE_STRING("media-type"));
-const DOMString Constants::ATTRNAME_OUTPUT_STANDALONE (XALAN_STATIC_UCODE_STRING("standalone"));
-const DOMString Constants::ATTRNAME_OUTPUT_VERSION(XALAN_STATIC_UCODE_STRING("version"));
-//const DOMString Constants::ATTRNAME_OUTPUT_XMLDECL(XALAN_STATIC_UCODE_STRING("xml-declaration"));
-const DOMString Constants::ATTRNAME_OUTPUT_OMITXMLDECL(XALAN_STATIC_UCODE_STRING("omit-xml-declaration"));
-const DOMString Constants::ATTRVAL_OUTPUT_METHOD_HTML(XALAN_STATIC_UCODE_STRING("html"));
-const DOMString Constants::ATTRVAL_OUTPUT_METHOD_XML(XALAN_STATIC_UCODE_STRING("xml"));
-const DOMString Constants::ATTRVAL_OUTPUT_METHOD_TEXT(XALAN_STATIC_UCODE_STRING("text"));
-const DOMString Constants::ATTRVAL_THIS(XALAN_STATIC_UCODE_STRING("."));
-const DOMString Constants::ATTRVAL_PARENT(XALAN_STATIC_UCODE_STRING(".."));
-const DOMString Constants::ATTRVAL_ANCESTOR(XALAN_STATIC_UCODE_STRING("ancestor"));
-const DOMString Constants::ATTRVAL_ID(XALAN_STATIC_UCODE_STRING("id"));
-const DOMString Constants::ATTRVAL_DATATYPE_TEXT(XALAN_STATIC_UCODE_STRING("text"));
-const DOMString Constants::ATTRVAL_DATATYPE_NUMBER(XALAN_STATIC_UCODE_STRING("number"));
-const DOMString Constants::ATTRVAL_ORDER_ASCENDING(XALAN_STATIC_UCODE_STRING("ascending"));
-const DOMString Constants::ATTRVAL_ORDER_DESCENDING(XALAN_STATIC_UCODE_STRING("descending"));
-const DOMString Constants::ATTRVAL_CASEORDER_UPPER(XALAN_STATIC_UCODE_STRING("upper-first"));
-const DOMString Constants::ATTRVAL_CASEORDER_LOWER(XALAN_STATIC_UCODE_STRING("lower-first"));
-
-
-
-const DOMString Constants::PSEUDONAME_ANY(XALAN_STATIC_UCODE_STRING("*"));
-const DOMString Constants::PSEUDONAME_ROOT(XALAN_STATIC_UCODE_STRING("/"));
-const DOMString Constants::PSEUDONAME_TEXT(XALAN_STATIC_UCODE_STRING("#text"));
-const DOMString Constants::PSEUDONAME_COMMENT(XALAN_STATIC_UCODE_STRING("#comment"));
-const DOMString Constants::PSEUDONAME_PI(XALAN_STATIC_UCODE_STRING("#pi"));
-const DOMString Constants::PSEUDONAME_OTHER(XALAN_STATIC_UCODE_STRING("*"));
+const XalanDOMString Constants::ELEMNAME_ANCHOR_STRING(XALAN_STATIC_UCODE_STRING("anchor"));
+const XalanDOMString Constants::ELEMNAME_ANY_STRING(XALAN_STATIC_UCODE_STRING("any"));
+const XalanDOMString Constants::ELEMNAME_APPLY_IMPORTS_STRING(XALAN_STATIC_UCODE_STRING("apply-imports"));
+const XalanDOMString Constants::ELEMNAME_APPLY_TEMPLATES_STRING(XALAN_STATIC_UCODE_STRING("apply-templates"));
+const XalanDOMString Constants::ELEMNAME_ARG_STRING(XALAN_STATIC_UCODE_STRING("arg"));
+const XalanDOMString Constants::ELEMNAME_ATTRIBUTESET_STRING(XALAN_STATIC_UCODE_STRING("attribute-set"));
+const XalanDOMString Constants::ELEMNAME_ATTRIBUTE_STRING(XALAN_STATIC_UCODE_STRING("attribute"));
+const XalanDOMString Constants::ELEMNAME_CALLTEMPLATEARG_STRING(XALAN_STATIC_UCODE_STRING("invoke-arg"));
+const XalanDOMString Constants::ELEMNAME_CALLTEMPLATE_STRING(XALAN_STATIC_UCODE_STRING("call-template"));
+const XalanDOMString Constants::ELEMNAME_CALL_STRING(XALAN_STATIC_UCODE_STRING("call"));
+const XalanDOMString Constants::ELEMNAME_CHILDREN_STRING(XALAN_STATIC_UCODE_STRING("children"));
+const XalanDOMString Constants::ELEMNAME_CHOOSE_STRING(XALAN_STATIC_UCODE_STRING("choose"));
+const XalanDOMString Constants::ELEMNAME_COMMENT_STRING(XALAN_STATIC_UCODE_STRING("comment"));
+const XalanDOMString Constants::ELEMNAME_CONSTRUCT_STRING(XALAN_STATIC_UCODE_STRING("construct"));
+const XalanDOMString Constants::ELEMNAME_CONTENTS_STRING(XALAN_STATIC_UCODE_STRING("contents"));
+const XalanDOMString Constants::ELEMNAME_COPY_OF_STRING(XALAN_STATIC_UCODE_STRING("copy-of"));
+const XalanDOMString Constants::ELEMNAME_COPY_STRING(XALAN_STATIC_UCODE_STRING("copy"));
+const XalanDOMString Constants::ELEMNAME_COUNTERINCREMENT_STRING(XALAN_STATIC_UCODE_STRING("counter-increment"));
+const XalanDOMString Constants::ELEMNAME_COUNTERRESET_STRING(XALAN_STATIC_UCODE_STRING("counter-reset"));
+const XalanDOMString Constants::ELEMNAME_COUNTERSCOPE_STRING(XALAN_STATIC_UCODE_STRING("counter-scope"));
+const XalanDOMString Constants::ELEMNAME_COUNTERS_STRING(XALAN_STATIC_UCODE_STRING("counters"));
+const XalanDOMString Constants::ELEMNAME_COUNTER_STRING(XALAN_STATIC_UCODE_STRING("counter"));
+const XalanDOMString Constants::ELEMNAME_DECIMALFORMAT_STRING(XALAN_STATIC_UCODE_STRING("decimal-format"));
+const XalanDOMString Constants::ELEMNAME_DISPLAYIF_STRING(XALAN_STATIC_UCODE_STRING("display-if"));
+const XalanDOMString Constants::ELEMNAME_ELEMENT_STRING(XALAN_STATIC_UCODE_STRING("element"));
+const XalanDOMString Constants::ELEMNAME_EMPTY_STRING(XALAN_STATIC_UCODE_STRING("empty"));
+const XalanDOMString Constants::ELEMNAME_EVAL_STRING(XALAN_STATIC_UCODE_STRING("eval"));
+const XalanDOMString Constants::ELEMNAME_EXPECTEDCHILDREN_STRING(XALAN_STATIC_UCODE_STRING("expectedchildren"));
+const XalanDOMString Constants::ELEMNAME_EXTENSIONHANDLER_STRING(XALAN_STATIC_UCODE_STRING("code-dispatcher"));
+const XalanDOMString Constants::ELEMNAME_EXTENSION_STRING(XALAN_STATIC_UCODE_STRING("functions"));
+const XalanDOMString Constants::ELEMNAME_FALLBACK_STRING(XALAN_STATIC_UCODE_STRING("fallback"));
+const XalanDOMString Constants::ELEMNAME_FOREACH_STRING(XALAN_STATIC_UCODE_STRING("for-each"));
+const XalanDOMString Constants::ELEMNAME_IF_STRING(XALAN_STATIC_UCODE_STRING("if"));
+const XalanDOMString Constants::ELEMNAME_IMPORT_STRING(XALAN_STATIC_UCODE_STRING("import"));
+const XalanDOMString Constants::ELEMNAME_INCLUDE_STRING(XALAN_STATIC_UCODE_STRING("include"));
+const XalanDOMString Constants::ELEMNAME_KEY_STRING(XALAN_STATIC_UCODE_STRING("key"));
+const XalanDOMString Constants::ELEMNAME_LOCALE_STRING(XALAN_STATIC_UCODE_STRING("locale"));
+const XalanDOMString Constants::ELEMNAME_MESSAGE_STRING(XALAN_STATIC_UCODE_STRING("message"));
+const XalanDOMString Constants::ELEMNAME_NSALIAS_STRING(XALAN_STATIC_UCODE_STRING("namespace-alias"));
+
+const XalanDOMString Constants::ELEMNAME_NUMBER_STRING(XALAN_STATIC_UCODE_STRING("number"));
+const XalanDOMString Constants::ELEMNAME_OTHERWISE_STRING(XALAN_STATIC_UCODE_STRING("otherwise"));
+const XalanDOMString Constants::ELEMNAME_PARAM_STRING(XALAN_STATIC_UCODE_STRING("param"));
+const XalanDOMString Constants::ELEMNAME_PRESERVESPACE_STRING(XALAN_STATIC_UCODE_STRING("preserve-space"));
+const XalanDOMString Constants::ELEMNAME_ROOT_STRING(XALAN_STATIC_UCODE_STRING("root"));
+const XalanDOMString Constants::ELEMNAME_SORT_STRING(XALAN_STATIC_UCODE_STRING("sort"));
+const XalanDOMString Constants::ELEMNAME_STRIPSPACE_STRING(XALAN_STATIC_UCODE_STRING("strip-space"));
+const XalanDOMString Constants::ELEMNAME_STYLESHEET_STRING(XALAN_STATIC_UCODE_STRING("stylesheet"));
+const XalanDOMString Constants::ELEMNAME_TARGETATTRIBUTE_STRING(XALAN_STATIC_UCODE_STRING("target-attribute"));
+const XalanDOMString Constants::ELEMNAME_TARGETCOMMENT_STRING(XALAN_STATIC_UCODE_STRING("target-comment"));
+const XalanDOMString Constants::ELEMNAME_TARGETELEMENT_STRING(XALAN_STATIC_UCODE_STRING("target-element"));
+const XalanDOMString Constants::ELEMNAME_TARGETPI_STRING(XALAN_STATIC_UCODE_STRING("target-pi"));
+const XalanDOMString Constants::ELEMNAME_TARGETTEXT_STRING(XALAN_STATIC_UCODE_STRING("target-text"));
+const XalanDOMString Constants::ELEMNAME_TEMPLATE_STRING(XALAN_STATIC_UCODE_STRING("template"));
+const XalanDOMString Constants::ELEMNAME_TEXT_STRING(XALAN_STATIC_UCODE_STRING("text"));
+const XalanDOMString Constants::ELEMNAME_TRANSFORM_STRING(XALAN_STATIC_UCODE_STRING("transform"));
+const XalanDOMString Constants::ELEMNAME_URL_STRING(XALAN_STATIC_UCODE_STRING("uri"));
+const XalanDOMString Constants::ELEMNAME_USE_STRING(XALAN_STATIC_UCODE_STRING("use"));
+const XalanDOMString Constants::ELEMNAME_VALUEOF_STRING(XALAN_STATIC_UCODE_STRING("value-of"));
+const XalanDOMString Constants::ELEMNAME_VARIABLE_STRING(XALAN_STATIC_UCODE_STRING("variable"));
+const XalanDOMString Constants::ELEMNAME_WHEN_STRING(XALAN_STATIC_UCODE_STRING("when"));
+const XalanDOMString Constants::ELEMNAME_COMPONENT_STRING(XALAN_STATIC_UCODE_STRING("component"));
+const XalanDOMString Constants::ELEMNAME_CSSSTYLECONVERSION_STRING(XALAN_STATIC_UCODE_STRING("css-style-conversion"));
+const XalanDOMString Constants::ELEMNAME_OUTPUT_STRING(XALAN_STATIC_UCODE_STRING("output"));
+const XalanDOMString Constants::ELEMNAME_PARAMVARIABLE_OLD_STRING(XALAN_STATIC_UCODE_STRING("param-variable"));
+const XalanDOMString Constants::ELEMNAME_PARAMVARIABLE_STRING(XALAN_STATIC_UCODE_STRING("param"));
+const XalanDOMString Constants::ELEMNAME_PI_OLD_STRING(XALAN_STATIC_UCODE_STRING("pi"));
+const XalanDOMString Constants::ELEMNAME_PI_STRING(XALAN_STATIC_UCODE_STRING("processing-instruction"));
+const XalanDOMString Constants::ELEMNAME_SCRIPT_STRING(XALAN_STATIC_UCODE_STRING("script"));
+const XalanDOMString Constants::ELEMNAME_WITHPARAM_STRING(XALAN_STATIC_UCODE_STRING("with-param"));
+
+
+
+const XalanDOMString Constants::ATTRNAME_CLASS(XALAN_STATIC_UCODE_STRING("class"));
+const XalanDOMString Constants::ATTRNAME_ATTRIBUTE(XALAN_STATIC_UCODE_STRING("attribute"));
+const XalanDOMString Constants::ATTRNAME_ATTRIBUTE_SET(XALAN_STATIC_UCODE_STRING("attribute-set"));
+const XalanDOMString Constants::ATTRNAME_AMOUNT(XALAN_STATIC_UCODE_STRING("amount"));
+const XalanDOMString Constants::ATTRNAME_ANCESTOR(XALAN_STATIC_UCODE_STRING("ancestor"));
+const XalanDOMString Constants::ATTRNAME_CASEORDER(XALAN_STATIC_UCODE_STRING("case-order"));
+const XalanDOMString Constants::ATTRNAME_CONDITION(XALAN_STATIC_UCODE_STRING("condition"));
+const XalanDOMString Constants::ATTRNAME_COPYTYPE(XALAN_STATIC_UCODE_STRING("copy-type"));
+const XalanDOMString Constants::ATTRNAME_COUNT(XALAN_STATIC_UCODE_STRING("count"));
+const XalanDOMString Constants::ATTRNAME_DATATYPE(XALAN_STATIC_UCODE_STRING("data-type"));
+const XalanDOMString Constants::ATTRNAME_DECIMALSEPARATOR(XALAN_STATIC_UCODE_STRING("decimal-separator"));
+const XalanDOMString Constants::ATTRNAME_DEFAULTSPACE(XALAN_STATIC_UCODE_STRING("default-space"));
+const XalanDOMString Constants::ATTRNAME_DEFAULT(XALAN_STATIC_UCODE_STRING("default"));
+const XalanDOMString Constants::ATTRNAME_DEPTH(XALAN_STATIC_UCODE_STRING("with-children"));
+const XalanDOMString Constants::ATTRNAME_DIGIT(XALAN_STATIC_UCODE_STRING("digit"));
+const XalanDOMString Constants::ATTRNAME_DIGITGROUPSEP(XALAN_STATIC_UCODE_STRING("digit-group-sep"));
+const XalanDOMString Constants::ATTRNAME_ELEMENT(XALAN_STATIC_UCODE_STRING("element"));
+const XalanDOMString Constants::ATTRNAME_ELEMENTS(XALAN_STATIC_UCODE_STRING("elements"));
+const XalanDOMString Constants::ATTRNAME_EXPR(XALAN_STATIC_UCODE_STRING("expr"));
+const XalanDOMString Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES(XALAN_STATIC_UCODE_STRING("extension-element-prefixes"));
+const XalanDOMString Constants::ATTRNAME_FORMAT(XALAN_STATIC_UCODE_STRING("format"));
+const XalanDOMString Constants::ATTRNAME_FROM(XALAN_STATIC_UCODE_STRING("from"));
+const XalanDOMString Constants::ATTRNAME_GROUPINGSEPARATOR(XALAN_STATIC_UCODE_STRING("grouping-separator"));
+const XalanDOMString Constants::ATTRNAME_GROUPINGSIZE(XALAN_STATIC_UCODE_STRING("grouping-size"));
+const XalanDOMString Constants::ATTRNAME_HREF(XALAN_STATIC_UCODE_STRING("href"));
+const XalanDOMString Constants::ATTRNAME_ID(XALAN_STATIC_UCODE_STRING("id"));
+const XalanDOMString Constants::ATTRNAME_IMPORTANCE(XALAN_STATIC_UCODE_STRING("importance"));
+const XalanDOMString Constants::ATTRNAME_INDENTRESULT(XALAN_STATIC_UCODE_STRING("indent-result"));
+const XalanDOMString Constants::ATTRNAME_INFINITY(XALAN_STATIC_UCODE_STRING("infinity"));
+const XalanDOMString Constants::ATTRNAME_LETTERVALUE(XALAN_STATIC_UCODE_STRING("letter-value"));
+const XalanDOMString Constants::ATTRNAME_LEVEL(XALAN_STATIC_UCODE_STRING("level"));
+const XalanDOMString Constants::ATTRNAME_LANG(XALAN_STATIC_UCODE_STRING("lang"));
+//const XalanDOMString Constants::ATTRNAME_MACRO(XALAN_STATIC_UCODE_STRING("macro"));
+const XalanDOMString Constants::ATTRNAME_MATCH(XALAN_STATIC_UCODE_STRING("match"));
+const XalanDOMString Constants::ATTRNAME_MINUSSIGN(XALAN_STATIC_UCODE_STRING("minus-sign"));
+const XalanDOMString Constants::ATTRNAME_MODE(XALAN_STATIC_UCODE_STRING("mode"));
+const XalanDOMString Constants::ATTRNAME_NAME(XALAN_STATIC_UCODE_STRING("name"));
+const XalanDOMString Constants::ATTRNAME_NAMESPACE(XALAN_STATIC_UCODE_STRING("namespace"));
+const XalanDOMString Constants::ATTRNAME_NAN(XALAN_STATIC_UCODE_STRING("NaN"));
+const XalanDOMString Constants::ATTRNAME_NDIGITSPERGROUP(XALAN_STATIC_UCODE_STRING("n-digits-per-group"));
+const XalanDOMString Constants::ATTRNAME_ONLY(XALAN_STATIC_UCODE_STRING("only"));
+const XalanDOMString Constants::ATTRNAME_ORDER(XALAN_STATIC_UCODE_STRING("order"));
+const XalanDOMString Constants::ATTRNAME_PATTERNSEPARATOR(XALAN_STATIC_UCODE_STRING("pattern-separator"));
+const XalanDOMString Constants::ATTRNAME_PERCENT(XALAN_STATIC_UCODE_STRING("percent"));
+const XalanDOMString Constants::ATTRNAME_PERMILLE(XALAN_STATIC_UCODE_STRING("per-mille"));
+const XalanDOMString Constants::ATTRNAME_PRIORITY(XALAN_STATIC_UCODE_STRING("priority"));
+const XalanDOMString Constants::ATTRNAME_REFID(XALAN_STATIC_UCODE_STRING("refID"));
+const XalanDOMString Constants::ATTRNAME_RESULTNS(XALAN_STATIC_UCODE_STRING("result-ns"));
+const XalanDOMString Constants::ATTRNAME_RESULT_PREFIX(XALAN_STATIC_UCODE_STRING("result-prefix"));
+const XalanDOMString Constants::ATTRNAME_SELECT(XALAN_STATIC_UCODE_STRING("select"));
+const XalanDOMString Constants::ATTRNAME_SEQUENCESRC(XALAN_STATIC_UCODE_STRING("sequence-src"));
+const XalanDOMString Constants::ATTRNAME_STYLE(XALAN_STATIC_UCODE_STRING("style"));
+const XalanDOMString Constants::ATTRNAME_STYLESHEET_PREFIX(XALAN_STATIC_UCODE_STRING("stylesheet-prefix"));
+const XalanDOMString Constants::ATTRNAME_TEST(XALAN_STATIC_UCODE_STRING("test"));
+const XalanDOMString Constants::ATTRNAME_TOSTRING(XALAN_STATIC_UCODE_STRING("to-string"));
+const XalanDOMString Constants::ATTRNAME_TYPE(XALAN_STATIC_UCODE_STRING("type"));
+const XalanDOMString Constants::ATTRNAME_USE(XALAN_STATIC_UCODE_STRING("use"));
+const XalanDOMString Constants::ATTRNAME_USEATTRIBUTESETS(XALAN_STATIC_UCODE_STRING("use-attribute-sets"));
+const XalanDOMString Constants::ATTRNAME_VALUE(XALAN_STATIC_UCODE_STRING("value"));
+const XalanDOMString Constants::ATTRNAME_XMLNSDEF(XALAN_STATIC_UCODE_STRING("xmlns"));
+const XalanDOMString Constants::ATTRNAME_XMLNS(XALAN_STATIC_UCODE_STRING("xmlns:"));
+const XalanDOMString Constants::ATTRNAME_XMLSPACE(XALAN_STATIC_UCODE_STRING("xml:space"));
+const XalanDOMString Constants::ATTRNAME_NS(XALAN_STATIC_UCODE_STRING("ns"));
+const XalanDOMString Constants::ATTRNAME_CLASSID(XALAN_STATIC_UCODE_STRING("classid"));
+const XalanDOMString Constants::ATTRNAME_ARCHIVE(XALAN_STATIC_UCODE_STRING("archive"));
+const XalanDOMString Constants::ATTRNAME_CODETYPE(XALAN_STATIC_UCODE_STRING("type"));
+const XalanDOMString Constants::ATTRNAME_CODEBASE(XALAN_STATIC_UCODE_STRING("codebase"));
+const XalanDOMString Constants::ATTRNAME_METHOD(XALAN_STATIC_UCODE_STRING("calls"));
+const XalanDOMString Constants::ATTRVAL_PRESERVE(XALAN_STATIC_UCODE_STRING("preserve"));
+const XalanDOMString Constants::ATTRVAL_STRIP(XALAN_STATIC_UCODE_STRING("strip"));
+const XalanDOMString Constants::ATTRVAL_YES(XALAN_STATIC_UCODE_STRING("yes"));
+const XalanDOMString Constants::ATTRVAL_NO(XALAN_STATIC_UCODE_STRING("no"));
+const XalanDOMString Constants::ATTRVAL_ALPHABETIC(XALAN_STATIC_UCODE_STRING("alphabetic"));
+const XalanDOMString Constants::ATTRVAL_OTHER(XALAN_STATIC_UCODE_STRING("other"));
+const XalanDOMString Constants::ATTRVAL_SINGLE(XALAN_STATIC_UCODE_STRING("single"));
+const XalanDOMString Constants::ATTRVAL_MULTI(XALAN_STATIC_UCODE_STRING("multiple"));
+const XalanDOMString Constants::ATTRVAL_ANY(XALAN_STATIC_UCODE_STRING("any"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_METHOD(XALAN_STATIC_UCODE_STRING("method"));
+const XalanDOMString Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING (XALAN_STATIC_UCODE_STRING("disable-output-escaping"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS (XALAN_STATIC_UCODE_STRING("cdata-section-elements"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_DOCTYPE_PUBLIC(XALAN_STATIC_UCODE_STRING("doctype-public"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_DOCTYPE_SYSTEM(XALAN_STATIC_UCODE_STRING("doctype-system"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_ENCODING(XALAN_STATIC_UCODE_STRING("encoding"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_INDENT(XALAN_STATIC_UCODE_STRING("indent"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_MEDIATYPE(XALAN_STATIC_UCODE_STRING("media-type"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_STANDALONE (XALAN_STATIC_UCODE_STRING("standalone"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_VERSION(XALAN_STATIC_UCODE_STRING("version"));
+//const XalanDOMString Constants::ATTRNAME_OUTPUT_XMLDECL(XALAN_STATIC_UCODE_STRING("xml-declaration"));
+const XalanDOMString Constants::ATTRNAME_OUTPUT_OMITXMLDECL(XALAN_STATIC_UCODE_STRING("omit-xml-declaration"));
+const XalanDOMString Constants::ATTRNAME_ZERODIGIT(XALAN_STATIC_UCODE_STRING("zero-digit"));
+
+const XalanDOMString Constants::ATTRVAL_OUTPUT_METHOD_HTML(XALAN_STATIC_UCODE_STRING("html"));
+const XalanDOMString Constants::ATTRVAL_OUTPUT_METHOD_XML(XALAN_STATIC_UCODE_STRING("xml"));
+const XalanDOMString Constants::ATTRVAL_OUTPUT_METHOD_TEXT(XALAN_STATIC_UCODE_STRING("text"));
+const XalanDOMString Constants::ATTRVAL_THIS(XALAN_STATIC_UCODE_STRING("."));
+const XalanDOMString Constants::ATTRVAL_PARENT(XALAN_STATIC_UCODE_STRING(".."));
+const XalanDOMString Constants::ATTRVAL_ANCESTOR(XALAN_STATIC_UCODE_STRING("ancestor"));
+const XalanDOMString Constants::ATTRVAL_ID(XALAN_STATIC_UCODE_STRING("id"));
+const XalanDOMString Constants::ATTRVAL_DATATYPE_TEXT(XALAN_STATIC_UCODE_STRING("text"));
+const XalanDOMString Constants::ATTRVAL_DATATYPE_NUMBER(XALAN_STATIC_UCODE_STRING("number"));
+const XalanDOMString Constants::ATTRVAL_ORDER_ASCENDING(XALAN_STATIC_UCODE_STRING("ascending"));
+const XalanDOMString Constants::ATTRVAL_ORDER_DESCENDING(XALAN_STATIC_UCODE_STRING("descending"));
+const XalanDOMString Constants::ATTRVAL_CASEORDER_UPPER(XALAN_STATIC_UCODE_STRING("upper-first"));
+const XalanDOMString Constants::ATTRVAL_CASEORDER_LOWER(XALAN_STATIC_UCODE_STRING("lower-first"));
+const XalanDOMString Constants::ATTRVAL_DEFAULT_PREFIX(XALAN_STATIC_UCODE_STRING("#default"));
+
+const XalanDOMString Constants::ATTRVAL_INFINITY(XALAN_STATIC_UCODE_STRING("Infinity"));
+const XalanDOMString Constants::ATTRVAL_NAN(XALAN_STATIC_UCODE_STRING("NaN"));
+
+const XalanDOMString Constants::DEFAULT_DECIMAL_FORMAT(XALAN_STATIC_UCODE_STRING("#default"));
+
+const XalanDOMString Constants::PSEUDONAME_ANY(XALAN_STATIC_UCODE_STRING("*"));
+const XalanDOMString Constants::PSEUDONAME_ROOT(XALAN_STATIC_UCODE_STRING("/"));
+const XalanDOMString Constants::PSEUDONAME_TEXT(XALAN_STATIC_UCODE_STRING("#text"));
+const XalanDOMString Constants::PSEUDONAME_COMMENT(XALAN_STATIC_UCODE_STRING("#comment"));
+const XalanDOMString Constants::PSEUDONAME_PI(XALAN_STATIC_UCODE_STRING("#pi"));
+const XalanDOMString Constants::PSEUDONAME_OTHER(XALAN_STATIC_UCODE_STRING("*"));
1.5 +198 -180 xml-xalan/c/src/XSLT/Constants.hpp
Index: Constants.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Constants.hpp 2000/03/23 12:59:36 1.4
+++ Constants.hpp 2000/04/11 15:09:21 1.5
@@ -57,13 +57,6 @@
#if !defined(XALAN_CONSTANTS_HEADER_GUARD)
#define XALAN_CONSTANTS_HEADER_GUARD
-/**
- * $State: Exp $
- *
- * @author Scott Boag (scott_boag@lotus.com)
- * @author David N. Bertoni (dbertoni@lotus.com)
- */
-
// Base include file. Must be first.
@@ -71,7 +64,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -170,9 +163,11 @@
ELEMNAME_OUTPUT = 80,
ELEMNAME_COMPONENT = 81,
- ELEMNAME_SCRIPT = 82
-
- // Next free number: 83
+ ELEMNAME_SCRIPT = 82,
+ ELEMNAME_DECIMALFORMAT = 83,
+ ELEMNAME_NSALIAS = 84
+
+ // Next free number: 85
};
/**
@@ -181,188 +176,208 @@
*/
// Result tree counting
- static const DOMString ELEMNAME_ANCHOR_STRING;
- static const DOMString ELEMNAME_ANY_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_APPLY_IMPORTS_STRING;
- static const DOMString ELEMNAME_APPLY_TEMPLATES_STRING;
- static const DOMString ELEMNAME_ARG_STRING;
- static const DOMString ELEMNAME_ATTRIBUTESET_STRING;
- static const DOMString ELEMNAME_ATTRIBUTE_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_CALLTEMPLATEARG_STRING;
- static const DOMString ELEMNAME_CALLTEMPLATE_STRING;
- static const DOMString ELEMNAME_CALL_STRING;
- static const DOMString ELEMNAME_CHILDREN_STRING;
- static const DOMString ELEMNAME_CHOOSE_STRING;
- static const DOMString ELEMNAME_COMMENT_STRING;
- static const DOMString ELEMNAME_CONSTRUCT_STRING; // my own
- static const DOMString ELEMNAME_CONTENTS_STRING;
- static const DOMString ELEMNAME_COPY_OF_STRING;
- static const DOMString ELEMNAME_COPY_STRING;
- static const DOMString ELEMNAME_COUNTERINCREMENT_STRING;
- static const DOMString ELEMNAME_COUNTERRESET_STRING;
- static const DOMString ELEMNAME_COUNTERSCOPE_STRING;
- static const DOMString ELEMNAME_COUNTERS_STRING;
- static const DOMString ELEMNAME_COUNTER_STRING;
- static const DOMString ELEMNAME_DISPLAYIF_STRING; // my own
- static const DOMString ELEMNAME_ELEMENT_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_EMPTY_STRING;
- static const DOMString ELEMNAME_EVAL_STRING;
- static const DOMString ELEMNAME_EXPECTEDCHILDREN_STRING;
- static const DOMString ELEMNAME_EXTENSIONHANDLER_STRING;
- static const DOMString ELEMNAME_EXTENSION_STRING;
- static const DOMString ELEMNAME_FALLBACK_STRING;
- static const DOMString ELEMNAME_FOREACH_STRING;
- static const DOMString ELEMNAME_IF_STRING;
- static const DOMString ELEMNAME_IMPORT_STRING;
- static const DOMString ELEMNAME_INCLUDE_STRING;
- static const DOMString ELEMNAME_KEY_STRING;
- static const DOMString ELEMNAME_LOCALE_STRING;
- static const DOMString ELEMNAME_MESSAGE_STRING;
- static const DOMString ELEMNAME_NUMBER_STRING;
- static const DOMString ELEMNAME_OTHERWISE_STRING;
- static const DOMString ELEMNAME_PARAM_STRING;
- static const DOMString ELEMNAME_PRESERVESPACE_STRING;
- static const DOMString ELEMNAME_ROOT_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_SORT_STRING;
- static const DOMString ELEMNAME_STRIPSPACE_STRING;
- static const DOMString ELEMNAME_STYLESHEET_STRING;
- static const DOMString ELEMNAME_TARGETATTRIBUTE_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_TARGETCOMMENT_STRING;
- static const DOMString ELEMNAME_TARGETELEMENT_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_TARGETPI_STRING;
- static const DOMString ELEMNAME_TARGETTEXT_STRING;
- static const DOMString ELEMNAME_TEMPLATE_STRING;
- static const DOMString ELEMNAME_TEXT_STRING;
- static const DOMString ELEMNAME_TRANSFORM_STRING;
- static const DOMString ELEMNAME_URL_STRING; // pattern-by-example support
- static const DOMString ELEMNAME_USE_STRING;
- static const DOMString ELEMNAME_VALUEOF_STRING;
- static const DOMString ELEMNAME_VARIABLE_STRING;
- static const DOMString ELEMNAME_WHEN_STRING;
- static const DOMString ELEMNAME_COMPONENT_STRING;
- static const DOMString ELEMNAME_CSSSTYLECONVERSION_STRING;
- static const DOMString ELEMNAME_OUTPUT_STRING;
- static const DOMString ELEMNAME_PARAMVARIABLE_OLD_STRING;
- static const DOMString ELEMNAME_PARAMVARIABLE_STRING;
- static const DOMString ELEMNAME_PI_OLD_STRING;
- static const DOMString ELEMNAME_PI_STRING;
- static const DOMString ELEMNAME_SCRIPT_STRING;
- static const DOMString ELEMNAME_WITHPARAM_STRING;
+ static const XalanDOMString ELEMNAME_ANCHOR_STRING;
+ static const XalanDOMString ELEMNAME_ANY_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_APPLY_IMPORTS_STRING;
+ static const XalanDOMString ELEMNAME_APPLY_TEMPLATES_STRING;
+ static const XalanDOMString ELEMNAME_ARG_STRING;
+ static const XalanDOMString ELEMNAME_ATTRIBUTESET_STRING;
+ static const XalanDOMString ELEMNAME_ATTRIBUTE_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_CALLTEMPLATEARG_STRING;
+ static const XalanDOMString ELEMNAME_CALLTEMPLATE_STRING;
+ static const XalanDOMString ELEMNAME_CALL_STRING;
+ static const XalanDOMString ELEMNAME_CHILDREN_STRING;
+ static const XalanDOMString ELEMNAME_CHOOSE_STRING;
+ static const XalanDOMString ELEMNAME_COMMENT_STRING;
+ static const XalanDOMString ELEMNAME_CONSTRUCT_STRING; // my own
+ static const XalanDOMString ELEMNAME_CONTENTS_STRING;
+ static const XalanDOMString ELEMNAME_COPY_OF_STRING;
+ static const XalanDOMString ELEMNAME_COPY_STRING;
+ static const XalanDOMString ELEMNAME_COUNTERINCREMENT_STRING;
+ static const XalanDOMString ELEMNAME_COUNTERRESET_STRING;
+ static const XalanDOMString ELEMNAME_COUNTERSCOPE_STRING;
+ static const XalanDOMString ELEMNAME_COUNTERS_STRING;
+ static const XalanDOMString ELEMNAME_COUNTER_STRING;
+ static const XalanDOMString ELEMNAME_DECIMALFORMAT_STRING;
+ static const XalanDOMString ELEMNAME_DISPLAYIF_STRING; // my own
+ static const XalanDOMString ELEMNAME_ELEMENT_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_EMPTY_STRING;
+ static const XalanDOMString ELEMNAME_EVAL_STRING;
+ static const XalanDOMString ELEMNAME_EXPECTEDCHILDREN_STRING;
+ static const XalanDOMString ELEMNAME_EXTENSIONHANDLER_STRING;
+ static const XalanDOMString ELEMNAME_EXTENSION_STRING;
+ static const XalanDOMString ELEMNAME_FALLBACK_STRING;
+ static const XalanDOMString ELEMNAME_FOREACH_STRING;
+ static const XalanDOMString ELEMNAME_IF_STRING;
+ static const XalanDOMString ELEMNAME_IMPORT_STRING;
+ static const XalanDOMString ELEMNAME_INCLUDE_STRING;
+ static const XalanDOMString ELEMNAME_KEY_STRING;
+ static const XalanDOMString ELEMNAME_LOCALE_STRING;
+ static const XalanDOMString ELEMNAME_MESSAGE_STRING;
+ static const XalanDOMString ELEMNAME_NSALIAS_STRING;
+ static const XalanDOMString ELEMNAME_NUMBER_STRING;
+ static const XalanDOMString ELEMNAME_OTHERWISE_STRING;
+ static const XalanDOMString ELEMNAME_PARAM_STRING;
+ static const XalanDOMString ELEMNAME_PRESERVESPACE_STRING;
+ static const XalanDOMString ELEMNAME_ROOT_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_SORT_STRING;
+ static const XalanDOMString ELEMNAME_STRIPSPACE_STRING;
+ static const XalanDOMString ELEMNAME_STYLESHEET_STRING;
+ static const XalanDOMString ELEMNAME_TARGETATTRIBUTE_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_TARGETCOMMENT_STRING;
+ static const XalanDOMString ELEMNAME_TARGETELEMENT_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_TARGETPI_STRING;
+ static const XalanDOMString ELEMNAME_TARGETTEXT_STRING;
+ static const XalanDOMString ELEMNAME_TEMPLATE_STRING;
+ static const XalanDOMString ELEMNAME_TEXT_STRING;
+ static const XalanDOMString ELEMNAME_TRANSFORM_STRING;
+ static const XalanDOMString ELEMNAME_URL_STRING; // pattern-by-example support
+ static const XalanDOMString ELEMNAME_USE_STRING;
+ static const XalanDOMString ELEMNAME_VALUEOF_STRING;
+ static const XalanDOMString ELEMNAME_VARIABLE_STRING;
+ static const XalanDOMString ELEMNAME_WHEN_STRING;
+ static const XalanDOMString ELEMNAME_COMPONENT_STRING;
+ static const XalanDOMString ELEMNAME_CSSSTYLECONVERSION_STRING;
+ static const XalanDOMString ELEMNAME_OUTPUT_STRING;
+ static const XalanDOMString ELEMNAME_PARAMVARIABLE_OLD_STRING;
+ static const XalanDOMString ELEMNAME_PARAMVARIABLE_STRING;
+ static const XalanDOMString ELEMNAME_PI_OLD_STRING;
+ static const XalanDOMString ELEMNAME_PI_STRING;
+ static const XalanDOMString ELEMNAME_SCRIPT_STRING;
+ static const XalanDOMString ELEMNAME_WITHPARAM_STRING;
-
/*---------------------------------------------
* Literals for XSL attribute names.
*/
- static const DOMString ATTRNAME_CLASS;
- static const DOMString ATTRNAME_ATTRIBUTE;
- static const DOMString ATTRNAME_ATTRIBUTE_SET;
- static const DOMString ATTRNAME_AMOUNT;
- static const DOMString ATTRNAME_ANCESTOR;
- static const DOMString ATTRNAME_CASEORDER;
- static const DOMString ATTRNAME_CONDITION;
- static const DOMString ATTRNAME_COPYTYPE;
- static const DOMString ATTRNAME_COUNT;
- static const DOMString ATTRNAME_DATATYPE;
- static const DOMString ATTRNAME_DEFAULTSPACE;
- static const DOMString ATTRNAME_DEFAULT;
- static const DOMString ATTRNAME_DEPTH;
- static const DOMString ATTRNAME_DIGITGROUPSEP;
- static const DOMString ATTRNAME_ELEMENT;
- static const DOMString ATTRNAME_ELEMENTS;
- static const DOMString ATTRNAME_EXPR;
- static const DOMString ATTRNAME_EXTENSIONELEMENTPREFIXES;
- static const DOMString ATTRNAME_FORMAT;
- static const DOMString ATTRNAME_FROM;
- static const DOMString ATTRNAME_GROUPINGSEPARATOR;
- static const DOMString ATTRNAME_GROUPINGSIZE;
- static const DOMString ATTRNAME_HREF;
- static const DOMString ATTRNAME_ID;
- static const DOMString ATTRNAME_IMPORTANCE;
- static const DOMString ATTRNAME_INDENTRESULT;
- static const DOMString ATTRNAME_LETTERVALUE;
- static const DOMString ATTRNAME_LEVEL;
- static const DOMString ATTRNAME_LANG;
- // static const DOMString ATTRNAME_MACRO;
- static const DOMString ATTRNAME_MATCH;
- static const DOMString ATTRNAME_MODE;
- static const DOMString ATTRNAME_NAME;
- static const DOMString ATTRNAME_NAMESPACE;
- static const DOMString ATTRNAME_NDIGITSPERGROUP;
- static const DOMString ATTRNAME_ONLY;
- static const DOMString ATTRNAME_ORDER;
- static const DOMString ATTRNAME_PRIORITY;
- static const DOMString ATTRNAME_REFID;
- static const DOMString ATTRNAME_RESULTNS;
- static const DOMString ATTRNAME_SELECT;
- static const DOMString ATTRNAME_SEQUENCESRC;
- static const DOMString ATTRNAME_STYLE;
- static const DOMString ATTRNAME_TEST;
- static const DOMString ATTRNAME_TOSTRING;
- static const DOMString ATTRNAME_TYPE;
- static const DOMString ATTRNAME_USE;
- static const DOMString ATTRNAME_USEATTRIBUTESETS;
- static const DOMString ATTRNAME_VALUE;
- static const DOMString ATTRNAME_XMLNSDEF;
- static const DOMString ATTRNAME_XMLNS;
- static const DOMString ATTRNAME_XMLSPACE;
+ static const XalanDOMString ATTRNAME_CLASS;
+ static const XalanDOMString ATTRNAME_ATTRIBUTE;
+ static const XalanDOMString ATTRNAME_ATTRIBUTE_SET;
+ static const XalanDOMString ATTRNAME_AMOUNT;
+ static const XalanDOMString ATTRNAME_ANCESTOR;
+ static const XalanDOMString ATTRNAME_CASEORDER;
+ static const XalanDOMString ATTRNAME_CONDITION;
+ static const XalanDOMString ATTRNAME_COPYTYPE;
+ static const XalanDOMString ATTRNAME_COUNT;
+ static const XalanDOMString ATTRNAME_DATATYPE;
+ static const XalanDOMString ATTRNAME_DECIMALSEPARATOR;
+ static const XalanDOMString ATTRNAME_DEFAULTSPACE;
+ static const XalanDOMString ATTRNAME_DEFAULT;
+ static const XalanDOMString ATTRNAME_DEPTH;
+ static const XalanDOMString ATTRNAME_DIGIT;
+ static const XalanDOMString ATTRNAME_DIGITGROUPSEP;
+ static const XalanDOMString ATTRNAME_ELEMENT;
+ static const XalanDOMString ATTRNAME_ELEMENTS;
+ static const XalanDOMString ATTRNAME_EXPR;
+ static const XalanDOMString ATTRNAME_EXTENSIONELEMENTPREFIXES;
+ static const XalanDOMString ATTRNAME_FORMAT;
+ static const XalanDOMString ATTRNAME_FROM;
+ static const XalanDOMString ATTRNAME_GROUPINGSEPARATOR;
+ static const XalanDOMString ATTRNAME_GROUPINGSIZE;
+ static const XalanDOMString ATTRNAME_HREF;
+ static const XalanDOMString ATTRNAME_ID;
+ static const XalanDOMString ATTRNAME_IMPORTANCE;
+ static const XalanDOMString ATTRNAME_INDENTRESULT;
+ static const XalanDOMString ATTRNAME_INFINITY;
+ static const XalanDOMString ATTRNAME_LETTERVALUE;
+ static const XalanDOMString ATTRNAME_LEVEL;
+ static const XalanDOMString ATTRNAME_LANG;
+ // static const XalanDOMString ATTRNAME_MACRO;
+ static const XalanDOMString ATTRNAME_MATCH;
+ static const XalanDOMString ATTRNAME_MINUSSIGN;
+ static const XalanDOMString ATTRNAME_MODE;
+ static const XalanDOMString ATTRNAME_NAME;
+ static const XalanDOMString ATTRNAME_NAN;
+ static const XalanDOMString ATTRNAME_NAMESPACE;
+ static const XalanDOMString ATTRNAME_NDIGITSPERGROUP;
+ static const XalanDOMString ATTRNAME_ONLY;
+ static const XalanDOMString ATTRNAME_ORDER;
+ static const XalanDOMString ATTRNAME_PATTERNSEPARATOR;
+ static const XalanDOMString ATTRNAME_PERCENT;
+ static const XalanDOMString ATTRNAME_PERMILLE;
+ static const XalanDOMString ATTRNAME_PRIORITY;
+ static const XalanDOMString ATTRNAME_REFID;
+ static const XalanDOMString ATTRNAME_RESULTNS;
+ static const XalanDOMString ATTRNAME_RESULT_PREFIX;
+ static const XalanDOMString ATTRNAME_SELECT;
+ static const XalanDOMString ATTRNAME_SEQUENCESRC;
+ static const XalanDOMString ATTRNAME_STYLE;
+ static const XalanDOMString ATTRNAME_STYLESHEET_PREFIX;
+ static const XalanDOMString ATTRNAME_TEST;
+ static const XalanDOMString ATTRNAME_TOSTRING;
+ static const XalanDOMString ATTRNAME_TYPE;
+ static const XalanDOMString ATTRNAME_USE;
+ static const XalanDOMString ATTRNAME_USEATTRIBUTESETS;
+ static const XalanDOMString ATTRNAME_VALUE;
+ static const XalanDOMString ATTRNAME_XMLNSDEF;
+ static const XalanDOMString ATTRNAME_XMLNS;
+ static const XalanDOMString ATTRNAME_XMLSPACE;
+ static const XalanDOMString ATTRNAME_ZERODIGIT;
// Atributes on the functions element
- static const DOMString ATTRNAME_NS;
- static const DOMString ATTRNAME_CLASSID;
- static const DOMString ATTRNAME_ARCHIVE;
- static const DOMString ATTRNAME_CODETYPE;
- static const DOMString ATTRNAME_CODEBASE;
- static const DOMString ATTRNAME_METHOD;
+ static const XalanDOMString ATTRNAME_NS;
+ static const XalanDOMString ATTRNAME_CLASSID;
+ static const XalanDOMString ATTRNAME_ARCHIVE;
+ static const XalanDOMString ATTRNAME_CODETYPE;
+ static const XalanDOMString ATTRNAME_CODEBASE;
+ static const XalanDOMString ATTRNAME_METHOD;
// For space-att
- static const DOMString ATTRVAL_PRESERVE;
- static const DOMString ATTRVAL_STRIP;
+ static const XalanDOMString ATTRVAL_PRESERVE;
+ static const XalanDOMString ATTRVAL_STRIP;
// For indent-result
- static const DOMString ATTRVAL_YES;
- static const DOMString ATTRVAL_NO;
+ static const XalanDOMString ATTRVAL_YES;
+ static const XalanDOMString ATTRVAL_NO;
// For letter-value attribute (part of conversion attributes).
- static const DOMString ATTRVAL_ALPHABETIC;
- static const DOMString ATTRVAL_OTHER;
+ static const XalanDOMString ATTRVAL_ALPHABETIC;
+ static const XalanDOMString ATTRVAL_OTHER;
// For level attribute in xsl:number.
- static const DOMString ATTRVAL_SINGLE;
- static const DOMString ATTRVAL_MULTI;
- static const DOMString ATTRVAL_ANY;
+ static const XalanDOMString ATTRVAL_SINGLE;
+ static const XalanDOMString ATTRVAL_MULTI;
+ static const XalanDOMString ATTRVAL_ANY;
// Output stuff
- static const DOMString ATTRNAME_OUTPUT_METHOD;
- static const DOMString ATTRNAME_DISABLE_OUTPUT_ESCAPING;
- static const DOMString ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS;
- static const DOMString ATTRNAME_OUTPUT_DOCTYPE_PUBLIC;
- static const DOMString ATTRNAME_OUTPUT_DOCTYPE_SYSTEM;
- static const DOMString ATTRNAME_OUTPUT_ENCODING;
- static const DOMString ATTRNAME_OUTPUT_INDENT;
- static const DOMString ATTRNAME_OUTPUT_MEDIATYPE;
- static const DOMString ATTRNAME_OUTPUT_STANDALONE;
- static const DOMString ATTRNAME_OUTPUT_VERSION;
-// static const DOMString ATTRNAME_OUTPUT_XMLDECL;
- static const DOMString ATTRNAME_OUTPUT_OMITXMLDECL;
-
- static const DOMString ATTRVAL_OUTPUT_METHOD_HTML;
- static const DOMString ATTRVAL_OUTPUT_METHOD_XML;
- static const DOMString ATTRVAL_OUTPUT_METHOD_TEXT;
+ static const XalanDOMString ATTRNAME_OUTPUT_METHOD;
+ static const XalanDOMString ATTRNAME_DISABLE_OUTPUT_ESCAPING;
+ static const XalanDOMString ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS;
+ static const XalanDOMString ATTRNAME_OUTPUT_DOCTYPE_PUBLIC;
+ static const XalanDOMString ATTRNAME_OUTPUT_DOCTYPE_SYSTEM;
+ static const XalanDOMString ATTRNAME_OUTPUT_ENCODING;
+ static const XalanDOMString ATTRNAME_OUTPUT_INDENT;
+ static const XalanDOMString ATTRNAME_OUTPUT_MEDIATYPE;
+ static const XalanDOMString ATTRNAME_OUTPUT_STANDALONE;
+ static const XalanDOMString ATTRNAME_OUTPUT_VERSION;
+// static const XalanDOMString ATTRNAME_OUTPUT_XMLDECL;
+ static const XalanDOMString ATTRNAME_OUTPUT_OMITXMLDECL;
+
+ static const XalanDOMString ATTRVAL_OUTPUT_METHOD_HTML;
+ static const XalanDOMString ATTRVAL_OUTPUT_METHOD_XML;
+ static const XalanDOMString ATTRVAL_OUTPUT_METHOD_TEXT;
// some stuff for my patterns-by-example
- static const DOMString ATTRVAL_THIS;
- static const DOMString ATTRVAL_PARENT;
- static const DOMString ATTRVAL_ANCESTOR;
- static const DOMString ATTRVAL_ID;
+ static const XalanDOMString ATTRVAL_THIS;
+ static const XalanDOMString ATTRVAL_PARENT;
+ static const XalanDOMString ATTRVAL_ANCESTOR;
+ static const XalanDOMString ATTRVAL_ID;
// Stuff for sorting
- static const DOMString ATTRVAL_DATATYPE_TEXT;
- static const DOMString ATTRVAL_DATATYPE_NUMBER;
- static const DOMString ATTRVAL_ORDER_ASCENDING;
- static const DOMString ATTRVAL_ORDER_DESCENDING;
- static const DOMString ATTRVAL_CASEORDER_UPPER;
- static const DOMString ATTRVAL_CASEORDER_LOWER;
+ static const XalanDOMString ATTRVAL_DATATYPE_TEXT;
+ static const XalanDOMString ATTRVAL_DATATYPE_NUMBER;
+ static const XalanDOMString ATTRVAL_ORDER_ASCENDING;
+ static const XalanDOMString ATTRVAL_ORDER_DESCENDING;
+ static const XalanDOMString ATTRVAL_CASEORDER_UPPER;
+ static const XalanDOMString ATTRVAL_CASEORDER_LOWER;
+
+ // Stuff for xsl:decimal-format...
+ static const XalanDOMString ATTRVAL_INFINITY;
+ static const XalanDOMString ATTRVAL_NAN;
+
+ // Name of default for xsl:decimal-format element
+ static const XalanDOMString DEFAULT_DECIMAL_FORMAT;
+
enum eNumberLevel
{
/*
@@ -375,6 +390,9 @@
MAX_MULTI_COUNTING_DEPTH = 32
};
+ // For Stylesheet-prefix and result-prefix in xsl:namespace-alias
+ static const XalanDOMString ATTRVAL_DEFAULT_PREFIX;
+
enum eAttributeName
{
TATTRNAME_OUTPUT_METHOD = 1,
@@ -448,14 +466,14 @@
TATTRNAME_XMLSPACE = 68
};
- // These are used mainly for keys in the pattern lookup table,
- // for those nodes that don't have unique lookup values
- static const DOMString PSEUDONAME_ANY;
- static const DOMString PSEUDONAME_ROOT;
- static const DOMString PSEUDONAME_TEXT;
- static const DOMString PSEUDONAME_COMMENT;
- static const DOMString PSEUDONAME_PI;
- static const DOMString PSEUDONAME_OTHER;
+ // These are used mainly for keys in the pattern lookup table,
+ // for those nodes that don't have unique lookup values
+ static const XalanDOMString PSEUDONAME_ANY;
+ static const XalanDOMString PSEUDONAME_ROOT;
+ static const XalanDOMString PSEUDONAME_TEXT;
+ static const XalanDOMString PSEUDONAME_COMMENT;
+ static const XalanDOMString PSEUDONAME_PI;
+ static const XalanDOMString PSEUDONAME_OTHER;
};
1.3 +2 -2 xml-xalan/c/src/XSLT/ContextMarker.cpp
Index: ContextMarker.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ContextMarker.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContextMarker.cpp 2000/03/01 20:43:40 1.2
+++ ContextMarker.cpp 2000/04/11 15:09:21 1.3
@@ -63,8 +63,8 @@
ContextMarker::ContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode) :
+ const XalanNode* caller,
+ const XalanNode* sourceNode) :
ContextState(caller,
sourceNode,
eContextMarker)
1.4 +2 -6 xml-xalan/c/src/XSLT/ContextMarker.hpp
Index: ContextMarker.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ContextMarker.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContextMarker.hpp 2000/03/01 20:43:41 1.3
+++ ContextMarker.hpp 2000/04/11 15:09:22 1.4
@@ -68,10 +68,6 @@
-#include <dom/DOM_Node.hpp>
-
-
-
// Base class header file.
#include "ContextState.hpp"
@@ -93,8 +89,8 @@
* @param sourceNode source node
*/
ContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode);
+ const XalanNode* caller,
+ const XalanNode* sourceNode);
ContextMarker(const ContextMarker& theSource);
1.3 +9 -5 xml-xalan/c/src/XSLT/ContextState.cpp
Index: ContextState.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ContextState.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContextState.cpp 2000/03/01 20:43:41 1.2
+++ ContextState.cpp 2000/04/11 15:09:22 1.3
@@ -62,8 +62,8 @@
ContextState::ContextState(
- const DOM_Node& caller,
- const DOM_Node& sourceNode) :
+ const XalanNode* caller,
+ const XalanNode* sourceNode) :
StackEntry(eContextState),
m_caller(caller),
m_source(sourceNode)
@@ -73,8 +73,8 @@
ContextState::ContextState(
- const DOM_Node& caller,
- const DOM_Node& sourceNode,
+ const XalanNode* caller,
+ const XalanNode* sourceNode,
eStackEntryType theType) :
StackEntry(theType),
m_caller(caller),
@@ -115,8 +115,13 @@
ContextState::equals(const StackEntry& rhs) const
{
if (getType() == rhs.getType() &&
+#if defined(XALAN_OLD_STYLE_CASTS)
+ m_caller == ((const ContextState&)rhs).m_caller &&
+ m_source == ((const ContextState&)rhs).m_source)
+#else
m_caller == static_cast<const ContextState&>(rhs).m_caller &&
m_source == static_cast<const ContextState&>(rhs).m_source)
+#endif
{
return true;
}
@@ -124,7 +129,6 @@
{
return false;
}
-
}
1.4 +11 -11 xml-xalan/c/src/XSLT/ContextState.hpp
Index: ContextState.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ContextState.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContextState.hpp 2000/03/01 20:43:41 1.3
+++ ContextState.hpp 2000/04/11 15:09:22 1.4
@@ -68,12 +68,12 @@
-#include <dom/DOM_Node.hpp>
+// Base class header file.
+#include "StackEntry.hpp"
-// Base class header file.
-#include "StackEntry.hpp"
+class XalanNode;
@@ -93,8 +93,8 @@
* @param sourceNode source node
*/
ContextState(
- const DOM_Node& caller,
- const DOM_Node& sourceNode);
+ const XalanNode* caller,
+ const XalanNode* sourceNode);
ContextState(const ContextState& theSource);
@@ -106,7 +106,7 @@
*
* @return caller node
*/
- const DOM_Node&
+ const XalanNode*
getCaller() const
{
return m_caller;
@@ -117,7 +117,7 @@
*
* @return source node
*/
- const DOM_Node&
+ const XalanNode*
getSource() const
{
return m_source;
@@ -136,8 +136,8 @@
protected:
ContextState(
- const DOM_Node& caller,
- const DOM_Node& sourceNode,
+ const XalanNode* caller,
+ const XalanNode* sourceNode,
eStackEntryType theType);
bool
@@ -149,8 +149,8 @@
private:
// Data members...
- DOM_Node m_caller;
- DOM_Node m_source;
+ const XalanNode* m_caller;
+ const XalanNode* m_source;
};
1.2 +4 -4 xml-xalan/c/src/XSLT/DecimalToRoman.cpp
Index: DecimalToRoman.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/DecimalToRoman.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DecimalToRoman.cpp 1999/12/18 19:48:03 1.1
+++ DecimalToRoman.cpp 2000/04/11 15:09:22 1.2
@@ -60,10 +60,10 @@
DecimalToRoman::DecimalToRoman(
- long postValue,
- const DOMString& postLetter,
- long preValue,
- const DOMString& preLetter) :
+ long postValue,
+ const XalanDOMString& postLetter,
+ long preValue,
+ const XalanDOMString& preLetter) :
m_postValue(postValue),
m_postLetter(postLetter),
m_preValue(preValue),
1.3 +9 -9 xml-xalan/c/src/XSLT/DecimalToRoman.hpp
Index: DecimalToRoman.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/DecimalToRoman.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DecimalToRoman.hpp 2000/02/29 20:54:20 1.2
+++ DecimalToRoman.hpp 2000/04/11 15:09:22 1.3
@@ -64,7 +64,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -84,20 +84,20 @@
* @param preLetter prefix for quantity, for example, "XC" represents 90
*/
DecimalToRoman(
- long postValue = 0L,
- const DOMString& postLetter = DOMString(),
- long preValue = 0L,
- const DOMString& preLetter = DOMString());
+ long postValue = 0L,
+ const XalanDOMString& postLetter = XalanDOMString(),
+ long preValue = 0L,
+ const XalanDOMString& preLetter = XalanDOMString());
~DecimalToRoman();
- long m_postValue;
+ long m_postValue;
- DOMString m_postLetter;
+ XalanDOMString m_postLetter;
- long m_preValue;
+ long m_preValue;
- DOMString m_preLetter;
+ XalanDOMString m_preLetter;
};
1.3 +20 -24 xml-xalan/c/src/XSLT/ElemApplyImport.cpp
Index: ElemApplyImport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyImport.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemApplyImport.cpp 2000/01/26 14:26:56 1.2
+++ ElemApplyImport.cpp 2000/04/11 15:09:22 1.3
@@ -62,6 +62,10 @@
+#include <XalanDOM/XalanDOMException.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -75,7 +79,7 @@
ElemApplyImport::ElemApplyImport(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -83,61 +87,53 @@
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_APPLY_IMPORTS)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(isAttrOK(aname, atts, i, constructionContext) == false)
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
-int
-ElemApplyImport::getXSLToken() const
-{
- return Constants::ELEMNAME_APPLY_IMPORTS;
-}
-
-
void
ElemApplyImport::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
// This will have to change to current template, (which will have
// to be the top of a current template stack).
+ assert(sourceNode != 0);
transformChild(executionContext,
getStylesheet(),
0,
0,
sourceTree,
- executionContext.getParentOfNode(sourceNode),
+ executionContext.getParentOfNode(*sourceNode),
sourceNode,
- mode,
+ mode,
getXSLToken());
}
-NodeImpl*
-ElemApplyImport::appendChild(NodeImpl* newChild)
-{
- assert(newChild != 0);
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + getTagName());
-
- return 0;
+ElemTemplateElement*
+ElemApplyImport::appendChildElem(ElemTemplateElement* /* newChild */)
+{
+ throw XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
}
1.4 +7 -13 xml-xalan/c/src/XSLT/ElemApplyImport.hpp
Index: ElemApplyImport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyImport.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemApplyImport.hpp 2000/02/29 20:54:20 1.3
+++ ElemApplyImport.hpp 2000/04/11 15:09:22 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMAPPLYIMPORT_HEADER_GUARD
/**
- * $Id: ElemApplyImport.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemApplyImport.hpp,v 1.4 2000/04/11 15:09:22 dbertoni Exp $
*
* $State: Exp $
*
@@ -94,30 +94,24 @@
ElemApplyImport(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
- /**
- * Add a child to the child list.
- * <!ELEMENT xsl:apply-imports EMPTY>
- */
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+ virtual ElemTemplateElement*
+ appendChildElem(ElemTemplateElement* newChild);
+
private:
};
1.4 +21 -27 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemApplyTemplates.cpp 2000/02/03 20:13:20 1.3
+++ ElemApplyTemplates.cpp 2000/04/11 15:09:22 1.4
@@ -62,10 +62,6 @@
-#include <Include/DOMHelper.hpp>
-
-
-
#include "Constants.hpp"
#include "Stylesheet.hpp"
#include "StylesheetRoot.hpp"
@@ -78,7 +74,7 @@
ElemApplyTemplates::ElemApplyTemplates(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -88,17 +84,18 @@
atts,
lineNumber,
columnNumber,
- false),
+ Constants::ELEMNAME_APPLY_TEMPLATES),
m_isDefaultTemplate(false),
m_mode()
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -113,7 +110,7 @@
default:
if(!isAttrOK(tok, aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
break;
}
@@ -124,23 +121,20 @@
if(0 == stylesheetTree.getDefaultATXpath())
{
stylesheetTree.setDefaultATXpath(
- constructionContext.createXPath(DOMString("node()"), *this));
+ constructionContext.createXPath(XALAN_STATIC_UCODE_STRING("node()"), *this));
}
m_pSelectPattern = stylesheetTree.getDefaultATXpath();
}
}
-int ElemApplyTemplates::getXSLToken() const
-{
- return Constants::ELEMNAME_APPLY_TEMPLATES;
-}
-void ElemApplyTemplates::execute(
+void
+ElemApplyTemplates::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
@@ -162,30 +156,30 @@
m_pSelectPattern,
Constants::ELEMNAME_APPLY_TEMPLATES);
}
- else // if(null == sourceNode)
+ else
{
executionContext.error("sourceNode is null in handleApplyTemplatesInstruction!");
}
}
+
-NodeImpl* ElemApplyTemplates::appendChild(NodeImpl* newChild)
+bool
+ElemApplyTemplates::childTypeAllowed(int xslToken) const
{
- assert(newChild != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
+ bool fResult = false;
- switch(type)
+ switch(xslToken)
{
// char-instructions
case Constants::ELEMNAME_SORT:
case Constants::ELEMNAME_PARAM:
+ fResult = true;
break;
default:
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + this->getTagName());
break;
}
- return ElemTemplateElement::appendChild(newChild);
+ return fResult;
}
1.4 +18 -15 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemApplyTemplates.hpp 2000/02/29 20:54:20 1.3
+++ ElemApplyTemplates.hpp 2000/04/11 15:09:22 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMAPPLYTEMPLATES_HEADER_GUARD
/**
- * $Id: ElemApplyTemplates.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemApplyTemplates.hpp,v 1.4 2000/04/11 15:09:22 dbertoni Exp $
*
* $State: Exp $
*
@@ -94,19 +94,20 @@
* @param columnNumber column number in document
*/
ElemApplyTemplates(
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber);
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber);
/**
* Determines whether this is the default template
*
* @return true if the template is the default
*/
- bool isDefaultTemplate() const
+ bool
+ isDefaultTemplate() const
{
return m_isDefaultTemplate;
}
@@ -116,23 +117,25 @@
*
* @param def value of flag to set
*/
- void setDefaultTemplate(bool def)
+ void
+ setDefaultTemplate(bool def)
{
m_isDefaultTemplate = def;
}
// These methods are inherited from ElemTemplateElement ...
- virtual int getXSLToken() const;
-
- virtual void
+ virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
- virtual NodeImpl* appendChild(NodeImpl* newChild);
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
1.4 +62 -51 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemAttribute.cpp 2000/03/16 20:54:12 1.3
+++ ElemAttribute.cpp 2000/04/11 15:09:23 1.4
@@ -59,7 +59,6 @@
#include <sax/AttributeList.hpp>
-//#include <sax/SAXException.hpp>
@@ -77,7 +76,7 @@
ElemAttribute::ElemAttribute(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -85,15 +84,16 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_ATTRIBUTE),
m_pNameAVT(0),
m_pNamespaceAVT(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_NAME))
{
@@ -130,35 +130,32 @@
-int
-ElemAttribute::getXSLToken() const
-{
- return Constants::ELEMNAME_ATTRIBUTE;
-}
-
-
-
void
ElemAttribute::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
- ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
-
assert(m_pNameAVT != 0);
+
+ ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- DOMString attrName;
- DOMString origAttrName = attrName; // save original attribute name
- int indexOfNSSep = 0;
+ XalanDOMString attrName;
m_pNameAVT->evaluate(attrName, sourceNode, *this,
executionContext.getXPathExecutionContext());
if(!isEmpty(attrName))
{
- DOMString attrNameSpace;
+ const XalanDOMString origAttrName = attrName; // save original attribute name
+
+ const unsigned int origAttrNameLength = length(origAttrName);
+
+ unsigned int indexOfNSSep = 0;
+
+ XalanDOMString attrNameSpace;
+
if(0 != m_pNamespaceAVT)
{
m_pNamespaceAVT->evaluate(attrNameSpace, sourceNode,
@@ -166,61 +163,76 @@
if(!isEmpty(attrNameSpace))
{
- DOMString prefix = executionContext.getResultPrefixForNamespace(attrNameSpace);
+ XalanDOMString prefix = executionContext.getResultPrefixForNamespace(attrNameSpace);
if(isEmpty(prefix))
{
prefix = executionContext.getUniqueNameSpaceValue();
- DOMString nsDecl = DOMString("xmlns:") + prefix;
+ XalanDOMString nsDecl = XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix;
executionContext.addResultAttribute(nsDecl, attrNameSpace);
}
+
indexOfNSSep = indexOf(origAttrName, ':');
- if(indexOfNSSep >= 0)
- attrName = substring(attrName, indexOfNSSep+1);
- attrName = prefix + DOMString(":") + attrName;
+
+ if(indexOfNSSep < origAttrNameLength)
+ {
+ attrName = substring(attrName, indexOfNSSep + 1);
+ }
+
+ attrName = prefix + XalanDOMString(XALAN_STATIC_UCODE_STRING(":")) + attrName;
}
}
// Note we are using original attribute name for these tests.
else if(!isEmpty(executionContext.getPendingElementName())
- && !equals(origAttrName, "xmlns"))
+ && !equals(origAttrName, XALAN_STATIC_UCODE_STRING("xmlns")))
{
// make sure that if a prefix is specified on the attribute name, it is valid
indexOfNSSep = indexOf(origAttrName, ':');
- if(indexOfNSSep >= 0)
+
+ if(indexOfNSSep < origAttrNameLength)
{
- DOMString nsprefix = substring(origAttrName, 0, indexOfNSSep);
+ const XalanDOMString nsprefix = substring(origAttrName, 0, indexOfNSSep);
+
attrNameSpace = getNamespaceForPrefix(nsprefix);
+
if (isEmpty(attrNameSpace))
{
// Could not resolve prefix
- // @@ TODO: processor.warn(XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX, new Object[]{nsprefix});
+ executionContext.warn(XalanDOMString("Warning: Could not resolve prefix ") + nsprefix, sourceNode, this);
}
}
- if (indexOfNSSep<0 || ! isEmpty(attrNameSpace))
- {
- const DOMString val = childrenToString(executionContext,
- sourceTree, sourceNode, mode);
- executionContext.addResultAttribute(attrName, val);
- }
- else
- {
- //warn(templateChild, sourceNode, "Trying to add attribute after element child has been added, ignoring...");
- }
}
+ else
+ {
+ //warn(templateChild, sourceNode, "Trying to add attribute after element child has been added, ignoring...");
+ executionContext.warn("Warning: Trying to add attribute after element child has been added, ignoring...", sourceNode, this);
+ }
+
+ // If there was no namespace, or the namespace was resolved, process
+ // the result attribute.
+ if (indexOfNSSep == origAttrNameLength || !isEmpty(attrNameSpace))
+ {
+ const XalanDOMString val =
+ childrenToString(executionContext,
+ sourceTree,
+ sourceNode,
+ mode);
+
+ executionContext.addResultAttribute(attrName, val);
+ }
}
}
-NodeImpl* ElemAttribute::appendChild(NodeImpl* newChild)
+bool
+ElemAttribute::childTypeAllowed(int xslToken) const
{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
+ bool fResult = false;
- switch(type)
+ switch(xslToken)
{
// char-instructions
case Constants::ELEMNAME_TEXTLITERALRESULT:
@@ -236,19 +248,18 @@
case Constants::ELEMNAME_TEXT:
case Constants::ELEMNAME_COPY:
case Constants::ELEMNAME_VARIABLE:
- case Constants::ELEMNAME_MESSAGE:
-
+ case Constants::ELEMNAME_MESSAGE:
// instructions
// case Constants.ELEMNAME_PI:
// case Constants.ELEMNAME_COMMENT:
// case Constants.ELEMNAME_ELEMENT:
// case Constants.ELEMNAME_ATTRIBUTE:
+ fResult = true;
break;
-
+
default:
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + getTagName());
break;
}
- return ElemTemplateElement::appendChild(newChild);
+ return fResult;
}
1.4 +10 -12 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemAttribute.hpp 2000/02/29 20:54:20 1.3
+++ ElemAttribute.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMATTRIBUTE_HEADER_GUARD
/**
- * $Id: ElemAttribute.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemAttribute.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -69,12 +69,11 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
-//#include <dom/DOMString.hpp>
-
-//#include "AVT.hpp"
class AVT;
@@ -98,7 +97,7 @@
ElemAttribute (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -108,18 +107,17 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
1.3 +29 -42 xml-xalan/c/src/XSLT/ElemAttributeSet.cpp
Index: ElemAttributeSet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemAttributeSet.cpp 2000/01/26 14:26:56 1.2
+++ ElemAttributeSet.cpp 2000/04/11 15:09:23 1.3
@@ -71,20 +71,25 @@
ElemAttributeSet::ElemAttributeSet(
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber) :
- ElemUse(constructionContext, stylesheetTree, name, lineNumber, columnNumber),
- m_QName()
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber) :
+ ElemUse(constructionContext,
+ stylesheetTree,
+ name,
+ lineNumber,
+ columnNumber,
+ Constants::ELEMNAME_DEFINEATTRIBUTESET),
+ m_QName()
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname,Constants::ATTRNAME_NAME))
{
@@ -112,24 +117,16 @@
-int
-ElemAttributeSet::getXSLToken() const
-{
- return Constants::ELEMNAME_DEFINEATTRIBUTESET;
-}
-
-
-
void
ElemAttributeSet::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
if(executionContext.findOnElementRecursionStack(this) != false)
{
- DOMString msg("xsl:attribute-set '"
+ XalanDOMString msg("xsl:attribute-set '"
+ m_QName.getLocalPart() +
"' used itself, which will cause an infinite loop.");
@@ -139,44 +136,34 @@
// This will push and pop the stack automatically...
StylesheetExecutionContext::ElementRecursionStackPusher thePusher(executionContext, this);
- const ElemTemplateElement* attr = getFirstChild();
+ const ElemTemplateElement* attr = getFirstChildElem();
while(0 != attr)
{
attr->execute(executionContext, sourceTree, sourceNode, mode);
- attr = attr->getNextSibling();
+ attr = attr->getNextSiblingElem();
}
ElemUse::execute(executionContext, sourceTree, sourceNode, mode);
}
+
-/**
- * Add a child to the child list.
- * <!ELEMENT xsl:attribute-set (xsl:attribute)*>
- * <!ATTLIST xsl:attribute-set
- * name %qname; #REQUIRED
- * use-attribute-sets %qnames; #IMPLIED
- * >
- */
-NodeImpl*
-ElemAttributeSet::appendChild(NodeImpl* newChild)
+bool
+ElemAttributeSet::childTypeAllowed(int xslToken) const
{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
+ bool fResult = false;
- int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
-
- switch(type)
+ switch(xslToken)
{
case Constants::ELEMNAME_ATTRIBUTE:
+ fResult = true;
break;
default:
- error("Can not add " +
- dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " +
- getTagName());
+ break;
}
- return ElemTemplateElement::appendChild(newChild);
+ return fResult;
}
1.4 +24 -18 xml-xalan/c/src/XSLT/ElemAttributeSet.hpp
Index: ElemAttributeSet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemAttributeSet.hpp 2000/02/29 20:54:20 1.3
+++ ElemAttributeSet.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMATTRIBUTESET_HEADER_GUARD
/**
- * $Id: ElemAttributeSet.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemAttributeSet.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -74,7 +74,7 @@
-//#include <dom/DOMString.hpp>
+//#include <dom/XalanDOMString.hpp>
//#include <sax/AttributeList.hpp>
@@ -99,38 +99,44 @@
* @param columnNumber column number in document
*/
ElemAttributeSet (
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber);
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber);
- virtual ~ElemAttributeSet();
-
+ virtual
+ ~ElemAttributeSet();
+
/**
* Retrieves qualified name of object
*
* @return qualified name
*/
- const QName& getQName() const { return m_QName; }
-
+ const QName&
+ getQName() const
+ {
+ return m_QName;
+ }
+
// These methods are inherited from ElemUse ...
- virtual int getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
- virtual NodeImpl* appendChild(NodeImpl* newChild);
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
- QName m_QName;
+ QName m_QName;
};
1.3 +22 -30 xml-xalan/c/src/XSLT/ElemCallTemplate.cpp
Index: ElemCallTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemCallTemplate.cpp 2000/01/26 14:26:56 1.2
+++ ElemCallTemplate.cpp 2000/04/11 15:09:23 1.3
@@ -78,7 +78,7 @@
ElemCallTemplate::ElemCallTemplate(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -86,14 +86,15 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_CALLTEMPLATE),
m_pNameAVT(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_NAME))
{
@@ -116,26 +117,18 @@
-int
-ElemCallTemplate::getXSLToken() const
-{
- return Constants::ELEMNAME_CALLTEMPLATE;
-}
-
-
-
void
ElemCallTemplate::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
assert(m_pNameAVT != 0);
- DOMString templateName;
+ XalanDOMString templateName;
m_pNameAVT->evaluate(templateName, sourceNode, *this, executionContext.getXPathExecutionContext());
@@ -146,10 +139,10 @@
if(0 != theTemplate)
{
- executionContext.pushContextMarker(DOM_UnimplementedElement(theTemplate), sourceNode);
+ executionContext.pushContextMarker(theTemplate, sourceNode);
executionContext.pushParams(*this,
- sourceTree, sourceNode, mode, DOM_UnimplementedElement(theTemplate));
+ sourceTree, sourceNode, mode, theTemplate);
theTemplate->execute(executionContext, sourceTree, sourceNode, mode);
@@ -167,23 +160,22 @@
}
-/**
- * Add a child to the child list.
- */
-NodeImpl* ElemCallTemplate::appendChild(NodeImpl* newChild)
-{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
- switch(type)
+bool
+ElemCallTemplate::childTypeAllowed(int xslToken) const
+{
+ bool fResult = false;
+
+ switch(xslToken)
{
+ // char-instructions
case Constants::ELEMNAME_PARAM:
+ fResult = true;
break;
default:
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + getTagName());
+ break;
}
-
- return ElemTemplateElement::appendChild(newChild);
+
+ return fResult;
}
1.4 +8 -9 xml-xalan/c/src/XSLT/ElemCallTemplate.hpp
Index: ElemCallTemplate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCallTemplate.hpp 2000/02/29 20:54:20 1.3
+++ ElemCallTemplate.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMCALLTEMPLATE_HEADER_GUARD
/**
- * $Id: ElemCallTemplate.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemCallTemplate.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -97,7 +97,7 @@
ElemCallTemplate (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -107,18 +107,17 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
1.3 +27 -37 xml-xalan/c/src/XSLT/ElemChoose.cpp
Index: ElemChoose.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemChoose.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemChoose.cpp 2000/01/26 14:26:56 1.2
+++ ElemChoose.cpp 2000/04/11 15:09:23 1.3
@@ -80,7 +80,7 @@
ElemChoose::ElemChoose(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -88,13 +88,14 @@
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_CHOOSE)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
@@ -105,26 +106,18 @@
-int
-ElemChoose::getXSLToken() const
-{
- return Constants::ELEMNAME_CHOOSE;
-}
-
-
-
void
ElemChoose::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- for (const ElemTemplateElement* node = getFirstChild();
+ for (const ElemTemplateElement* node = getFirstChildElem();
node != 0;
- node = node->getNextSibling())
+ node = node->getNextSiblingElem())
{
const int type = node->getXSLToken();
@@ -137,18 +130,18 @@
const XObject* const test =
theXPath ->execute(sourceNode,
- *this,
+ *this,
executionContext.getXPathExecutionContext());
assert(test != 0);
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
getStylesheet().getStylesheetRoot().fireSelectedEvent(
- SelectionEvent(executionContext,
+ SelectionEvent(executionContext,
sourceNode,
*when,
- DOMString("test"),
- *theXPath,
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("test")),
+ *theXPath,
test));
}
@@ -169,25 +162,22 @@
-/**
- * Add a child to the child list.
- */
-NodeImpl* ElemChoose::appendChild(NodeImpl* newChild)
+bool
+ElemChoose::childTypeAllowed(int xslToken) const
{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
-
- switch(type)
- {
+ bool fResult = false;
+
+ switch(xslToken)
+ {
+ // char-instructions
case Constants::ELEMNAME_WHEN:
case Constants::ELEMNAME_OTHERWISE:
- // TODO: Positional checking
+ fResult = true;
break;
- default:
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + getTagName());
- }
-
- return ElemTemplateElement::appendChild(newChild);
+ default:
+ break;
+ }
+
+ return fResult;
}
1.4 +12 -10 xml-xalan/c/src/XSLT/ElemChoose.hpp
Index: ElemChoose.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemChoose.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemChoose.hpp 2000/02/29 20:54:20 1.3
+++ ElemChoose.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMCHOOSE_HEADER_GUARD
/**
- * $Id: ElemChoose.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemChoose.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -70,14 +70,17 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
+
-#include <dom/DOMString.hpp>
#include <sax/AttributeList.hpp>
+
class ElemChoose: public ElemTemplateElement
{
public:
@@ -95,25 +98,24 @@
ElemChoose(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+ virtual bool
+ childTypeAllowed(int xslToken) const;
};
1.3 +20 -34 xml-xalan/c/src/XSLT/ElemComment.cpp
Index: ElemComment.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemComment.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemComment.cpp 2000/01/26 14:26:56 1.2
+++ ElemComment.cpp 2000/04/11 15:09:23 1.3
@@ -59,7 +59,6 @@
#include <sax/AttributeList.hpp>
-//#include <sax/SAXException.hpp>
@@ -76,7 +75,7 @@
ElemComment::ElemComment(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -84,13 +83,14 @@
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_COMMENT)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
@@ -107,19 +107,11 @@
-int
-ElemComment::getXSLToken() const
-{
- return Constants::ELEMNAME_COMMENT;
-}
-
-
-
void
ElemComment::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
@@ -132,24 +124,20 @@
// | xsl:element
// | xsl:attribute
// ">
- const DOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
executionContext.comment(toCharArray(data));
}
-/**
- * Add a child to the child list.
- */
-NodeImpl*
-ElemComment::appendChild(NodeImpl* newChild)
-{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
- switch(type)
+bool
+ElemComment::childTypeAllowed(int xslToken) const
+{
+ bool fResult = false;
+
+ switch(xslToken)
{
// char-instructions
case Constants::ELEMNAME_TEXTLITERALRESULT:
@@ -173,14 +161,12 @@
// case Constants.ELEMNAME_ELEMENT:
// case Constants.ELEMNAME_ATTRIBUTE:
- break;
+ fResult = true;
+ break;
default:
- error("Can not add " +
- dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() +
- " to " +
- getTagName());
+ break;
}
-
- return ElemTemplateElement::appendChild(newChild);
+
+ return fResult;
}
1.4 +8 -16 xml-xalan/c/src/XSLT/ElemComment.hpp
Index: ElemComment.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemComment.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemComment.hpp 2000/02/29 20:54:20 1.3
+++ ElemComment.hpp 2000/04/11 15:09:23 1.4
@@ -57,14 +57,6 @@
#if !defined(XALAN_ELEMCOMMENT_HEADER_GUARD)
#define XALAN_ELEMCOMMENT_HEADER_GUARD
-/**
- * $Id: ElemComment.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
// Base include file. Must be first.
@@ -94,7 +86,7 @@
ElemComment(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -104,18 +96,18 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
+
+protected:
+
+ virtual bool
+ childTypeAllowed(int xslToken) const;
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
};
1.3 +18 -22 xml-xalan/c/src/XSLT/ElemCopy.cpp
Index: ElemCopy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemCopy.cpp 2000/01/26 14:26:56 1.2
+++ ElemCopy.cpp 2000/04/11 15:09:23 1.3
@@ -74,22 +74,22 @@
ElemCopy::ElemCopy(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
ElemUse(constructionContext,
stylesheetTree,
name,
- //atts,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_COPY)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(!(processUseAttributeSets(constructionContext, aname, atts, i) ||
processSpaceAttr(aname, atts, i) ||
@@ -102,40 +102,36 @@
-int
-ElemCopy::getXSLToken() const
-{
- return Constants::ELEMNAME_COPY;
-}
-
-
-
void
ElemCopy::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
- const int nodeType = sourceNode.getNodeType();
+ assert(sourceNode != 0);
+
+ const int nodeType = sourceNode->getNodeType();
- if(DOM_Node::DOCUMENT_NODE != nodeType)
+ if(XalanNode::DOCUMENT_NODE != nodeType)
{
executionContext.cloneToResultTree(
- sourceNode,
+ *sourceNode,
false,
false,
false);
- if(DOM_Node::ELEMENT_NODE == nodeType)
+ if(XalanNode::ELEMENT_NODE == nodeType)
{
+ assert(sourceNode != 0);
+
ElemUse::execute(
executionContext,
sourceTree,
sourceNode,
mode);
- executionContext.copyNamespaceAttributes(sourceNode,
+ executionContext.copyNamespaceAttributes(*sourceNode,
false);
executeChildren(executionContext,
@@ -143,7 +139,7 @@
sourceNode,
mode);
- const DOMString s = sourceNode.getNodeName();
+ const XalanDOMString s = sourceNode->getNodeName();
executionContext.endElement(toCharArray(s));
}
1.4 +3 -14 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCopy.hpp 2000/02/29 20:54:20 1.3
+++ ElemCopy.hpp 2000/04/11 15:09:23 1.4
@@ -57,14 +57,6 @@
#if !defined(XALAN_ELEMCOPY_HEADER_GUARD)
#define XALAN_ELEMCOPY_HEADER_GUARD
-/**
- * $Id: ElemCopy.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
// Base include file. Must be first.
@@ -94,21 +86,18 @@
ElemCopy(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
};
1.3 +32 -51 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemCopyOf.cpp 2000/01/26 14:26:57 1.2
+++ ElemCopyOf.cpp 2000/04/11 15:09:23 1.3
@@ -80,7 +80,7 @@
ElemCopyOf::ElemCopyOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -88,14 +88,15 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_COPY_OF),
m_pSelectPattern(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_SELECT))
{
@@ -110,19 +111,11 @@
-int
-ElemCopyOf::getXSLToken() const
-{
- return Constants::ELEMNAME_COPY_OF;
-}
-
-
-
void
ElemCopyOf::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
@@ -137,12 +130,12 @@
{
getStylesheet().getStylesheetRoot().fireSelectedEvent(
SelectionEvent(executionContext, sourceNode,
- *this, DOMString("select"), *m_pSelectPattern, pValue));
+ *this, XalanDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_pSelectPattern, pValue));
}
- const int type = pValue->getType();
+ const int type = pValue->getType();
- DOMString s;
+ XalanDOMString s;
switch(type)
{
@@ -155,31 +148,32 @@
case XObject::eTypeNodeSet:
{
- NodeRefList nl(pValue->nodeset());
- int nChildren = nl.getLength();
+ const NodeRefListBase& nl = pValue->nodeset();
+
+ unsigned int nChildren = nl.getLength();
- for(int i = 0; i < nChildren; i++)
+ for(unsigned int i = 0; i < nChildren; i++)
{
- DOM_Node pos(nl.item(i));
- DOM_Node top(pos);
+ XalanNode* pos = nl.item(i);
+ XalanNode* const top = pos;
while(pos != 0)
{
executionContext.flushPending();
- executionContext.cloneToResultTree(
- pos,
- false,
- false,
- true);
+ executionContext.cloneToResultTree(
+ *pos,
+ false,
+ false,
+ true);
- DOM_Node nextNode(pos.getFirstChild());
+ XalanNode* nextNode = pos->getFirstChild();
while(nextNode == 0)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
{
- s = pos.getNodeName();
+ s = pos->getNodeName();
executionContext.endElement(toCharArray(s));
}
@@ -187,18 +181,18 @@
if(top == pos)
break;
- nextNode = pos.getNextSibling();
+ nextNode = pos->getNextSibling();
if(nextNode == 0)
{
- pos = pos.getParentNode();
+ pos = pos->getParentNode();
if(top == pos)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
{
- s = pos.getNodeName();
-
+ s = pos->getNodeName();
+
executionContext.endElement(toCharArray(s));
}
@@ -220,25 +214,12 @@
default:
s = pValue->str();
+
if (!isEmpty(s))
{
executionContext.characters(toCharArray(s), 0, s.length());
}
+
break;
}
-}
-
-
-
-/**
- * Add a child to the child list.
- */
-NodeImpl* ElemCopyOf::appendChild(NodeImpl* newChild)
-{
- error("Can not add " +
- dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() +
- " to " +
- getTagName());
-
- return 0;
}
1.4 +6 -11 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCopyOf.hpp 2000/02/29 20:54:20 1.3
+++ ElemCopyOf.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMCOPYOF_HEADER_GUARD
/**
- * $Id: ElemCopyOf.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemCopyOf.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -94,7 +94,7 @@
* @param lineNumber line number in document
* @param columnNumber column number in document
*/
- ElemCopyOf (
+ ElemCopyOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
const DOMString& name,
@@ -104,17 +104,12 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
- virtual void execute(
+ virtual void
+ execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
-
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
private:
1.3 +14 -19 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemElement.cpp 2000/01/26 14:26:57 1.2
+++ ElemElement.cpp 2000/04/11 15:09:23 1.3
@@ -72,7 +72,7 @@
ElemElement::ElemElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -80,15 +80,16 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_ELEMENT),
m_nameAVT(0),
m_namespaceAVT(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_NAME))
{
@@ -125,21 +126,14 @@
-int
-ElemElement::getXSLToken() const
-{
- return Constants::ELEMNAME_ELEMENT;
-}
-
-
void
ElemElement::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
- DOMString elemName;
+ XalanDOMString elemName;
assert(m_nameAVT != 0);
@@ -149,25 +143,26 @@
{
if(0 != m_namespaceAVT)
{
- DOMString elemNameSpace;
+ XalanDOMString elemNameSpace;
m_namespaceAVT->evaluate(elemNameSpace, sourceNode,
*this, executionContext.getXPathExecutionContext());
if(!isEmpty(elemNameSpace))
{
- DOMString prefix = executionContext.getResultPrefixForNamespace(elemNameSpace);
+ XalanDOMString prefix = executionContext.getResultPrefixForNamespace(elemNameSpace);
if(isEmpty(prefix))
{
prefix = executionContext.getUniqueNameSpaceValue();
- const DOMString nsDecl = DOMString("xmlns:") + prefix;
+ const XalanDOMString nsDecl =
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix;
executionContext.addResultAttribute(nsDecl, elemNameSpace);
}
- elemName = (prefix + ":" + elemName);
+ elemName = prefix + XALAN_STATIC_UCODE_STRING(":") + elemName;
}
}
1.4 +4 -7 xml-xalan/c/src/XSLT/ElemElement.hpp
Index: ElemElement.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemElement.hpp 2000/02/29 20:54:20 1.3
+++ ElemElement.hpp 2000/04/11 15:09:23 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMELEMENT_HEADER_GUARD
/**
- * $Id: ElemElement.hpp,v 1.3 2000/02/29 20:54:20 jdonohue Exp $
+ * $Id: ElemElement.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -97,7 +97,7 @@
ElemElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -106,15 +106,12 @@
~ElemElement();
// These methods are inherited from ElemUse ...
-
- virtual int
- getXSLToken() const;
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
1.3 +6 -7 xml-xalan/c/src/XSLT/ElemEmpty.cpp
Index: ElemEmpty.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemEmpty.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemEmpty.cpp 2000/01/26 14:26:57 1.2
+++ ElemEmpty.cpp 2000/04/11 15:09:24 1.3
@@ -68,23 +68,22 @@
ElemEmpty::ElemEmpty(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
int lineNumber,
int columnNumber) :
ElemTemplateElement(constructionContext,
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_UNDEFINED)
{
}
-int
-ElemEmpty::getXSLToken() const
+ElemEmpty::~ElemEmpty()
{
- return Constants::ELEMNAME_UNDEFINED;
}
@@ -92,8 +91,8 @@
void
ElemEmpty::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
assert(false); // really shouldn't be executing empty nodes
1.4 +5 -5 xml-xalan/c/src/XSLT/ElemEmpty.hpp
Index: ElemEmpty.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemEmpty.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemEmpty.hpp 2000/02/29 20:54:21 1.3
+++ ElemEmpty.hpp 2000/04/11 15:09:24 1.4
@@ -93,16 +93,16 @@
int lineNumber,
int columnNumber);
+ virtual
+ ~ElemEmpty();
+
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
};
1.3 +6 -13 xml-xalan/c/src/XSLT/ElemExtensionCall.cpp
Index: ElemExtensionCall.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemExtensionCall.cpp 2000/01/26 14:26:57 1.2
+++ ElemExtensionCall.cpp 2000/04/11 15:09:24 1.3
@@ -66,18 +66,19 @@
ElemExtensionCall::ElemExtensionCall(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
ExtensionNSHandler& ns,
- const DOMString& localpart) :
+ const XalanDOMString& localpart) :
ElemLiteralResult(constructionContext,
stylesheetTree,
name,
atts,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_EXTENSIONCALL),
m_nsh(ns),
m_localPart(localpart)
{
@@ -85,19 +86,11 @@
-int
-ElemExtensionCall::getXSLToken() const
-{
- return Constants::ELEMNAME_EXTENSIONCALL;
-}
-
-
-
void
ElemExtensionCall::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& /* sourceTree */,
- const DOM_Node& /* sourceNode */,
+ XalanNode* /* sourceTree */,
+ XalanNode* /* sourceNode */,
const QName& /* mode */) const
{
/*
1.4 +6 -20 xml-xalan/c/src/XSLT/ElemExtensionCall.hpp
Index: ElemExtensionCall.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemExtensionCall.hpp 2000/02/29 20:54:21 1.3
+++ ElemExtensionCall.hpp 2000/04/11 15:09:24 1.4
@@ -57,15 +57,8 @@
#if !defined(XALAN_ELEMEXTENSIONCALL_HEADER_GUARD)
#define XALAN_ELEMEXTENSIONCALL_HEADER_GUARD
-/**
- * $Id: ElemExtensionCall.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -76,10 +69,6 @@
-#include <dom/DOMString.hpp>
-
-
-
class ExtensionNSHandler;
@@ -103,30 +92,27 @@
ElemExtensionCall(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
ExtensionNSHandler& ns,
- const DOMString& localpart);
+ const XalanDOMString& localpart);
// These methods are inherited from ElemLiteralResult ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
ExtensionNSHandler& m_nsh;
- DOMString m_localPart;
+ XalanDOMString m_localPart;
};
1.3 +42 -41 xml-xalan/c/src/XSLT/ElemForEach.cpp
Index: ElemForEach.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemForEach.cpp 2000/01/26 14:26:57 1.2
+++ ElemForEach.cpp 2000/04/11 15:09:24 1.3
@@ -58,6 +58,7 @@
+#include <algorithm>
#include <cassert>
@@ -67,10 +68,10 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/STLHelper.hpp>
-#include "Constants.hpp"
#include "ElemSort.hpp"
#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
@@ -78,32 +79,30 @@
ElemForEach::ElemForEach(
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber,
- bool isOnlyForEach) :
- ElemTemplateElement(constructionContext, stylesheetTree, name, lineNumber, columnNumber),
- m_pSelectPattern(0)
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber,
+ int xslToken) :
+ ElemTemplateElement(constructionContext,
+ stylesheetTree,
+ name,
+ lineNumber,
+ columnNumber,
+ xslToken),
+ m_pSelectPattern(0)
{
- // since we're calling the virtual function getXSLToken() from a ctor, subclasses
- // like ElemApplyTemplates when in a partially constructed state will get
- // ELEMNAME_FOREACH. So, as an extra check, we pass in a boolean flag, isOnlyFor each
- // which is true iff an ElemForEach object is being created not part of a subclass
- //
- if(isOnlyForEach)
+ if(xslToken == Constants::ELEMNAME_FOREACH)
{
- assert(Constants::ELEMNAME_FOREACH == getXSLToken());
-
- int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- if(equals(aname,Constants::ATTRNAME_SELECT))
+ if(equals(aname, Constants::ATTRNAME_SELECT))
{
m_pSelectPattern = constructionContext.createXPath(atts.getValue(i), *this);
}
@@ -120,41 +119,43 @@
}
}
-ElemForEach::~ElemForEach()
-{
- size_t len = m_sortElems.size();
-
- for (size_t i=0; i< len; i++)
- delete m_sortElems[i];
-}
-int ElemForEach::getXSLToken() const
+
+ElemForEach::~ElemForEach()
{
- return Constants::ELEMNAME_FOREACH;
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
+ for_each(m_sortElems.begin(),
+ m_sortElems.end(),
+ DeleteFunctor<ElemTemplateElement>());
}
void
ElemForEach::execute(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode) const
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const
{
if (sourceNode != 0)
{
assert(m_pSelectPattern != 0);
transformSelectedChildren(executionContext, getStylesheet(),
- *this,this,sourceTree,sourceNode,mode,
- m_pSelectPattern, Constants::ELEMNAME_FOREACH);
+ *this,
+ this,
+ sourceTree,sourceNode,mode,
+ m_pSelectPattern,
+ Constants::ELEMNAME_FOREACH);
}
else
{
- // error wants DOM_node for first param
- executionContext.error("sourceNode is null in handleApplyTemplatesInstruction!",
- sourceNode,
- DOM_UnimplementedElement(const_cast<ElemForEach*>(this)));
+ executionContext.error("sourceNode is null in handleApplyTemplatesInstruction!",
+ sourceNode,
+ this);
}
}
1.5 +39 -45 xml-xalan/c/src/XSLT/ElemForEach.hpp
Index: ElemForEach.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemForEach.hpp 2000/03/03 19:00:32 1.4
+++ ElemForEach.hpp 2000/04/11 15:09:24 1.5
@@ -57,37 +57,31 @@
#if !defined(XALAN_ELEMFOREACH_HEADER_GUARD)
#define XALAN_ELEMFOREACH_HEADER_GUARD
-/**
- * $Id: ElemForEach.hpp,v 1.4 2000/03/03 19:00:32 jdonohue Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
-// Base class header file.
-#include "ElemTemplateElement.hpp"
-//#include "ElemSort.hpp"
-//#include <dom/DOMString.hpp>
-//#include <XPath/NameSpace.hpp>
-//#include <XPath/XObject.hpp>
-//#include <XPath/XPath.hpp>
-
#include <vector>
+
+// Base class header file.
+#include "ElemTemplateElement.hpp"
+#include "Constants.hpp"
+
+
+
class ElemSort;
class XPath;
+
class ElemForEach: public ElemTemplateElement
{
+public:
/**
* Construct an object corresponding to an "xsl:for-each" element
@@ -96,59 +90,59 @@
* @param stylesheetTree stylesheet containing element
* @param name name of element
* @param atts list of attributes for element
- * @param lineNumber line number in document
+ * @param lineNumber line number in document
* @param columnNumber column number in document
- * @param isOnlyForEach true if this is not called on a subclass for
- * ElemForEach; this is necessary because of
- * differences in construction of subclasses
- * between C++ and Java
+ * @param xslToken an integer representing the type of instance.
*/
-public:
- ElemForEach (
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber,
- bool isOnlyForEach); // true if this is not called on a subclass for ElemForEach
+ ElemForEach(
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber,
+ int xslToken = Constants::ELEMNAME_FOREACH);
+ virtual
+ ~ElemForEach();
- virtual ~ElemForEach();
-
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<ElemSort*> SortElemsVector;
+ typedef vector<ElemSort*> SortElemsVector;
#else
- typedef std::vector<ElemSort*> SortElemsVector;
+ typedef std::vector<ElemSort*> SortElemsVector;
#endif
- const SortElemsVector& getSortElems() const
+ const SortElemsVector&
+ getSortElems() const
{
return m_sortElems;
}
- SortElemsVector& getSortElems()
+ SortElemsVector&
+ getSortElems()
{
return m_sortElems;
}
// These methods are inherited from ElemTemplateElement ...
-
- virtual int getXSLToken() const;
- virtual void execute(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode) const;
+ virtual void
+ execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const;
protected:
- const XPath* m_pSelectPattern; // = null;
+
+ const XPath* m_pSelectPattern;
private:
- SortElemsVector m_sortElems;
+ SortElemsVector m_sortElems;
};
+
+
#endif // XALAN_ELEMFOREACH_HEADER_GUARD
1.3 +16 -18 xml-xalan/c/src/XSLT/ElemIf.cpp
Index: ElemIf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemIf.cpp 2000/01/26 14:26:57 1.2
+++ ElemIf.cpp 2000/04/11 15:09:24 1.3
@@ -63,6 +63,9 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/XPath.hpp>
@@ -79,7 +82,7 @@
ElemIf::ElemIf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -87,16 +90,18 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_IF),
m_test(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -123,19 +128,12 @@
}
-
-int
-ElemIf::getXSLToken() const
-{
- return Constants::ELEMNAME_IF;
-}
-
-
-void ElemIf::execute(
+void
+ElemIf::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
assert(m_test != 0);
@@ -151,7 +149,7 @@
SelectionEvent(executionContext,
sourceNode,
*this,
- "test",
+ XALAN_STATIC_UCODE_STRING("test"),
*m_test,
test));
}
1.4 +4 -7 xml-xalan/c/src/XSLT/ElemIf.hpp
Index: ElemIf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemIf.hpp 2000/02/29 20:54:21 1.3
+++ ElemIf.hpp 2000/04/11 15:09:24 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMIF_HEADER_GUARD
/**
- * $Id: ElemIf.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
+ * $Id: ElemIf.hpp,v 1.4 2000/04/11 15:09:24 dbertoni Exp $
*
* $State: Exp $
*
@@ -96,21 +96,18 @@
ElemIf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
1.7 +54 -41 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemLiteralResult.cpp 2000/03/17 16:09:03 1.6
+++ ElemLiteralResult.cpp 2000/04/11 15:09:24 1.7
@@ -58,10 +58,16 @@
+#include <algorithm>
+
+
+
#include <sax/AttributeList.hpp>
+
#include <PlatformSupport/StringTokenizer.hpp>
+#include <PlatformSupport/STLHelper.hpp>
@@ -76,47 +82,51 @@
ElemLiteralResult::ElemLiteralResult(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
- int columnNumber) :
+ int columnNumber,
+ int xslToken) :
ElemUse(constructionContext,
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ xslToken),
m_QName(name)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- bool needToProcess = true;
- const int indexOfNSSep = indexOf(aname,':');
+ bool needToProcess = true;
+ const unsigned int indexOfNSSep = indexOf(aname, ':');
- DOMString prefix;
+ XalanDOMString prefix;
- if(indexOfNSSep > 0)
+ if(indexOfNSSep < length(aname))
{
- prefix = substring(aname,0,indexOfNSSep);
+ prefix = substring(aname, 0, indexOfNSSep);
- if(!equals(prefix, "xmlns"))
+ if(!equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
{
- DOMString ns = getNamespaceForPrefix(prefix);
+ XalanDOMString ns = getNamespaceForPrefix(prefix);
if(startsWith(ns, constructionContext.getXSLNameSpaceURLPre()))
{
- const DOMString localName = substring(aname,indexOfNSSep + 1);
+ const XalanDOMString localName = substring(aname, indexOfNSSep + 1);
if(equals(localName, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
{
needToProcess = false;
- const DOMString qnames = atts.getValue(i);
+ const XalanDOMString qnames = atts.getValue(i);
- StringTokenizer tokenizer(qnames, " \t\n\r", false);
+ StringTokenizer tokenizer(qnames,
+ XALAN_STATIC_UCODE_STRING(" \t\n\r"),
+ false);
m_extensionElementPrefixes.reserve(tokenizer.countTokens());
@@ -132,10 +142,11 @@
if(needToProcess == true)
{
processSpaceAttr(aname, atts, i);
+
// Add xmlns attribute(except xmlns:xsl), xml:space, etc...
// Ignore anything with xsl:xxx
if(! processUseAttributeSets(constructionContext, aname, atts, i) &&
- isAttrOK(aname, atts, i, constructionContext) )
+ isAttrOK(aname, atts, i, constructionContext))
{
m_avts.push_back(new AVT(aname, atts.getType(i), atts.getValue(i),
*this, constructionContext));
@@ -145,22 +156,25 @@
}
+
ElemLiteralResult::~ElemLiteralResult()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
+ // Clean up all entries in the vector.
+ for_each(m_avts.begin(),
+ m_avts.end(),
+ DeleteFunctor<AVT>());
}
-int ElemLiteralResult::getXSLToken() const
-{
- return Constants::ELEMNAME_LITERALRESULT;
-}
-
-
void ElemLiteralResult::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
executionContext.startElement(toCharArray(m_QName));
@@ -169,13 +183,13 @@
if(0 != m_avts.size())
{
- const int nAttrs = m_avts.size();
+ const AVTVectorType::size_type nAttrs = m_avts.size();
- for(int i = 0; i < nAttrs; i++)
+ for(AVTVectorType::size_type i = 0; i < nAttrs; i++)
{
const AVT* const avt = m_avts[i];
- DOMString stringedValue;
+ XalanDOMString stringedValue;
avt->evaluate(stringedValue, sourceNode, *this,
executionContext.getXPathExecutionContext());
@@ -196,22 +210,21 @@
while(more == true)
{
- NameSpace ns;
-
- for (int i = 0; i < nsVector->size(); i++)
+ for (NamespaceVectorType::size_type i = 0; i < nsVector->size(); i++)
{
- ns = (*nsVector)[i];
+ NameSpace ns = (*nsVector)[i];
if(!isEmpty(ns.getURI()) && ns.getResultCandidate())
{
- bool hasPrefix = !isEmpty(ns.getPrefix());
+ const bool hasPrefix = !isEmpty(ns.getPrefix());
- DOMString prefix = hasPrefix ? ns.getPrefix() : DOMString();
- DOMString desturi = executionContext.getResultNamespaceForPrefix(prefix);
- DOMString attrName = hasPrefix ?
- (DOMString("xmlns:") + prefix) : DOMString("xmlns");
+ XalanDOMString prefix = hasPrefix ? ns.getPrefix() : XalanDOMString();
+ XalanDOMString desturi = executionContext.getResultNamespaceForPrefix(prefix);
+ XalanDOMString attrName = hasPrefix ?
+ (XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns:")) + prefix) :
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("xmlns"));
- DOMString srcURI = ns.getURI();
+ XalanDOMString srcURI = ns.getURI();
bool isXSLNS = equals(srcURI, executionContext.getXSLNameSpaceURL())
|| 0 != getStylesheet().lookupExtensionNSHandler(srcURI)
@@ -219,7 +232,7 @@
if(!isXSLNS)
{
- if(startsWith(srcURI,DOMString("quote:")))
+ if(startsWith(srcURI, XALAN_STATIC_UCODE_STRING("quote:")))
{
srcURI = substring(srcURI, 6);
}
@@ -239,14 +252,14 @@
// We didn't find a namespace, start looking at the parents
if (0 != elem)
{
- elem = elem->getParentNode();
+ elem = elem->getParentNodeElem();
while(0 != elem)
{
nsVector = &elem->getNameSpace();
if(0 == nsVector->size())
- elem = elem->getParentNode();
+ elem = elem->getParentNodeElem();
else
break;
}
1.5 +14 -27 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemLiteralResult.hpp 2000/03/03 19:00:32 1.4
+++ ElemLiteralResult.hpp 2000/04/11 15:09:24 1.5
@@ -57,14 +57,8 @@
#if !defined(XALAN_ELEMLITERALRESULT_HEADER_GUARD)
#define XALAN_ELEMLITERALRESULT_HEADER_GUARD
-/**
- * $Id: ElemLiteralResult.hpp,v 1.4 2000/03/03 19:00:32 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -75,10 +69,6 @@
-#include <dom/DOMString.hpp>
-
-
-
class AVT;
@@ -100,24 +90,22 @@
ElemLiteralResult(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
- int columnNumber);
+ int columnNumber,
+ int xslToken = Constants::ELEMNAME_LITERALRESULT);
virtual
~ElemLiteralResult();
// These methods are inherited from ElemUse ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
@@ -126,24 +114,23 @@
ElemLiteralResult(const ElemLiteralResult &);
ElemLiteralResult&
- operator=(const ElemLiteralResult &);
+ operator=(const ElemLiteralResult&);
#if defined(XALAN_NO_NAMESPACES)
-# define XALAN_STD
+ typedef vector<const AVT*> AVTVectorType;
+ typedef vector<XalanDOMString> ExtensionElementPrefixesVectoryType;
#else
-# define XALAN_STD std::
+ typedef std::vector<const AVT*> AVTVectorType;
+ typedef std::vector<XalanDOMString> ExtensionElementPrefixesVectoryType;
#endif
- typedef XALAN_STD vector<const AVT*> AVTsVectorType;
- typedef XALAN_STD vector<DOMString> ExtensionElementPrefixesVectoryType;
-#undef XALAN_STD
+
/**
* A stack to keep track of the attribute elements.
*/
- AVTsVectorType m_avts;
-
- DOMString m_QName;
+ AVTVectorType m_avts;
+ XalanDOMString m_QName;
ExtensionElementPrefixesVectoryType m_extensionElementPrefixes;
};
1.3 +13 -18 xml-xalan/c/src/XSLT/ElemMessage.cpp
Index: ElemMessage.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemMessage.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemMessage.cpp 2000/01/26 14:26:57 1.2
+++ ElemMessage.cpp 2000/04/11 15:09:24 1.3
@@ -75,7 +75,7 @@
ElemMessage::ElemMessage(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -83,41 +83,36 @@
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_MESSAGE)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) +
+ " has an illegal attribute: " +
+ XalanDOMString(aname));
}
}
}
-int
-ElemMessage::getXSLToken() const
-{
- return Constants::ELEMNAME_MESSAGE;
-}
-
-
-
void
ElemMessage::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- const DOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
- executionContext.message(data, sourceNode, DOM_UnimplementedElement(const_cast<ElemMessage*>(this)));
+ executionContext.message(data, sourceNode, this);
}
1.4 +3 -6 xml-xalan/c/src/XSLT/ElemMessage.hpp
Index: ElemMessage.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemMessage.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemMessage.hpp 2000/02/29 20:54:21 1.3
+++ ElemMessage.hpp 2000/04/11 15:09:25 1.4
@@ -87,21 +87,18 @@
ElemMessage(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
};
1.7 +184 -189 xml-xalan/c/src/XSLT/ElemNumber.cpp
Index: ElemNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemNumber.cpp 2000/03/22 20:16:15 1.6
+++ ElemNumber.cpp 2000/04/11 15:09:25 1.7
@@ -61,8 +61,16 @@
#include <sax/AttributeList.hpp>
+
+#include <XalanDOM/XalanDocument.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/NumberFormat.hpp>
+
+
+
#include <XPath/XPath.hpp>
@@ -76,10 +84,8 @@
using std::vector;
#endif
-typedef vector<DOMString> StringVectorType;
-typedef StringVectorType::iterator StringVectorTypeIterator;
-const DOMString ElemNumber::s_alphaCountTable(XALAN_STATIC_UCODE_STRING("ZABCDEFGHIJKLMNOPQRSTUVWXY"));
+const XalanDOMString ElemNumber::s_alphaCountTable(XALAN_STATIC_UCODE_STRING("ZABCDEFGHIJKLMNOPQRSTUVWXY"));
@@ -99,7 +105,7 @@
ElemNumber::ElemNumber(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -107,7 +113,8 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_NUMBER),
m_countMatchPattern(0),
m_fromMatchPattern(0),
m_valueExpr(0),
@@ -119,27 +126,24 @@
m_groupingSize_avt()
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_LEVEL))
{
- const DOMString levelValue = atts.getValue(i);
+ const XalanDOMChar* const levelValue = atts.getValue(i);
- if(!isEmpty(levelValue))
- {
- if(equals(Constants::ATTRVAL_MULTI, levelValue))
- m_level = Constants::NUMBERLEVEL_MULTI;
- else if(equals(levelValue,Constants::ATTRVAL_ANY))
- m_level = Constants::NUMBERLEVEL_ANY;
- else if(equals(levelValue,Constants::ATTRVAL_SINGLE))
- m_level = Constants::NUMBERLEVEL_SINGLE;
- else
- error("Bad value on level attribute: " + levelValue);
- }
+ if(equals(Constants::ATTRVAL_MULTI, levelValue))
+ m_level = Constants::NUMBERLEVEL_MULTI;
+ else if(equals(levelValue,Constants::ATTRVAL_ANY))
+ m_level = Constants::NUMBERLEVEL_ANY;
+ else if(equals(levelValue,Constants::ATTRVAL_SINGLE))
+ m_level = Constants::NUMBERLEVEL_SINGLE;
+ else
+ error(XalanDOMString("Bad value on level attribute: ") + levelValue);
}
else if(equals(aname, Constants::ATTRNAME_COUNT))
{
@@ -182,25 +186,20 @@
}
}
-
-int
-ElemNumber::getXSLToken() const
-{
- return Constants::ELEMNAME_NUMBER;
-}
-
-void ElemNumber::execute(
+void
+ElemNumber::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- DOMString countString = getCountString(executionContext, sourceTree, sourceNode);
-
+ const XalanDOMString countString =
+ getCountString(executionContext, sourceTree, sourceNode);
+
if (!isEmpty(countString))
{
executionContext.characters(toCharArray(countString), 0, length(countString));
@@ -209,43 +208,23 @@
-/**
- * Add a child to the child list.
- */
-NodeImpl* ElemNumber::appendChild(NodeImpl* newChild)
-{
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + this->getTagName());
-
- return 0;
-}
-
-
-
-/**
- * Given a 'from' pattern (ala xsl:number), a match pattern
- * and a context, find the first ancestor that matches the
- * pattern (including the context handed in).
- * @param matchPatternString The match pattern.
- * @param node The node that "." expresses.
- * @param namespaceContext The context in which namespaces in the
- * queries are supposed to be expanded.
- */
-DOM_Node
+XalanNode*
ElemNumber::findAncestor(
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& context,
- const DOM_Element& /* namespaceContext */) const
+ XalanNode* context,
+ const XalanElement* /* namespaceContext */) const
{
- DOM_Node contextCopy(context);
+ XalanNode* contextCopy = context;
while(contextCopy != 0)
{
if(0 != fromMatchPattern)
{
if(fromMatchPattern->getMatchScore(contextCopy,
- executionContext.getXPathExecutionContext()) !=
+ *this,
+ executionContext.getXPathExecutionContext()) !=
XPath::s_MatchScoreNone)
{
break;
@@ -255,14 +234,15 @@
if(0 != countMatchPattern)
{
if(countMatchPattern->getMatchScore(context,
- executionContext.getXPathExecutionContext()) !=
+ *this,
+ executionContext.getXPathExecutionContext()) !=
XPath::s_MatchScoreNone)
{
break;
}
}
- contextCopy = executionContext.getParentOfNode(contextCopy);
+ contextCopy = executionContext.getParentOfNode(*contextCopy);
}
return contextCopy;
@@ -270,21 +250,22 @@
-DOM_Node
+XalanNode*
ElemNumber::findPrecedingOrAncestorOrSelf(
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& context,
- const DOM_Element& /* namespaceContext */) const
+ XalanNode* context,
+ const XalanElement* /* namespaceContext */) const
{
- DOM_Node contextCopy(context);
-
+ XalanNode* contextCopy = context;
+
while(contextCopy != 0)
{
if(0 != fromMatchPattern)
{
if(fromMatchPattern->getMatchScore(contextCopy,
+ *this,
executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
{
contextCopy = 0;
@@ -295,17 +276,18 @@
if(0 != countMatchPattern)
{
if(countMatchPattern->getMatchScore(contextCopy,
+ *this,
executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
{
break;
}
}
- DOM_Node prevSibling = contextCopy.getPreviousSibling();
+ XalanNode* const prevSibling = contextCopy->getPreviousSibling();
if(prevSibling == 0)
{
- contextCopy = executionContext.getParentOfNode(contextCopy);
+ contextCopy = executionContext.getParentOfNode(*contextCopy);
}
else
{
@@ -318,49 +300,47 @@
-/**
- * Get the count match pattern, or a default value.
- */
const XPath*
ElemNumber::getCountMatchPattern(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode) const
+ XalanNode* contextNode) const
{
const XPath* countMatchPattern = m_countMatchPattern;
if(0 == countMatchPattern)
{
- switch(contextNode.getNodeType())
+ switch(contextNode->getNodeType())
{
- case DOM_Node::ELEMENT_NODE:
- countMatchPattern = executionContext.createMatchPattern(contextNode.getNodeName(),
+ case XalanNode::ELEMENT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(contextNode->getNodeName(),
*this);
break;
- case DOM_Node::ATTRIBUTE_NODE:
- countMatchPattern = executionContext.createMatchPattern(DOMString("@") + contextNode.getNodeName(),
+ case XalanNode::ATTRIBUTE_NODE:
+ countMatchPattern = executionContext.createMatchPattern(XalanDOMString(XALAN_STATIC_UCODE_STRING("@")) +
+ contextNode->getNodeName(),
*this);
break;
- case DOM_Node::CDATA_SECTION_NODE:
- case DOM_Node::TEXT_NODE:
- countMatchPattern = executionContext.createMatchPattern(DOMString("text()"),
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(XalanDOMString(XALAN_STATIC_UCODE_STRING("text()")),
*this);
break;
- case DOM_Node::COMMENT_NODE:
- countMatchPattern = executionContext.createMatchPattern(DOMString("comment()"),
+ case XalanNode::COMMENT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(XalanDOMString(XALAN_STATIC_UCODE_STRING("comment()")),
*this);
break;
- case DOM_Node::DOCUMENT_NODE:
- countMatchPattern = executionContext.createMatchPattern(DOMString("/"),
+ case XalanNode::DOCUMENT_NODE:
+ countMatchPattern = executionContext.createMatchPattern(XalanDOMString(XALAN_STATIC_UCODE_STRING("/")),
*this);
break;
- case DOM_Node::PROCESSING_INSTRUCTION_NODE:
- countMatchPattern = executionContext.createMatchPattern(DOMString("pi(") +
- contextNode.getNodeName() + DOMString(")"),
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
+ countMatchPattern = executionContext.createMatchPattern(XalanDOMString(XALAN_STATIC_UCODE_STRING("pi(")) +
+ contextNode->getNodeName() + XalanDOMString(XALAN_STATIC_UCODE_STRING(")")),
*this);
break;
@@ -375,14 +355,17 @@
-DOMString
+XalanDOMString
ElemNumber::getCountString(
StylesheetExecutionContext& executionContext,
- const DOM_Node& /* sourceTree */,
- const DOM_Node& sourceNode) const
+ XalanNode* /* sourceTree */,
+ XalanNode* sourceNode) const
{
+ assert(sourceNode != 0);
IntArrayType numberList;
+ IntArrayType list;
+
if(0 != m_valueExpr)
{
const XObject* const countObj =
@@ -393,7 +376,7 @@
numberList.push_back(static_cast<int>(countObj->num()));
}
else
- {
+ {
const XPath* const countMatchPattern =
getCountMatchPattern(executionContext, sourceNode);
@@ -402,11 +385,15 @@
{
if(Constants::NUMBERLEVEL_SINGLE == m_level)
{
- DOM_Node target = findAncestor(executionContext, m_fromMatchPattern,
- countMatchPattern, sourceNode, DOM_UnimplementedElement(const_cast<ElemNumber*>(this)));
+ XalanNode* target =
+ findAncestor(executionContext,
+ m_fromMatchPattern,
+ countMatchPattern,
+ sourceNode,
+ this);
if(target == 0)
- target = executionContext.getParentOfNode(sourceNode);
+ target = executionContext.getParentOfNode(*sourceNode);
if(target != 0)
{
@@ -414,15 +401,15 @@
}
else
{
- executionContext.warn(DOMString("Warning: count attribute does not match an ancestor in xsl:number! Target = ")
- + sourceNode.getNodeName(),
+ executionContext.warn(XalanDOMString("Warning: count attribute does not match an ancestor in xsl:number! Target = ")
+ + sourceNode->getNodeName(),
sourceNode,
- DOM_Node());
+ 0);
}
}
else // if NUMBERLEVEL_ANY
{
- DOM_Node from;
+ XalanNode* from = 0;
if(0 != m_fromMatchPattern)
{
@@ -431,7 +418,7 @@
// passed went DOWN after this change
// from = findPrecedingOrAncestorOrSelf(executionContext, 0, m_fromMatchPattern,
from = findPrecedingOrAncestorOrSelf(executionContext, m_fromMatchPattern, countMatchPattern,
- sourceNode, DOM_UnimplementedElement(const_cast<ElemNumber*>(this)));
+ sourceNode, this);
if(from == 0)
{
@@ -440,10 +427,10 @@
}
else
{
- from = sourceNode.getOwnerDocument();
+ from = sourceNode->getOwnerDocument();
}
- DOM_Node fromPos = (from != sourceNode) ? getNextInTree(from, from) : from;
+ XalanNode* const fromPos = (from != sourceNode) ? getNextInTree(from, from) : from;
numberList.push_back(getNumberInTree(executionContext.getXPathExecutionContext(), countMatchPattern, fromPos, from, sourceNode, 0));
}
@@ -455,27 +442,30 @@
}
}
- return numberList.size() > 0 ? formatNumberList(executionContext, numberList, sourceNode) : DOMString();
+ return numberList.size() > 0 ? formatNumberList(executionContext, numberList, sourceNode) : XalanDOMString();
}
-DOM_Node
+XalanNode*
ElemNumber::getNextInTree(
- const DOM_Node& pos,
- const DOM_Node& from)
+ XalanNode* pos,
+ XalanNode* from)
{
- DOM_Node posCopy(pos);
+ assert(pos != 0);
+ assert(from != 0);
- DOM_Node nextNode(posCopy.getFirstChild());
+ XalanNode* posCopy = pos;
+ XalanNode* nextNode = posCopy->getFirstChild();
+
while(nextNode == 0)
{
- nextNode = posCopy.getNextSibling();
+ nextNode = posCopy->getNextSibling();
if(nextNode == 0)
{
- posCopy = posCopy.getParentNode();
+ posCopy = posCopy->getParentNode();
if(posCopy == from)
{
@@ -489,18 +479,18 @@
-int
+unsigned int
ElemNumber::getNumberInTree(
XPathExecutionContext& executionContext,
const XPath* countMatchPattern,
- const DOM_Node& pos,
- const DOM_Node& from,
- const DOM_Node& target,
+ XalanNode* pos,
+ XalanNode* from,
+ XalanNode* target,
int countFrom) const
{
- DOM_Node posCopy(pos);
+ XalanNode* posCopy = pos;
- int count = countFrom;
+ int count = countFrom;
if(posCopy != 0)
{
@@ -508,6 +498,7 @@
{
if( (0 == countMatchPattern) ||
(countMatchPattern->getMatchScore(posCopy,
+ *this,
executionContext) != XPath::s_MatchScoreNone))
{
count++;
@@ -523,40 +514,38 @@
-int
+unsigned int
ElemNumber::getSiblingNumber(
StylesheetExecutionContext& executionContext,
const XPath* countMatchPattern,
- const DOM_Node& target) const
+ XalanNode* target) const
{
+ assert(target != 0);
+
int number = 0;
- const DOM_Node theParent = executionContext.getParentOfNode(target);
+ const XalanNode* const theParent = executionContext.getParentOfNode(*target);
assert(theParent != 0);
// TODO: If target is an Attr, implement special handling.
- DOM_NodeList siblings = theParent.getChildNodes();
+ XalanNode* child = theParent->getFirstChild();
- if (siblings != 0)
+ while(child != 0)
{
- const int nNodes = siblings.getLength();
-
- for(int i = 0; i < nNodes; i++)
+ if(child == target)
{
- const DOM_Node child = siblings.item(i);
-
- if(child == target)
- {
- number++; // always count the target
- break;
- }
- else if(0 == countMatchPattern ||
- countMatchPattern->getMatchScore(child,
- executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
- {
- number++;
- }
+ number++; // always count the target
+ break;
}
+ else if(0 == countMatchPattern ||
+ countMatchPattern->getMatchScore(child,
+ *this,
+ executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
+ {
+ number++;
+ }
+
+ child = child->getNextSibling();
}
return number;
@@ -564,21 +553,22 @@
-int
+unsigned int
ElemNumber::countMatchingAncestors(
StylesheetExecutionContext& executionContext,
const XPath* patterns,
- const DOM_Node& node) const
+ XalanNode* node) const
{
int count = 0;
- DOM_Node nodeCopy(node);
+ XalanNode* nodeCopy = node;
while(nodeCopy != 0)
{
if(0 != patterns)
{
if(patterns->getMatchScore(nodeCopy,
+ *this,
executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
{
count++;
@@ -589,7 +579,7 @@
count++;
}
- nodeCopy = executionContext.getParentOfNode(nodeCopy);
+ nodeCopy = executionContext.getParentOfNode(*nodeCopy);
}
return count;
@@ -602,11 +592,11 @@
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& node) const
+ XalanNode* node) const
{
- DOM_Node nodeCopy(node);
+ XalanNode* nodeCopy = node;
- const int nMatchingAncestors =
+ const unsigned int nMatchingAncestors =
countMatchingAncestors(executionContext,
countMatchPattern,
nodeCopy);
@@ -624,6 +614,7 @@
if(0 != countMatchPattern)
{
if(countMatchPattern->getMatchScore(nodeCopy,
+ *this,
executionContext.getXPathExecutionContext()) != XPath::s_MatchScoreNone)
{
countIt = true;
@@ -636,21 +627,21 @@
if(countIt == true)
{
- DOM_Node target =
+ XalanNode* target =
findAncestor(executionContext,
fromMatchPattern,
countMatchPattern,
nodeCopy,
- DOM_UnimplementedElement(const_cast<ElemNumber*>(this)));
+ this);
- if(target == 0)
+ if(target == 0)
target = nodeCopy;
counts[countIndex] = getSiblingNumber(executionContext, countMatchPattern, target);
countIndex--;
}
- nodeCopy = executionContext.getParentOfNode(nodeCopy);
+ nodeCopy = executionContext.getParentOfNode(*nodeCopy);
} // end while
} // end if nMatchingAncestors > 0
@@ -664,7 +655,7 @@
std::locale
ElemNumber::getLocale(
StylesheetExecutionContext& /* executionContext */,
- const DOM_Node& /* contextNode */) const
+ XalanNode* /* contextNode */) const
{
//TODO
return std::locale();
@@ -676,7 +667,7 @@
NumberFormat*
ElemNumber::getNumberFormatter(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode) const
+ XalanNode* contextNode) const
{
#if ! defined(__GNUC__)
std::locale loc = getLocale(executionContext, contextNode);
@@ -684,20 +675,18 @@
// Helper to format local specific numbers to strings.
std::auto_ptr<NumberFormat> formatter(new NumberFormat);
-
- DOM_UnimplementedElement theNamespaceContext(const_cast<ElemNumber*>(this));
- DOMString digitGroupSepValue = (!isEmpty(m_groupingSeparator_avt))
+ const XalanDOMString digitGroupSepValue = (!isEmpty(m_groupingSeparator_avt))
? executionContext.evaluateAttrVal(contextNode,
- theNamespaceContext,
+ *this,
m_groupingSeparator_avt) :
- DOMString();
+ XalanDOMString();
- DOMString nDigitsPerGroupValue = (!isEmpty(m_groupingSize_avt))
+ const XalanDOMString nDigitsPerGroupValue = (!isEmpty(m_groupingSize_avt))
? executionContext.evaluateAttrVal(contextNode,
- theNamespaceContext,
+ *this,
m_groupingSize_avt) :
- DOMString();
+ XalanDOMString();
// TODO: Handle digit-group attributes
if(!isEmpty(digitGroupSepValue) || !isEmpty(nDigitsPerGroupValue))
@@ -712,35 +701,39 @@
-DOMString
+XalanDOMString
ElemNumber::formatNumberList(
StylesheetExecutionContext& executionContext,
- const IntArrayType& theList,
- const DOM_Node& contextNode) const
+ const IntArrayType& theList,
+ XalanNode* contextNode) const
{
- const int nNumbers = theList.size();
- XMLCh numberType('1');
+ const IntArrayType::size_type nNumbers = theList.size();
+ XalanDOMChar numberType('1');
int numberWidth = 1;
- DOMString formattedNumber;
- DOMString formatToken;
- DOMString sepString(".");
- DOMString lastSepString;
+ XalanDOMString formattedNumber;
+ XalanDOMString formatToken;
+ XalanDOMString sepString(XALAN_STATIC_UCODE_STRING("."));
+ XalanDOMString lastSepString;
- DOMString formatValue = !isEmpty(m_format_avt)
+ XalanDOMString formatValue = !isEmpty(m_format_avt)
? executionContext.evaluateAttrVal(contextNode,
- DOM_UnimplementedElement(const_cast<ElemNumber*>(this)),
+ *this,
m_format_avt)
- : DOMString();
+ : XalanDOMString();
if(isEmpty(formatValue))
- formatValue = DOMString("1");
-
+ formatValue = XALAN_STATIC_UCODE_STRING("1");
+
NumeratorFormatter::NumberFormatStringTokenizer formatTokenizer(formatValue);
#if ! defined(__GNUC__)
std::locale loc = getLocale(executionContext, contextNode);
#endif
+
+ typedef vector<XalanDOMString> StringVectorType;
+ typedef StringVectorType::iterator StringVectorTypeIterator;
+
// Construct an array of tokens. We need to be able to check if the last
// token in non-alphabetic, in which case the penultimate non-alphabetic is
// the repeating separator
@@ -749,8 +742,8 @@
tokenVector.push_back(formatTokenizer.nextToken());
// Get rid of the leading and trailing non-alphabetics, save for later
- DOMString leaderStr;
- DOMString trailerStr;
+ XalanDOMString leaderStr;
+ XalanDOMString trailerStr;
StringVectorTypeIterator it;
it = tokenVector.begin();
if(! isLetterOrDigit(charAt((*it), 0)))
@@ -770,7 +763,7 @@
// more matching ones
formattedNumber = leaderStr;
it = tokenVector.begin();
- for(int i = 0; i < nNumbers; i++)
+ for(unsigned int i = 0; i < nNumbers; i++)
{
if (it != tokenVector.end())
{
@@ -797,21 +790,21 @@
-DOMString
+XalanDOMString
ElemNumber::getFormattedNumber(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode,
- XMLCh numberType,
+ XalanNode* contextNode,
+ XalanDOMChar numberType,
int numberWidth,
int listElement) const
{
std::auto_ptr<NumberFormat> formatter(getNumberFormatter(executionContext, contextNode));
- DOMString padString = formatter->format(0);
- DOMString lookahead;
+ XalanDOMString padString = formatter->format(0);
+ XalanDOMString lookahead;
- DOMString formattedNumber;
+ XalanDOMString formattedNumber;
switch(numberType)
{
@@ -830,7 +823,7 @@
default: // "1"
{
- const DOMString numString =
+ const XalanDOMString numString =
formatter->format(listElement);
const int nPadding = numberWidth - length(numString);
@@ -861,10 +854,10 @@
* Note that the radix of the conversion is inferred from the size
* of the table.
*/
-DOMString
+XalanDOMString
ElemNumber::int2alphaCount(
- int val,
- const DOMString& table)
+ int val,
+ const XalanDOMString& table)
{
const int radix = length(table);
@@ -873,7 +866,7 @@
// logs of the radix. For now, we fake it.
const int buflen = 100;
- std::vector<XMLCh> buf(buflen + 1, (XMLCh)0);
+ vector<XalanDOMChar> buf(buflen + 1, 0);
// next character to set in the buffer
int charPos = buflen - 1 ; // work backward through buf[]
@@ -933,24 +926,26 @@
}
while (val > 0);
- DOMString retStr(buf.begin() + charPos + 1, (buflen - charPos - 1));
+ XalanDOMString retStr(buf.begin() + charPos + 1, (buflen - charPos - 1));
return retStr;
}
-DOMString
+XalanDOMString
ElemNumber::long2roman(
long val,
bool prefixesAreOK)
{
if(val <= 0)
{
- return DOMString( "#E(" + LongToDOMString(val) +")" );
+ return XalanDOMString(XALAN_STATIC_UCODE_STRING("#E(") +
+ LongToDOMString(val) +
+ XALAN_STATIC_UCODE_STRING(")"));
}
- DOMString roman;
+ XalanDOMString roman;
int place = 0;
@@ -977,7 +972,7 @@
}
else
{
- roman = "#error";
+ roman = XALAN_STATIC_UCODE_STRING("#error");
}
return roman;
1.8 +49 -55 xml-xalan/c/src/XSLT/ElemNumber.hpp
Index: ElemNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemNumber.hpp 2000/03/10 15:18:49 1.7
+++ ElemNumber.hpp 2000/04/11 15:09:25 1.8
@@ -58,7 +58,7 @@
#define XALAN_ELEMNUMBER_HEADER_GUARD
/**
- * $Id: ElemNumber.hpp,v 1.7 2000/03/10 15:18:49 jdonohue Exp $
+ * $Id: ElemNumber.hpp,v 1.8 2000/04/11 15:09:25 dbertoni Exp $
*
* $State: Exp $
*
@@ -68,10 +68,13 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
+
// Just locale.h in G++
#if ! defined(__GNUC__)
#include <locale>
@@ -79,10 +82,6 @@
-#include <dom/DOMString.hpp>
-
-
-
#include "DecimalToRoman.hpp"
@@ -122,26 +121,20 @@
ElemNumber(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
-
protected:
/**
@@ -153,13 +146,13 @@
* @param namespaceContext The context in which namespaces in the
* queries are supposed to be expanded.
*/
- DOM_Node
+ XalanNode*
findAncestor(
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& context,
- const DOM_Element& namespaceContext) const;
+ XalanNode* context,
+ const XalanElement* namespaceContext) const;
/**
* Given a 'from' pattern (ala xsl:number), a match pattern
@@ -170,12 +163,13 @@
* @param namespaceContext The context in which namespaces in the
* queries are supposed to be expanded.
*/
- DOM_Node findPrecedingOrAncestorOrSelf(
+ XalanNode*
+ findPrecedingOrAncestorOrSelf(
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& context,
- const DOM_Element& namespaceContext) const;
+ XalanNode* context,
+ const XalanElement* namespaceContext) const;
/**
* Get the count match pattern, or a default value.
@@ -183,27 +177,27 @@
const XPath*
getCountMatchPattern(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode) const;
+ XalanNode* contextNode) const;
/**
* Given an XML source node, get the count according to the
* parameters set up by the xsl:number attributes.
*/
- DOMString
+ XalanDOMString
getCountString(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode) const;
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const;
/**
* from any position in the tree, return the
* next node in the tree, assuming preorder
* traversal preceded, or null if at the end.
*/
- static DOM_Node
+ static XalanNode*
getNextInTree(
- const DOM_Node& pos,
- const DOM_Node& from);
+ XalanNode* pos,
+ XalanNode* from);
/**
* Get a number that represents a node based on the
@@ -218,13 +212,13 @@
* @return A number that counts target and preceding
* nodes that qualify.
*/
- int
+ unsigned int
getNumberInTree(
XPathExecutionContext& executionContext,
- const XPath* countMatchPattern,
- const DOM_Node& pos,
- const DOM_Node& from,
- const DOM_Node& target,
+ const XPath* countMatchPattern,
+ XalanNode* pos,
+ XalanNode* from,
+ XalanNode* target,
int countFrom) const;
/**
@@ -239,11 +233,11 @@
* @return A number that counts target and preceding
* siblings that qualify.
*/
- int
+ unsigned int
getSiblingNumber(
StylesheetExecutionContext& executionContext,
const XPath* countMatchPattern,
- const DOM_Node& target) const;
+ XalanNode* target) const;
/**
* Count the ancestors, up to the root, that match the
@@ -253,11 +247,11 @@
* @param node Count this node and it's ancestors.
* @return The number of ancestors that match the pattern.
*/
- int
+ unsigned int
countMatchingAncestors(
StylesheetExecutionContext& executionContext,
const XPath* patterns,
- const DOM_Node& node) const;
+ XalanNode* node) const;
/**
* Climb up the ancestor tree, collecting sibling position
@@ -278,7 +272,7 @@
StylesheetExecutionContext& executionContext,
const XPath* fromMatchPattern,
const XPath* countMatchPattern,
- const DOM_Node& node) const;
+ XalanNode* node) const;
#if ! defined(__GNUC__)
/**
@@ -287,13 +281,13 @@
LocaleType
getLocale(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode) const;
+ XalanNode* contextNode) const;
#endif
NumberFormat*
getNumberFormatter(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode) const;
+ XalanNode* contextNode) const;
/**
* Format a vector of numbers into a formatted string.
@@ -304,11 +298,11 @@
* TODO: Optimize formatNumberList so that it caches the last count and
* reuses that info for the next count.
*/
- DOMString
+ XalanDOMString
formatNumberList(
StylesheetExecutionContext& executionContext,
- const IntArrayType& theList,
- const DOM_Node& contextNode) const;
+ const IntArrayType& theList,
+ XalanNode* contextNode) const;
/**
* Convert a long integer into alphabetic counting, in other words
@@ -321,10 +315,10 @@
* Note that the radix of the conversion is inferred from the size
* of the table.
*/
- static DOMString
+ static XalanDOMString
int2alphaCount(
- int val,
- const DOMString& table);
+ int val,
+ const XalanDOMString& table);
/**
* Convert a long integer into roman numerals.
@@ -335,7 +329,7 @@
* @see DecimalToRoman
* @see m_romanConvertTable
*/
- static DOMString
+ static XalanDOMString
long2roman(
long val,
bool prefixesAreOK);
@@ -346,11 +340,11 @@
/*
* Get Formatted number
*/
- DOMString
+ XalanDOMString
getFormattedNumber(
StylesheetExecutionContext& executionContext,
- const DOM_Node& contextNode,
- XMLCh numberType,
+ XalanNode* contextNode,
+ XalanDOMChar numberType,
int numberWidth,
int listElement) const;
@@ -360,17 +354,17 @@
int m_level; // = Constants.NUMBERLEVEL_SINGLE;
- DOMString m_format_avt;
- DOMString m_lang_avt;
- DOMString m_lettervalue_avt;
- DOMString m_groupingSeparator_avt;
- DOMString m_groupingSize_avt;
+ XalanDOMString m_format_avt;
+ XalanDOMString m_lang_avt;
+ XalanDOMString m_lettervalue_avt;
+ XalanDOMString m_groupingSeparator_avt;
+ XalanDOMString m_groupingSize_avt;
/**
* Chars for converting integers into alpha counts.
* @see XSLTEngineImpl#int2alphaCount
*/
- static const DOMString s_alphaCountTable;
+ static const XalanDOMString s_alphaCountTable;
/**
* Table to help in converting decimals to roman numerals.
1.3 +7 -14 xml-xalan/c/src/XSLT/ElemOtherwise.cpp
Index: ElemOtherwise.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemOtherwise.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemOtherwise.cpp 2000/01/26 14:26:58 1.2
+++ ElemOtherwise.cpp 2000/04/11 15:09:25 1.3
@@ -74,7 +74,7 @@
ElemOtherwise::ElemOtherwise(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -82,25 +82,18 @@
stylesheetTree,
name,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_OTHERWISE)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
-
+ const XalanDOMChar* const aname = atts.getName(i);
+
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
constructionContext.error(name + " has an illegal attribute: " + aname);
}
}
-}
-
-
-
-int
-ElemOtherwise::getXSLToken() const
-{
- return Constants::ELEMNAME_OTHERWISE;
}
1.4 +2 -7 xml-xalan/c/src/XSLT/ElemOtherwise.hpp
Index: ElemOtherwise.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemOtherwise.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemOtherwise.hpp 2000/02/29 20:54:21 1.3
+++ ElemOtherwise.hpp 2000/04/11 15:09:25 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMOTHERWISE_HEADER_GUARD
/**
- * $Id: ElemOtherwise.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
+ * $Id: ElemOtherwise.hpp,v 1.4 2000/04/11 15:09:25 dbertoni Exp $
*
* $State: Exp $
*
@@ -93,15 +93,10 @@
ElemOtherwise(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
-
- // These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
};
1.3 +24 -40 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemPI.cpp 2000/01/26 14:26:58 1.2
+++ ElemPI.cpp 2000/04/11 15:09:25 1.3
@@ -61,6 +61,7 @@
#include <sax/AttributeList.hpp>
+
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -74,7 +75,7 @@
ElemPI::ElemPI(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -82,14 +83,15 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_PI),
m_name_atv()
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_NAME))
{
@@ -115,29 +117,21 @@
-int
-ElemPI::getXSLToken() const
-{
- return Constants::ELEMNAME_PI;
-}
-
-
-
void
ElemPI::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- const DOMString piName =
+ const XalanDOMString piName =
executionContext.evaluateAttrVal(sourceNode,
- DOM_UnimplementedElement(const_cast<ElemPI*>(this)),
+ *this,
m_name_atv);
- if(equalsIgnoreCase(piName, DOMString("xml")))
+ if(equalsIgnoreCase(piName, XALAN_STATIC_UCODE_STRING("xml")))
{
error("processing-instruction name can not be 'xml'");
}
@@ -146,21 +140,19 @@
error("processing-instruction name must be a valid NCName: " + piName);
}
- const DOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
executionContext.processingInstruction(toCharArray(piName), toCharArray(data));
}
-NodeImpl*
-ElemPI::appendChild(NodeImpl* newChild)
+bool
+ElemPI::childTypeAllowed(int xslToken) const
{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
-
- switch(type)
+ bool fResult = false;
+
+ switch(xslToken)
{
// char-instructions
case Constants::ELEMNAME_TEXTLITERALRESULT:
@@ -177,20 +169,12 @@
case Constants::ELEMNAME_COPY:
case Constants::ELEMNAME_VARIABLE:
case Constants::ELEMNAME_MESSAGE:
-
-// instructions
-// case Constants.ELEMNAME_PI:
-// case Constants.ELEMNAME_COMMENT:
-// case Constants.ELEMNAME_ELEMENT:
-// case Constants.ELEMNAME_ATTRIBUTE:
- break;
-
+ fResult = true;
+ break;
+
default:
- error("Can not add " +
- dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() +
- " to " +
- getTagName());
+ break;
}
-
- return ElemTemplateElement::appendChild(newChild);
+
+ return fResult;
}
1.4 +7 -11 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemPI.hpp 2000/02/29 20:54:21 1.3
+++ ElemPI.hpp 2000/04/11 15:09:25 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMPI_HEADER_GUARD
/**
- * $Id: ElemPI.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
+ * $Id: ElemPI.hpp,v 1.4 2000/04/11 15:09:25 dbertoni Exp $
*
* $State: Exp $
*
@@ -102,22 +102,18 @@
~ElemPI();
// These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
- /**
- * Add a child to the child list.
- */
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+protected:
+
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
1.3 +4 -11 xml-xalan/c/src/XSLT/ElemParam.cpp
Index: ElemParam.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemParam.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemParam.cpp 2000/01/26 14:26:58 1.2
+++ ElemParam.cpp 2000/04/11 15:09:26 1.3
@@ -78,25 +78,18 @@
name,
atts,
lineNumber,
- columnNumber)
+ columnNumber,
+ Constants::ELEMNAME_PARAMVARIABLE)
{
}
-int
-ElemParam::getXSLToken() const
-{
- return Constants::ELEMNAME_PARAMVARIABLE;
-}
-
-
-
void
ElemParam::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
const XObject* const obj = executionContext.getParamVariable(m_qname);
1.4 +3 -14 xml-xalan/c/src/XSLT/ElemParam.hpp
Index: ElemParam.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemParam.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemParam.hpp 2000/02/29 20:54:21 1.3
+++ ElemParam.hpp 2000/04/11 15:09:26 1.4
@@ -57,16 +57,8 @@
#if !defined(XALAN_ELEMPARAM_HEADER_GUARD)
#define XALAN_ELEMPARAM_HEADER_GUARD
-/**
- * $Id: ElemParam.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
-
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -94,21 +86,18 @@
ElemParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
// These methods are inherited from ElemVariable ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
};
1.3 +17 -30 xml-xalan/c/src/XSLT/ElemSort.cpp
Index: ElemSort.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemSort.cpp 2000/01/26 14:26:58 1.2
+++ ElemSort.cpp 2000/04/11 15:09:26 1.3
@@ -74,43 +74,48 @@
ElemSort::ElemSort(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
- ElemTemplateElement(constructionContext, stylesheetTree, name, lineNumber, columnNumber),
+ ElemTemplateElement(constructionContext,
+ stylesheetTree,
+ name,
+ lineNumber,
+ columnNumber,
+ Constants::ELEMNAME_SORT),
m_selectPattern(0),
m_langAVT(),
- m_dataTypeAVT("text"),
- m_orderAVT("ascending"),
+ m_dataTypeAVT(XALAN_STATIC_UCODE_STRING("text")),
+ m_orderAVT(XALAN_STATIC_UCODE_STRING("ascending")),
m_caseOrderAVT()
{
const int nAttrs = atts.getLength();
for(int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- if(equals(aname,Constants::ATTRNAME_SELECT))
+ if(equals(aname, Constants::ATTRNAME_SELECT))
{
m_selectPattern
= constructionContext.createXPath(atts.getValue(i), *this);
}
- else if(equals(aname,Constants::ATTRNAME_LANG))
+ else if(equals(aname, Constants::ATTRNAME_LANG))
{
m_langAVT = atts.getValue(i);
}
- else if(equals(aname,Constants::ATTRNAME_DATATYPE))
+ else if(equals(aname, Constants::ATTRNAME_DATATYPE))
{
m_dataTypeAVT = atts.getValue(i);
}
- else if(equals(aname,Constants::ATTRNAME_ORDER))
+ else if(equals(aname, Constants::ATTRNAME_ORDER))
{
m_orderAVT = atts.getValue(i);
}
- else if(equals(aname,Constants::ATTRNAME_CASEORDER))
+ else if(equals(aname, Constants::ATTRNAME_CASEORDER))
{
- constructionContext.warn("XSL4C does not yet handle the " + Constants::ATTRNAME_CASEORDER + " attribute!");
+ constructionContext.warn("Xalan C++ does not yet handle the " + Constants::ATTRNAME_CASEORDER + " attribute!");
m_caseOrderAVT = atts.getValue(i);
}
@@ -122,24 +127,6 @@
if(0 == m_selectPattern)
{
- m_selectPattern = constructionContext.createXPath(DOMString("."), *this);
+ m_selectPattern = constructionContext.createXPath(XalanDOMString(XALAN_STATIC_UCODE_STRING(".")), *this);
}
-}
-
-
-
-int
-ElemSort::getXSLToken() const
-{
- return Constants::ELEMNAME_SORT;
-}
-
-
-
-NodeImpl*
-ElemSort::appendChild(NodeImpl* newChild)
-{
- error("Can not add " + dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() + " to " + this->getTagName());
-
- return 0;
}
1.4 +10 -18 xml-xalan/c/src/XSLT/ElemSort.hpp
Index: ElemSort.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemSort.hpp 2000/02/29 20:54:21 1.3
+++ ElemSort.hpp 2000/04/11 15:09:26 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMSORT_HEADER_GUARD
/**
- * $Id: ElemSort.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
+ * $Id: ElemSort.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -75,7 +75,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -100,7 +100,7 @@
ElemSort(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -110,7 +110,7 @@
*
* @return string corresponding the language AVT
*/
- const DOMString&
+ const XalanDOMString&
getLangAVT() const
{
return m_langAVT;
@@ -121,7 +121,7 @@
*
* @return string corresponding the order AVT
*/
- const DOMString&
+ const XalanDOMString&
getOrderAVT() const
{
return m_orderAVT;
@@ -132,7 +132,7 @@
*
* @return string corresponding the data type AVT
*/
- const DOMString&
+ const XalanDOMString&
getDataTypeAVT() const
{
return m_dataTypeAVT;
@@ -149,22 +149,14 @@
return m_selectPattern;
}
- // These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
-
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
-
private:
const XPath* m_selectPattern;
- DOMString m_langAVT;
- DOMString m_dataTypeAVT;
- DOMString m_orderAVT;
- DOMString m_caseOrderAVT;
+ XalanDOMString m_langAVT;
+ XalanDOMString m_dataTypeAVT;
+ XalanDOMString m_orderAVT;
+ XalanDOMString m_caseOrderAVT;
};
1.4 +15 -21 xml-xalan/c/src/XSLT/ElemTemplate.cpp
Index: ElemTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemTemplate.cpp 2000/03/07 16:20:04 1.3
+++ ElemTemplate.cpp 2000/04/11 15:09:26 1.4
@@ -76,7 +76,7 @@
ElemTemplate::ElemTemplate(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -84,19 +84,21 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
- m_matchPattern(0),
- m_name(),
- m_mode(),
- m_priority(XPath::s_MatchScoreNone)
+ columnNumber,
+ Constants::ELEMNAME_TEMPLATE),
+ m_matchPattern(0),
+ m_name(),
+ m_mode(),
+ m_priority(XPath::s_MatchScoreNone)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -110,7 +112,7 @@
case Constants::TATTRNAME_PRIORITY:
{
- const DOMString priorityVal = atts.getValue(i);
+ const XalanDOMString priorityVal = atts.getValue(i);
m_priority = DOMStringToDouble(priorityVal);
}
break;
@@ -145,19 +147,11 @@
-int
-ElemTemplate::getXSLToken() const
-{
- return Constants::ELEMNAME_TEMPLATE;
-}
-
-
-
void
ElemTemplate::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
1.4 +7 -9 xml-xalan/c/src/XSLT/ElemTemplate.hpp
Index: ElemTemplate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemTemplate.hpp 2000/02/29 20:54:21 1.3
+++ ElemTemplate.hpp 2000/04/11 15:09:26 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMTEMPLATE_HEADER_GUARD
/**
- * $Id: ElemTemplate.hpp,v 1.3 2000/02/29 20:54:21 jdonohue Exp $
+ * $Id: ElemTemplate.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -73,7 +73,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -102,7 +102,7 @@
ElemTemplate(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -156,13 +156,11 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
- virtual void execute(
+ virtual void
+ execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
1.11 +876 -554 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ElemTemplateElement.cpp 2000/03/22 20:16:59 1.10
+++ ElemTemplateElement.cpp 2000/04/11 15:09:26 1.11
@@ -66,15 +66,27 @@
#include <sax/SAXException.hpp>
+
+#include <XalanDOM/XalanAttr.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanDOMException.hpp>
+
+
+
#include <PlatformSupport/AttributeListImpl.hpp>
#include <PlatformSupport/DOMStringPrintWriter.hpp>
+
+
#include <XMLSupport/FormatterToText.hpp>
+
+
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/XPath.hpp>
+
#include "Constants.hpp"
#include "ElemForEach.hpp"
#include "ElemSort.hpp"
@@ -98,160 +110,50 @@
* @exception SAXException Never.
*/
ElemTemplateElement::ElemTemplateElement(
- StylesheetConstructionContext& /* constructionContext */,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- int lineNumber,
- int columnNumber) :
- UnimplementedElement(&stylesheetTree),
- PrefixResolver(),
- m_stylesheet(stylesheetTree),
- m_lineNumber(lineNumber),
- m_columnNumber(columnNumber),
- m_defaultSpace(true),
- m_finishedConstruction(false),
- m_namespaces(m_stylesheet.getCurrentNamespace()),
- m_elemName(name),
- m_parentNode(0),
- m_nextSibling(0),
- m_firstChild(0)
-{
-}
-
-
-ElemTemplateElement::~ElemTemplateElement()
-{
-}
-
-
-NodeImpl* ElemTemplateElement::getParentNode()
-{
- return m_parentNode;
-}
-
-
-void ElemTemplateElement::setParentNode(NodeImpl* elem)
-{
- assert(!elem || dynamic_cast<ElemTemplateElement *>(elem));
- m_parentNode = dynamic_cast<ElemTemplateElement *>(elem);
-}
-
-
-NodeImpl* ElemTemplateElement::getNextSibling()
-{
- return m_nextSibling;
-}
-
-
-void ElemTemplateElement::setNextSibling(NodeImpl* elem)
-{
- assert(!elem || dynamic_cast<ElemTemplateElement *>(elem));
- m_nextSibling = dynamic_cast<ElemTemplateElement *>(elem);
-}
-
-
-
-ElemTemplateElement*
-ElemTemplateElement::getFirstChild() const
-{
- return m_firstChild;
-}
-
-
-
-ElemTemplateElement*
-ElemTemplateElement::getNextSibling() const
-{
- return m_nextSibling;
-}
-
-
-
-ElemTemplateElement*
-ElemTemplateElement::getParentNode() const
-{
- return m_parentNode;
-}
-
-
-
-DOMString
-ElemTemplateElement::getTagName()
-{
- return m_elemName;
-}
-
-
-
-DOMString
-ElemTemplateElement::getNodeName()
+ StylesheetConstructionContext& /* constructionContext */,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ int lineNumber,
+ int columnNumber,
+ int xslToken) :
+ XalanElement(),
+ PrefixResolver(),
+ m_stylesheet(stylesheetTree),
+ m_lineNumber(lineNumber),
+ m_columnNumber(columnNumber),
+ m_defaultSpace(true),
+ m_finishedConstruction(false),
+ m_namespaces(m_stylesheet.getCurrentNamespace()),
+ m_elemName(name),
+ m_xslToken(xslToken),
+ m_parentNode(0),
+ m_nextSibling(0),
+ m_previousSibling(0),
+ m_firstChild(0),
+ m_surrogateChildren(*this)
{
- return m_elemName;
}
-DOMString
-ElemTemplateElement::getNamespaceForPrefix(const DOMString& prefix) const
+ElemTemplateElement::~ElemTemplateElement()
{
- DOMString nameSpace;
- if(m_finishedConstruction == true)
- {
- if(!isEmpty(prefix))
- {
- ElemTemplateElement* elem = const_cast<ElemTemplateElement *>(this);
- while(isEmpty(nameSpace) && elem != 0)
- {
- NamespaceVectorType nsVector = elem->getNameSpace();
- nameSpace = QName::getNamespaceForPrefix(nsVector, prefix);
- if (! isEmpty(nameSpace)) break;
- assert(elem);
- assert(dynamic_cast<ElemTemplateElement *>(elem->getParentNode()));
- elem = dynamic_cast<ElemTemplateElement *>(elem->getParentNode());
- }
- }
- else
- {
- nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
- }
- }
- else
- {
- nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
- }
- if(isEmpty(nameSpace))
- error("Can not resolve namespace prefix: "+prefix);
- return nameSpace;
-}
-
-
+ delete m_nextSibling;
-DOMString
-ElemTemplateElement::getURI() const
-{
- return getStylesheet().getBaseIdentifier();
+ delete m_firstChild;
}
-/**
- * See if this is a xmlns attribute, and, if so, process it.
- *
- * @param attrName Qualified name of attribute.
- * @param atts The attribute list where the element comes from (not used at
- * this time).
- * @param which The index into the attribute list (not used at this time).
- * @return True if this is a namespace name.
- */
bool
ElemTemplateElement::isAttrOK(
int tok,
- const DOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& /* atts */,
int /* which */) const
{
bool isXMLNS = (Constants::TATTRNAME_XMLNSDEF == tok)
- || startsWith(attrName,Constants::ATTRNAME_XMLNS);
+ || startsWith(attrName, Constants::ATTRNAME_XMLNS);
// TODO: Well, process it...
@@ -259,18 +161,10 @@
}
-/**
- * See if this is a xmlns attribute, and, if so, process it.
- *
- * @param attrName Qualified name of attribute.
- * @param atts The attribute list where the element comes from (not used at
- * this time).
- * @param which The index into the attribute list (not used at this time).
- * @return True if this is a namespace name.
- */
+
bool
ElemTemplateElement::isAttrOK(
- const DOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
int which,
StylesheetConstructionContext& constructionContext) const
@@ -278,62 +172,53 @@
return m_stylesheet.isAttrOK(attrName, atts, which, constructionContext);
}
-/**
- * Tell whether or not this is a xml:space attribute and, if so, process it.
- *
- * @param aname The name of the attribute in question.
- * @param atts The attribute list that owns the attribute.
- * @param which The index of the attribute into the attribute list.
- * @return True if this is a xml:space attribute.
- */
-void ElemTemplateElement::processSpaceAttr(const AttributeList& atts, int which)
+
+void
+ElemTemplateElement::processSpaceAttr(
+ const AttributeList& atts,
+ int which)
{
- const DOMString spaceVal = atts.getValue(which);
+ const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, "default") == true)
+ if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")) == true)
{
m_defaultSpace = true;
}
- else if(equals(spaceVal, "preserve") == true)
+ else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")) == true)
{
m_defaultSpace = false;
}
else
{
- error("xml:space has an illegal value: " + spaceVal);
+ error(XalanDOMString("xml:space has an illegal value: ") + spaceVal);
}
}
-/**
- * Tell whether or not this is a xml:space attribute and, if so, process it.
- *
- * @param aname The name of the attribute in question.
- * @param atts The attribute list that owns the attribute.
- * @param which The index of the attribute into the attribute list.
- * @return True if this is a xml:space attribute.
- */
-bool ElemTemplateElement::processSpaceAttr(const DOMString& aname,
- const AttributeList& atts, int which)
+bool
+ElemTemplateElement::processSpaceAttr(
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which)
{
- const bool isSpaceAttr = equals(aname, "xml:space");
+ const bool isSpaceAttr = equals(aname, XALAN_STATIC_UCODE_STRING("xml:space"));
if(isSpaceAttr == true)
{
- const DOMString spaceVal = atts.getValue(which);
+ const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, "default"))
+ if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")))
{
m_defaultSpace = true;
}
- else if(equals(spaceVal, "preserve") == true)
+ else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")) == true)
{
m_defaultSpace = false;
}
else
{
- error("xml:space has an illegal value: " + spaceVal);
+ error(XalanDOMString("xml:space has an illegal value: ") + spaceVal);
}
}
@@ -342,28 +227,24 @@
-/**
- * Validate that the string is an NCName.
- *
- * @param s The name in question.
- * @return True if the string is a valid NCName according to XML rules.
- * @see http://www.w3.org/TR/REC-xml-names#NT-NCName
- */
-bool ElemTemplateElement::isValidNCName(const DOMString& s)
+bool
+ElemTemplateElement::isValidNCName(const XalanDOMString& s)
{
- int len = length(s);
- XMLCh c = charAt(s,0);
+ const unsigned int len = length(s);
+ XalanDOMChar c = charAt(s,0);
+
if(!(isLetterOrDigit(c) || (c == '_')))
return false;
if(len > 0)
{
- for(int i = 1; i < len; i++)
- {
- c = charAt(s,i);
- if(!(isLetterOrDigit(c) || (c == '_') || (c == '-') || (c == '.')))
- return false;
+ for(unsigned int i = 1; i < len; i++)
+ {
+ c = charAt(s,i);
+
+ if(!(isLetterOrDigit(c) || (c == '_') || (c == '-') || (c == '.')))
+ return false;
}
}
@@ -371,21 +252,13 @@
}
-/** Execute the element's primary function. Subclasses of this
- * function may recursivly execute down the element tree.
- *
- * @exception XSLProcessorException
- * @exception java.net.MalformedURLException
- * @exception java.io.FileNotFoundException
- * @exception java.io.IOException
- * @exception SAXException
- * @param processor The XSLT Processor.
- * @param sourceTree The input source tree.
- * @param sourceNode The current context node.
- * @param mode The current mode.
- */
-void ElemTemplateElement::execute(StylesheetExecutionContext& executionContext, const DOM_Node& sourceTree,
- const DOM_Node& sourceNode, const QName& mode) const
+
+void
+ElemTemplateElement::execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const
{
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
@@ -395,26 +268,13 @@
}
-/**
- * Process the children of a template.
- *
- * @param processor The XSLT processor instance.
- * @param sourceTree The input source tree.
- * @param sourceNode The current context node.
- * @param mode The current mode.
- * @exception XSLProcessorException Thrown from one of the child execute
- * methods.
- * @exception java.net.MalformedURLException Might be thrown from the
- * document() function, or from xsl:include or xsl:import.
- * @exception java.io.FileNotFoundException Might be thrown from the
- * document() function, or from xsl:include or xsl:import.
- * @exception java.io.IOException Might be thrown from the document()
- * function, or from xsl:include or xsl:import.
- * @exception SAXException Might be thrown from the document() function, or
- * from xsl:include or xsl:import.
- */
-void ElemTemplateElement::executeChildren(StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree, const DOM_Node& sourceNode, const QName& mode) const
+
+void
+ElemTemplateElement::executeChildren(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const
{
for (ElemTemplateElement* node = m_firstChild; node != 0; node = node->m_nextSibling)
{
@@ -423,28 +283,13 @@
}
-/**
- * Take the contents of a template element, process it, and
- * convert it to a string.
- *
- * @exception XSLProcessorException Thrown from one of the child execute
- * methods.
- * @exception java.net.MalformedURLException Might be thrown from the
- * document() function, or from xsl:include or xsl:import.
- * @exception java.io.FileNotFoundException Might be thrown from the
- * document() function, or from xsl:include or xsl:import.
- * @exception java.io.IOException Might be thrown from the document()
- * function, or from xsl:include or xsl:import.
- * @exception SAXException Might be thrown from the document() function, or
- * from xsl:include or xsl:import.
- * @param processor The XSLT processor instance.
- * @param sourceTree The primary source tree.
- * @param sourceNode The current source node context.
- * @param mode The current mode.
- * @return The stringized result of executing the elements children.
- */
-DOMString ElemTemplateElement::childrenToString(StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree, const DOM_Node& sourceNode, const QName& mode) const
+
+XalanDOMString
+ElemTemplateElement::childrenToString(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const
{
FormatterListener* const savedFListener = executionContext.getFormatterListener();
@@ -456,11 +301,11 @@
{
executionContext.setFormatterListener(&theFormatter);
- const DOMString savedPendingName = executionContext.getPendingElementName();
+ const XalanDOMString savedPendingName = executionContext.getPendingElementName();
try
{
- executionContext.setPendingElementName(DOMString());
+ executionContext.setPendingElementName(XalanDOMString());
const AttributeListImpl savedPendingAttributes(executionContext.getPendingAttributes());
@@ -502,197 +347,388 @@
-/**
- * Perform a query if needed, and call transformChild for each child.
- *
- * @param stylesheetTree The owning stylesheet tree.
- * @param xslInstruction The stylesheet element context (deprecated -- I do
- * not think we need this).
- * @param template The owning template context.
- * @param sourceTree The input source tree.
- * @param sourceNodeContext The current source node context.
- * @param mode The current mode.
- * @param selectPattern The XPath with which to perform the selection.
- * @param xslToken The current XSLT instruction (deprecated -- I do not
- * think we want this).
- */
-void
-ElemTemplateElement::transformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const Stylesheet& stylesheetTree,
- const ElemTemplateElement& xslInstruction, // xsl:apply-templates or xsl:for-each
- const ElemTemplateElement* theTemplate, // The template to copy to the result tree
- const DOM_Node& /*sourceTree*/,
- const DOM_Node& sourceNodeContext,
- const QName& mode,
- const XPath* selectPattern,
- int xslToken) const
+ElemTemplateElement*
+ElemTemplateElement::getFirstChildElem() const
{
- // Sort the nodes according to the xsl:sort method
- int tok = xslInstruction.getXSLToken();
-
- std::vector<NodeSortKey> keys;
-
- if((Constants::ELEMNAME_APPLY_TEMPLATES == tok) ||
- (Constants::ELEMNAME_FOREACH == tok))
- {
- const ElemForEach* foreach = static_cast<const ElemForEach *>(&xslInstruction);
- int nChildren = foreach->getSortElems().size();
-
- // March backwards, performing a sort on each xsl:sort child.
- // Probably not the most efficient method.
- for(int i = 0; i < nChildren; i++)
- {
- ElemSort* sort = (foreach->getSortElems())[i];
-
- const DOMString langString = (!isEmpty(sort->getLangAVT())) ?
- executionContext.evaluateAttrVal(sourceNodeContext, DOM_UnimplementedElement(sort), sort->getLangAVT()): DOMString();
+ return m_firstChild;
+}
- const DOMString dataTypeString = executionContext.evaluateAttrVal(sourceNodeContext, DOM_UnimplementedElement(sort), sort->getDataTypeAVT());
- bool treatAsNumbers = ((!isEmpty(dataTypeString)) && equals(dataTypeString,Constants::ATTRVAL_DATATYPE_NUMBER)) ?
- true : false;
- const DOMString orderString = executionContext.evaluateAttrVal(sourceNodeContext, DOM_UnimplementedElement(sort), sort->getOrderAVT());
+void
+ElemTemplateElement::setFirstChildElem(ElemTemplateElement* theElement)
+{
+ m_firstChild = theElement;
+}
- bool descending = ((!isEmpty(orderString)) && equals(orderString,Constants::ATTRVAL_ORDER_DESCENDING))?
- true : false;
- assert(sort->getSelectPattern() != 0);
- NodeSortKey key(executionContext,
- *sort->getSelectPattern(),
- treatAsNumbers,
- descending,
- langString,
- xslInstruction);
+ElemTemplateElement*
+ElemTemplateElement::getLastChildElem() const
+{
+ ElemTemplateElement* lastChild = 0;
- keys.push_back(key);
- }
+ for (ElemTemplateElement* node = m_firstChild; node != 0; node = node->m_nextSibling)
+ {
+ lastChild = node;
}
-
- MutableNodeRefList sourceNodes;
- if (0 != selectPattern)
- {
- XObject* const result = selectPattern->execute(
- sourceNodeContext,
- xslInstruction,
- executionContext.getXPathExecutionContext());
+ return lastChild;
+}
- sourceNodes = result->mutableNodeset();
-
- if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
- {
- getStylesheet().getStylesheetRoot().fireSelectedEvent(
- SelectionEvent(executionContext,
- sourceNodeContext,
- *this,
- "select",
- *selectPattern,
- result));
- }
- }
- else if (keys.size() > 0)
- {
- sourceNodes = sourceNodeContext.getChildNodes();
- }
- const int nNodes = sourceNodes.getLength();
- if(nNodes > 0)
- {
- if (keys.size() > 0)
- {
- NodeSorter sorter(executionContext.getXPathExecutionContext());
+ElemTemplateElement*
+ElemTemplateElement::getNextSiblingElem() const
+{
+ return m_nextSibling;
+}
- sorter.sort(sourceNodes, keys);
- }
- const MutableNodeRefList savedContextNodeList(executionContext.getContextNodeList());
- executionContext.setContextNodeList(sourceNodes);
+void
+ElemTemplateElement::setNextSiblingElem(ElemTemplateElement* theSibling)
+{
+ m_nextSibling = theSibling;
+}
- try
- {
- if(executionContext.isTraceSelect())
- executionContext.traceSelect(
- DOM_UnimplementedElement(const_cast<ElemTemplateElement*>(&xslInstruction)),
- sourceNodes);
- for(int i = 0; i < nNodes; i++)
- {
- const DOM_Node childNode = sourceNodes.item(i);
-
- DOM_Document ownerDoc = childNode.getOwnerDocument();
- if((DOM_Node::DOCUMENT_NODE != childNode.getNodeType()) && (ownerDoc == 0))
- {
- error(DOMString("Child node does not have an owner document!"));
- }
- transformChild(
- executionContext,
- stylesheetTree,
- &xslInstruction,
- theTemplate,
- ownerDoc,
- sourceNodeContext,
- childNode,
- mode,
- xslToken);
- }
- }
- catch(...)
- {
- executionContext.setContextNodeList(savedContextNodeList);
+ElemTemplateElement*
+ElemTemplateElement::getPreviousSiblingElem() const
+{
+ return m_previousSibling;
+}
- throw;
- }
- executionContext.setContextNodeList(savedContextNodeList);
- }
+void
+ElemTemplateElement::setPreviousSiblingElem(ElemTemplateElement* theSibling)
+{
+ m_previousSibling = theSibling;
}
-/**
- * Given an element and mode, find the corresponding
- * template and process the contents.
- *
- * @param stylesheetTree The current Stylesheet object.
- * @param xslInstruction The calling element (deprecated -- I dont think we
- * need this).
- * @param template The template to use if xsl:for-each, or null.
- * @param sourceTree The source DOM tree.
- * @param selectContext The selection context.
- * @param child The source context node.
- * @param mode The current mode, may be null.
- * @param xslToken ELEMNAME_APPLY_TEMPLATES, ELEMNAME_APPLY_IMPORTS, or
- * ELEMNAME_FOREACH.
- * @return true if applied a template, false if not.
- */
-bool
-ElemTemplateElement::transformChild(
- StylesheetExecutionContext& executionContext,
- const Stylesheet& stylesheet_tree,
- const ElemTemplateElement* xslInstruction, // xsl:apply-templates or xsl:for-each
- const ElemTemplateElement* theTemplate, // may be null
- const DOM_Node& /*sourceTree*/,
- const DOM_Node& selectContext,
- const DOM_Node& child,
- const QName& mode,
- int xslToken) const
+
+
+ElemTemplateElement*
+ElemTemplateElement::getParentNodeElem() const
{
- bool doApplyTemplate = true; // return value
- bool shouldStrip = false;
+ return m_parentNode;
+}
- const int nodeType = child.getNodeType();
- const DOM_Node sourceTree = (DOM_Node::DOCUMENT_NODE == nodeType) ? child :
- child.getOwnerDocument();
- const Stylesheet* stylesheetTree = &stylesheet_tree;
- bool isApplyImports = xslToken == Constants::ELEMNAME_APPLY_IMPORTS;
+void
+ElemTemplateElement::setParentNodeElem(ElemTemplateElement* theParent)
+{
+ m_parentNode = theParent;
+}
+
+
+ElemTemplateElement*
+ElemTemplateElement::appendChildElem(ElemTemplateElement* newChild)
+{
+ assert(newChild != 0);
+
+ if (childTypeAllowed(newChild->getXSLToken()) == false)
+ {
+ throw XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
+ }
+ else if(0 == m_firstChild)
+ {
+ m_firstChild = newChild;
+
+ newChild->setPreviousSiblingElem(0);
+ }
+ else
+ {
+ ElemTemplateElement* const last = getLastChildElem();
+ assert(last != 0);
+
+ last->setNextSiblingElem(newChild);
+
+ newChild->setPreviousSiblingElem(last);
+ }
+
+ newChild->setParentNodeElem(this);
+ newChild->setNextSiblingElem(0);
+
+ return newChild;
+}
+
+
+
+ElemTemplateElement*
+ElemTemplateElement::insertBeforeElem(
+ ElemTemplateElement* newChild,
+ ElemTemplateElement* refChild)
+{
+ assert(newChild != 0);
+
+ if (refChild != 0 && refChild->getParentNode() != this)
+ {
+ throw XalanDOMException(XalanDOMException::NOT_FOUND_ERR);
+ }
+ else if (newChild->getOwnerDocument() != getOwnerDocument())
+ {
+ throw XalanDOMException(XalanDOMException::WRONG_DOCUMENT_ERR);
+ }
+
+ if (refChild == 0)
+ {
+ appendChildElem(newChild);
+ }
+ else
+ {
+ ElemTemplateElement* const previousChild =
+ refChild->getPreviousSiblingElem();
+
+ if (previousChild != 0)
+ {
+ previousChild->setNextSiblingElem(newChild);
+ }
+ else
+ {
+ assert(m_firstChild == refChild);
+
+ // The old child was the first child,
+ // so update m_firstChild...
+ m_firstChild = newChild;
+ }
+
+ newChild->setPreviousSiblingElem(previousChild);
+ newChild->setNextSiblingElem(refChild);
+
+ refChild->setPreviousSiblingElem(newChild);
+
+ if (refChild == m_firstChild)
+ {
+ m_firstChild = newChild;
+ }
+ }
+
+ return newChild;
+}
+
+
+
+ElemTemplateElement*
+ElemTemplateElement::replaceChildElem(
+ ElemTemplateElement* newChild,
+ ElemTemplateElement* oldChild)
+{
+ assert(newChild != 0);
+ assert(oldChild != 0);
+
+ if (oldChild->getParentNode() != this)
+ {
+ throw XalanDOMException(XalanDOMException::NOT_FOUND_ERR);
+ }
+ else if (newChild->getOwnerDocument() != getOwnerDocument())
+ {
+ throw XalanDOMException(XalanDOMException::WRONG_DOCUMENT_ERR);
+ }
+
+ ElemTemplateElement* const previousChild =
+ oldChild->getPreviousSiblingElem();
+
+ if (previousChild != 0)
+ {
+ previousChild->setNextSiblingElem(newChild);
+ }
+ else
+ {
+ assert(m_firstChild == oldChild);
+
+ // The old child was the first child,
+ // so update m_firstChild...
+ m_firstChild = newChild;
+ }
+
+ newChild->setPreviousSiblingElem(previousChild);
+
+ ElemTemplateElement* const nextChild =
+ oldChild->getNextSiblingElem();
+
+ newChild->setNextSiblingElem(nextChild);
+
+ if (nextChild != 0)
+ {
+ nextChild->setPreviousSiblingElem(newChild);
+ }
+
+ oldChild->setParentNodeElem(0);
+ oldChild->setPreviousSiblingElem(0);
+ oldChild->setNextSiblingElem(0);
+
+ return oldChild;
+}
+
+
+
+void
+ElemTemplateElement::transformSelectedChildren(
+ StylesheetExecutionContext& executionContext,
+ const Stylesheet& stylesheetTree,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* /*sourceTree*/,
+ XalanNode* sourceNodeContext,
+ const QName& mode,
+ const XPath* selectPattern,
+ int xslToken) const
+{
+ // Sort the nodes according to the xsl:sort method
+ const int tok = xslInstruction.getXSLToken();
+
+ NodeSorter::NodeSortKeyVectorType keys;
+
+ if((Constants::ELEMNAME_APPLY_TEMPLATES == tok) ||
+ (Constants::ELEMNAME_FOREACH == tok))
+ {
+ const ElemForEach* foreach = static_cast<const ElemForEach *>(&xslInstruction);
+ int nChildren = foreach->getSortElems().size();
+
+ // March backwards, performing a sort on each xsl:sort child.
+ // Probably not the most efficient method.
+ for(int i = 0; i < nChildren; i++)
+ {
+ ElemSort* sort = foreach->getSortElems()[i];
+ assert(sort != 0);
+
+ const XalanDOMString langString = (!isEmpty(sort->getLangAVT())) ?
+ executionContext.evaluateAttrVal(sourceNodeContext, *sort, sort->getLangAVT()): XalanDOMString();
+
+ const XalanDOMString dataTypeString = executionContext.evaluateAttrVal(sourceNodeContext, *sort, sort->getDataTypeAVT());
+
+ bool treatAsNumbers = ((!isEmpty(dataTypeString)) && equals(dataTypeString,Constants::ATTRVAL_DATATYPE_NUMBER)) ?
+ true : false;
+
+ const XalanDOMString orderString = executionContext.evaluateAttrVal(sourceNodeContext, *sort, sort->getOrderAVT());
+
+ bool descending = ((!isEmpty(orderString)) && equals(orderString,Constants::ATTRVAL_ORDER_DESCENDING))?
+ true : false;
+
+ assert(sort->getSelectPattern() != 0);
+
+ NodeSortKey key(executionContext,
+ *sort->getSelectPattern(),
+ treatAsNumbers,
+ descending,
+ langString,
+ xslInstruction);
+
+ keys.push_back(key);
+ }
+ }
+
+ MutableNodeRefList sourceNodes;
+
+ if (0 != selectPattern)
+ {
+ XObject* const result = selectPattern->execute(
+ sourceNodeContext,
+ xslInstruction,
+ executionContext.getXPathExecutionContext());
+
+ sourceNodes = result->mutableNodeset();
+
+ if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
+ {
+ getStylesheet().getStylesheetRoot().fireSelectedEvent(
+ SelectionEvent(executionContext,
+ sourceNodeContext,
+ *this,
+ XALAN_STATIC_UCODE_STRING("select"),
+ *selectPattern,
+ result));
+ }
+ }
+ else if (keys.size() > 0)
+ {
+ sourceNodes = sourceNodeContext->getChildNodes();
+ }
+
+ const unsigned int nNodes = sourceNodes.getLength();
+
+ if(nNodes > 0)
+ {
+ if (keys.size() > 0)
+ {
+ NodeSorter sorter(executionContext.getXPathExecutionContext());
+
+ sorter.sort(sourceNodes, keys);
+ }
+
+ const MutableNodeRefList savedContextNodeList(executionContext.getContextNodeList());
+
+ executionContext.setContextNodeList(sourceNodes);
+
+ try
+ {
+ if(executionContext.isTraceSelect())
+ executionContext.traceSelect(
+ xslInstruction,
+ sourceNodes);
+
+ for(unsigned int i = 0; i < nNodes; i++)
+ {
+ XalanNode* childNode = sourceNodes.item(i);
+ assert(childNode != 0);
+
+ XalanDocument* const ownerDoc = childNode->getOwnerDocument();
+
+ if(XalanNode::DOCUMENT_NODE != childNode->getNodeType() && ownerDoc == 0)
+ {
+ error(XalanDOMString("Child node does not have an owner document!"));
+ }
+
+ transformChild(
+ executionContext,
+ stylesheetTree,
+ &xslInstruction,
+ theTemplate,
+ ownerDoc,
+ sourceNodeContext,
+ childNode,
+ mode,
+ xslToken);
+ }
+ }
+ catch(...)
+ {
+ executionContext.setContextNodeList(savedContextNodeList);
+
+ throw;
+ }
+
+ executionContext.setContextNodeList(savedContextNodeList);
+ }
+}
+
+
+
+bool
+ElemTemplateElement::transformChild(
+ StylesheetExecutionContext& executionContext,
+ const Stylesheet& stylesheet_tree,
+ const ElemTemplateElement* xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceTree,
+ XalanNode* selectContext,
+ XalanNode* child,
+ const QName& mode,
+ int xslToken) const
+{
+ bool doApplyTemplate = true;
+ bool shouldStrip = false;
+
+ const int nodeType = child->getNodeType();
+ const Stylesheet* stylesheetTree = &stylesheet_tree;
+
+ const bool isApplyImports = xslToken == Constants::ELEMNAME_APPLY_IMPORTS;
+
if(!shouldStrip) // rcw: odd, seems that shouldStripis always false
{
if(0 == theTemplate)
@@ -723,28 +759,31 @@
{
switch(nodeType)
{
- case DOM_Node::DOCUMENT_FRAGMENT_NODE:
- case DOM_Node::ELEMENT_NODE:
+ case XalanNode::DOCUMENT_FRAGMENT_NODE:
+ case XalanNode::ELEMENT_NODE:
theTemplate = getStylesheet().getStylesheetRoot().getDefaultRule();
break;
- case DOM_Node::CDATA_SECTION_NODE:
- case DOM_Node::TEXT_NODE:
- case DOM_Node::ATTRIBUTE_NODE:
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
+ case XalanNode::ATTRIBUTE_NODE:
theTemplate = getStylesheet().getStylesheetRoot().getDefaultTextRule();
break;
- case DOM_Node::DOCUMENT_NODE:
+ case XalanNode::DOCUMENT_NODE:
theTemplate = getStylesheet().getStylesheetRoot().getDefaultRootRule();
break;
- case DOM_Node::COMMENT_NODE:
- case DOM_Node::PROCESSING_INSTRUCTION_NODE:
+
+ case XalanNode::COMMENT_NODE:
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
break;
+
default:
assert(false);
break;
}
+
if(0 != theTemplate)
{
// Not sure if this is needed. -sb
@@ -760,20 +799,25 @@
{
switch(nodeType)
{
- case DOM_Node::CDATA_SECTION_NODE:
- case DOM_Node::TEXT_NODE:
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
executionContext.cloneToResultTree(
- child, false, false, false);
+ *child, false, false, false);
break;
- case DOM_Node::ATTRIBUTE_NODE:
+
+ case XalanNode::ATTRIBUTE_NODE:
{
//rcw: DOM_node has no virtual funcs so we can't do a dynamic_cast<>.
- const DOM_Attr& attr = static_cast<const DOM_Attr&>(child);
- DOMString val = attr.getValue();
+ const XalanAttr* const attr = static_cast<const XalanAttr*>(child);
+
+ const XalanDOMString val = attr->getValue();
+
executionContext.characters(toCharArray(val),
- 0, length(val));
+ 0,
+ length(val));
}
break;
+
default:
assert(false);
break;
@@ -785,25 +829,32 @@
if(doPush)
{
- executionContext.pushContextMarker(DOM_UnimplementedElement(const_cast<ElemTemplateElement*>(theTemplate)), child);
+ executionContext.pushContextMarker(theTemplate, child);
if (xslInstruction != 0)
{
executionContext.pushParams(*xslInstruction,
- sourceTree, selectContext, mode,
- DOM_UnimplementedElement(const_cast<ElemTemplateElement*>(theTemplate)));
+ sourceTree,
+ selectContext,
+ mode,
+ theTemplate);
}
}
if(0 != getStylesheet().getStylesheetRoot().getTraceListeners())
{
- TracerEvent te(executionContext, sourceTree, child,
- mode, *theTemplate);
+ TracerEvent te(executionContext,
+ sourceTree,
+ child,
+ mode,
+ *theTemplate);
getStylesheet().getStylesheetRoot().fireTraceEvent(te);
}
theTemplate->executeChildren(executionContext,
- sourceTree, child, mode);
+ sourceTree,
+ child,
+ mode);
if(doPush)
{
@@ -820,195 +871,466 @@
}
-/**
- * Throw a template element error.
- *
- * @param msg Description of the error that occured.
- */
-void ElemTemplateElement::error(const DOMString& msg) const
+void
+ElemTemplateElement::error(const XalanDOMString& msg) const
{
- DOMString errMsg("ElemTemplateElement error: " + msg);
+ XalanDOMString errMsg("ElemTemplateElement error: " + msg);
throw SAXException(toCharArray(errMsg));
}
+
+
+XalanDOMString
+ElemTemplateElement::getNodeName() const
+{
+ return m_elemName;
+}
+
+
+
+XalanDOMString
+ElemTemplateElement::getNodeValue() const
+{
+ return XalanDOMString();
+}
+
+
+
+ElemTemplateElement::NodeType
+ElemTemplateElement::getNodeType() const
+{
+ return XalanNode::ELEMENT_NODE;
+}
+
-NodeImpl*
-ElemTemplateElement::cloneNode(bool /*deep*/)
+
+XalanNode*
+ElemTemplateElement::getParentNode() const
{
+ return m_parentNode;
+}
+
+
+
+const XalanNodeList*
+ElemTemplateElement::getChildNodes() const
+{
+ return &m_surrogateChildren;
+}
+
+
+
+XalanNode*
+ElemTemplateElement::getFirstChild() const
+{
+ return m_firstChild;
+}
+
+
+
+XalanNode*
+ElemTemplateElement::getLastChild() const
+{
+ return getLastChildElem();
+}
+
+
+
+XalanNode*
+ElemTemplateElement::getPreviousSibling() const
+{
+ return m_previousSibling;
+}
+
+
+
+XalanNode*
+ElemTemplateElement::getNextSibling() const
+{
+ return m_nextSibling;
+}
+
+
+
+const XalanNamedNodeMap*
+ElemTemplateElement::getAttributes() const
+{
+ return 0;
+}
+
+
+
+XalanDocument*
+ElemTemplateElement::getOwnerDocument() const
+{
+ return &m_stylesheet;
+}
+
+
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XalanNode*
+#else
+ElemTemplateElement*
+#endif
+ElemTemplateElement::cloneNode(bool /* deep */) const
+{
//should not be called
assert(false);
+
return 0;
}
-// Implemented DOM Element methods.
+XalanNode*
+ElemTemplateElement::insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild)
+{
+#if defined(XALAN_OLD_STYLE_CASTS)
+ return insertBeforeElem((ElemTemplateElement*)newChild,
+ (ElemTemplateElement*)refChild);
+#else
+ return insertBeforeElem(dynamic_cast<ElemTemplateElement*>(newChild),
+ dynamic_cast<ElemTemplateElement*>(refChild));
+#endif
+}
-/**
- * Add a child to the child list.
- *
- * @exception DOMException
- * @param newChild
- */
-NodeImpl* ElemTemplateElement::appendChild(NodeImpl* newChild)
+
+
+XalanNode*
+ElemTemplateElement::replaceChild(
+ XalanNode* newChild,
+ XalanNode* oldChild)
{
- if(0 == newChild)
- {
- error("Trying to add a null child!");
- }
-
- NodeImpl* elem = newChild;
-
- if(0 == m_firstChild)
+#if defined(XALAN_OLD_STYLE_CASTS)
+ return replaceChildElem((ElemTemplateElement*)newChild,
+ (ElemTemplateElement*)oldChild);
+#else
+ return replaceChildElem(dynamic_cast<ElemTemplateElement*>(newChild),
+ dynamic_cast<ElemTemplateElement*>(oldChild));
+#endif
+}
+
+
+
+XalanNode*
+ElemTemplateElement::removeChild(XalanNode* oldChild)
+{
+ assert(oldChild != 0);
+
+ XalanNode* ret = 0;
+
+ // first try the common, easy cases
+ if (oldChild == 0 || oldChild->getParentNode() != this)
{
- assert(dynamic_cast<ElemTemplateElement*>(elem));
- m_firstChild = dynamic_cast<ElemTemplateElement*>(elem);
+ throw XalanDOMException(XalanDOMException::NOT_FOUND_ERR);
}
else
{
- assert(dynamic_cast<ElemTemplateElement*>(getLastChild()));
- ElemTemplateElement* last = dynamic_cast<ElemTemplateElement*>(getLastChild());
- assert(last != 0);
- last->setNextSibling(elem);
+ ElemTemplateElement* pTest = m_firstChild;
+ assert(pTest != 0);
+
+ if (pTest == oldChild)
+ {
+ ElemTemplateElement* const nextChild =
+ pTest->getNextSiblingElem();
+
+ if (nextChild != 0)
+ {
+ nextChild->setPreviousSiblingElem(0);
+ }
+
+ pTest->setNextSiblingElem(0);
+ m_firstChild = nextChild;
+
+ ret = pTest;
+ }
+ else
+ {
+ // now we walk this singly-linked list, peeling one ahead, since we need be
+ // able to patch up the list
+
+ while (pTest->getNextSibling() != 0 && pTest->getNextSibling() != oldChild)
+ pTest = pTest->getNextSiblingElem();
+
+ ret = pTest->getNextSibling();
+
+ if (pTest->getNextSibling() != 0)
+ pTest->setNextSiblingElem(pTest->getNextSiblingElem()->getNextSiblingElem());
+ }
}
-
- dynamic_cast<ElemTemplateElement*>(elem)->setParentNode(this);
-
- return newChild;
+
+ return ret;
}
-/*
- * Remove a node from the child list
- */
-NodeImpl* ElemTemplateElement::removeChild(NodeImpl *oldChild)
+XalanNode*
+ElemTemplateElement::appendChild(XalanNode* oldChild)
{
- if(0 == oldChild)
- {
- error("Trying to remove a null child!");
- }
+#if defined(XALAN_OLD_STYLE_CASTS)
+ return appendChildElem((ElemTemplateElement*)oldChild);
+#else
+ return appendChildElem(dynamic_cast<ElemTemplateElement*>(oldChild));
+#endif
+}
- NodeImpl *pTest = m_firstChild;
- // first try the common, easy cases
- if (pTest == 0)
- return 0;
- if (pTest == oldChild)
- {
- m_firstChild = 0;
- return pTest;
- }
+bool
+ElemTemplateElement::hasChildNodes() const
+{
+ return 0 != m_firstChild ? true : false;
+}
- // now we walk this singly-linked list, peeling one ahead, since we need be
- // able to patch up the list
- while (pTest->getNextSibling() != 0 && pTest->getNextSibling() != oldChild)
- pTest = pTest->getNextSibling();
- NodeImpl* ret = pTest->getNextSibling();
+void
+ElemTemplateElement::setNodeValue(const XalanDOMString& /* nodeValue */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
- if (pTest->getNextSibling() != 0)
- dynamic_cast<ElemTemplateElement*>(pTest)->setNextSibling(pTest->getNextSibling()->getNextSibling());
- return ret;
+
+void
+ElemTemplateElement::normalize()
+{
}
-/**
- * Tell if there are child nodes.
- */
-bool ElemTemplateElement::hasChildNodes()
+
+bool
+ElemTemplateElement::supports(
+ const XalanDOMString& /* feature */,
+ const XalanDOMString& /* version */) const
{
- return (0 != m_firstChild);
+ return false;
}
-
-/**
- * Get the type of the node.
- */
-short ElemTemplateElement::getNodeType()
+
+
+XalanDOMString
+ElemTemplateElement::getNamespaceURI() const
{
- return DOM_Node::ELEMENT_NODE;
+ // $$ ToDo: Is this the same value as PrefixResolver::getURI()?
+ return XalanDOMString();
}
-/** Return the nodelist (same reference).
- */
-NodeListImpl* ElemTemplateElement::getChildNodes()
+
+
+XalanDOMString
+ElemTemplateElement::getPrefix() const
{
- return this;
+ return XalanDOMString();
}
-
-/** Get the first child
- */
-NodeImpl* ElemTemplateElement::getFirstChild()
+
+
+XalanDOMString
+ElemTemplateElement::getLocalName() const
{
- return m_firstChild;
+ return XalanDOMString();
}
-/** Get the last child.
- */
-NodeImpl* ElemTemplateElement::getLastChild()
+
+void
+ElemTemplateElement::setPrefix(const XalanDOMString& /* prefix */)
{
- ElemTemplateElement* lastChild = 0;
- assert(!m_firstChild || dynamic_cast<ElemTemplateElement*>(m_firstChild));
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
- for (ElemTemplateElement* node = m_firstChild;
- node != 0; node = node->m_nextSibling)
- {
- assert(dynamic_cast<ElemTemplateElement*>(node));
- lastChild = node;
- }
- return lastChild;
+XalanDOMString
+ElemTemplateElement::getTagName() const
+{
+ return m_elemName;
}
-/**
- * NodeList method: Count the immediate children of this node
- *
- * @return int
- */
-unsigned int ElemTemplateElement::getLength()
+
+XalanDOMString
+ElemTemplateElement::getAttribute(const XalanDOMString& /* name */) const
{
- // It is assumed that the getChildNodes call synchronized
- // the children. Therefore, we can access the first child
- // reference directly.
- int count = 0;
+ return XalanDOMString();
+}
- for (ElemTemplateElement* node = m_firstChild; node != 0; node = node->m_nextSibling)
- {
- count++;
- }
- return count;
-}
+XalanAttr*
+ElemTemplateElement::getAttributeNode(const XalanDOMString& /* name */) const
+{
+ return 0;
+}
-/**
- * NodeList method: Return the Nth immediate child of this node, or
- * null if the index is out of bounds.
- *
- * @param index
- * @return org.w3c.dom.Node
- */
-NodeImpl* ElemTemplateElement::item(unsigned int index)
+
+
+XalanNodeList*
+ElemTemplateElement::getElementsByTagName(const XalanDOMString& /* name */) const
+{
+ return 0;
+}
+
+
+
+void
+ElemTemplateElement::setAttribute(
+ const XalanDOMString& /* name */,
+ const XalanDOMString& /* value */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+XalanAttr*
+ElemTemplateElement::setAttributeNode(XalanAttr* /* newAttr */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+
+ return 0;
+}
+
+
+
+XalanAttr*
+ElemTemplateElement::removeAttributeNode(XalanAttr* /* oldAttr */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+
+ return 0;
+}
+
+
+
+void
+ElemTemplateElement::removeAttribute(const XalanDOMString& /* name */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+XalanDOMString
+ElemTemplateElement::getAttributeNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
+{
+ return XalanDOMString();
+}
+
+
+
+void
+ElemTemplateElement::setAttributeNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* qualifiedName */,
+ const XalanDOMString& /* value */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+void
+ElemTemplateElement::removeAttributeNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+XalanAttr*
+ElemTemplateElement::getAttributeNodeNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
+{
+ return 0;
+}
+
+
+
+XalanAttr*
+ElemTemplateElement::setAttributeNodeNS(XalanAttr* /* newAttr */)
+{
+ return 0;
+
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+XalanNodeList*
+ElemTemplateElement::getElementsByTagNameNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
{
- // It is assumed that the getChildNodes call synchronized
- // the children. Therefore, we can access the first child
- // reference directly.
- ElemTemplateElement* node = m_firstChild;
+ return 0;
+}
+
+
+
+XalanDOMString
+ElemTemplateElement::getNamespaceForPrefix(const XalanDOMString& prefix) const
+{
+ XalanDOMString nameSpace;
+
+ if(m_finishedConstruction == true)
+ {
+ if(!isEmpty(prefix))
+ {
+ ElemTemplateElement* elem = const_cast<ElemTemplateElement *>(this);
+
+ while(isEmpty(nameSpace) && elem != 0)
+ {
+ const NamespaceVectorType& nsVector = elem->getNameSpace();
- for (unsigned int i = 0; i < index && node != 0; i++)
+ nameSpace = QName::getNamespaceForPrefix(nsVector, prefix);
+
+ if (!isEmpty(nameSpace))
+ break;
+
+ elem = elem->getParentNodeElem();
+ }
+ }
+ else
+ {
+ nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
+ }
+ }
+ else
{
- node = node->m_nextSibling;
+ nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
}
+
+ if(isEmpty(nameSpace))
+ {
+ error("Can not resolve namespace prefix: " + prefix);
+ }
+
+ return nameSpace;
+}
- return node;
+
+
+XalanDOMString
+ElemTemplateElement::getURI() const
+{
+ return getStylesheet().getBaseIdentifier();
+}
+
+
+
+bool
+ElemTemplateElement::childTypeAllowed(int /* xslToken */) const
+{
+ return true;
}
1.8 +315 -166 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemTemplateElement.hpp 2000/03/03 19:00:33 1.7
+++ ElemTemplateElement.hpp 2000/04/11 15:09:26 1.8
@@ -57,27 +57,23 @@
#if !defined(XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD)
#define XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD
-/**
- * $Id: ElemTemplateElement.hpp,v 1.7 2000/03/03 19:00:33 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com)
- */
+
// Base include file. Must be first.
-#include "XSLTDefinitions.hpp"
+#include <XSLT/XSLTDefinitions.hpp>
+
#include <vector>
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNodeListSurrogate.hpp>
-#include <DOMSupport/UnimplementedElement.hpp>
+
#include <XPath/PrefixResolver.hpp>
#include <XPath/NameSpace.hpp>
@@ -100,7 +96,7 @@
* @see class Stylesheet
*/
-class ElemTemplateElement : public UnimplementedElement, public PrefixResolver
+class ElemTemplateElement : public XalanElement, public PrefixResolver
{
public:
/**
@@ -112,13 +108,15 @@
* @param lineNumber line in the XSLT file where the element occurs
* @param columnNumber column index in the XSLT file where the
* element occurs
+ * @param xslToken an integer representing the type of instance.
*/
- ElemTemplateElement (
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const DOMString& name,
- int lineNumber,
- int columnNumber);
+ ElemTemplateElement(
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMString& name,
+ int lineNumber,
+ int columnNumber,
+ int xslToken);
virtual
~ElemTemplateElement();
@@ -132,9 +130,10 @@
* @param which index into the attribute list (not used at this time)
* @return true if this is a namespace name
*/
- bool isAttrOK(
+ bool
+ isAttrOK(
int tok,
- const DOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
int which) const;
@@ -149,7 +148,7 @@
*/
bool
isAttrOK(
- const DOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
int which,
StylesheetConstructionContext& constructionContext) const;
@@ -162,7 +161,10 @@
* @param which index of the attribute into the attribute list
* @return true if this is a xml:space attribute
*/
- void processSpaceAttr(const AttributeList& atts, int which);
+ void
+ processSpaceAttr(
+ const AttributeList& atts,
+ int which);
/**
* Tell whether or not this is a xml:space attribute and, if so, process it.
@@ -172,9 +174,11 @@
* @param which index of the attribute into the attribute list
* @return true if this is a xml:space attribute
*/
- bool processSpaceAttr(const DOMString& aname,
- const AttributeList& atts, int which);
-
+ bool
+ processSpaceAttr(
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which);
/**
* Validate that the string is an NCName.
@@ -183,7 +187,8 @@
* @return true if the string is a valid NCName according to XML rules
* @see http://www.w3.org/TR/REC-xml-names#NT-NCName
*/
- static bool isValidNCName(const DOMString& s);
+ static bool
+ isValidNCName(const XalanDOMString& s);
/**
* Execute the element's primary function. Subclasses of this function may
@@ -197,8 +202,8 @@
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
/**
@@ -212,8 +217,8 @@
void
executeChildren(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
/**
@@ -238,9 +243,12 @@
* @param mode current mode
* @return stringized result of executing the elements children
*/
- DOMString childrenToString(StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree, const DOM_Node& sourceNode,
- const QName& mode) const;
+ XalanDOMString
+ childrenToString(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const;
/**
@@ -250,7 +258,11 @@
* class
* @see class Constants
*/
- virtual int getXSLToken() const = 0;
+ int
+ getXSLToken() const
+ {
+ return m_xslToken;
+ }
/**
* Tell if the string is whitespace.
@@ -258,7 +270,8 @@
* @param string string in question
* @return true if the string is pure whitespace
*/
- static bool isWhiteSpace(const DOMString& theString);
+ static bool
+ isWhiteSpace(const XalanDOMString& theString);
/**
* Throw a template element runtime error.
@@ -266,7 +279,8 @@
*
* @param msg Description of the error that occurred
*/
- virtual void error(const DOMString& msg) const;
+ virtual void
+ error(const XalanDOMString& msg) const;
/**
* Get the line number where the element occurs in the xsl file.
@@ -293,7 +307,7 @@
#if defined(XALAN_NO_NAMESPACES)
typedef vector<NameSpace> NamespaceVectorType;
#else
- typedef std::vector<NameSpace> NamespaceVectorType;
+ typedef std::vector<NameSpace> NamespaceVectorType;
#endif
/**
@@ -329,167 +343,277 @@
m_finishedConstruction = bFinished;
}
-
- // These interfaces are inherited from PrefixResolver...
- virtual DOMString
- getNamespaceForPrefix(const DOMString& prefix) const;
+ // Type-safe getters/setters...
-
- virtual DOMString
- getURI() const;
-
-
- // These interfaces are inherited from UnimplementedElement ...
-
- /**
- * Add a child to the child list.
- *
- * @exception DOMException
- * @param newChild child node to add
- */
- virtual NodeImpl* appendChild(NodeImpl* newChild);
-
/**
- * Remove a node from the child list
- *
- * @param oldChild child node to remove
- */
- virtual NodeImpl* removeChild(NodeImpl *oldChild);
-
- /**
- * Tell if there are child nodes.
+ * Get the first child.
*
- * @return true if there are child nodes
+ * @return first child node of this node
*/
- virtual bool hasChildNodes();
+ virtual ElemTemplateElement*
+ getFirstChildElem() const;
/**
- * Get the type of the node.
- *
- * @return integer representation of the element type
+ * Set the first child.
+ *
+ * theChild - the new value for the first child.
+ *
+ * @return nothing
*/
- virtual short getNodeType();
+ virtual void
+ setFirstChildElem(ElemTemplateElement* theChild);
/**
- * Get the parent.
+ * Get the last child.
*
- * @return parent of this node
+ * @return last child node of this node
*/
- virtual NodeImpl* getParentNode();
+ virtual ElemTemplateElement*
+ getLastChildElem() const;
/**
- * Set the parent.
+ * Get the next sibling.
*
- * @param elem parent of this node
+ * @return next sibling node of this node
*/
- virtual void setParentNode(NodeImpl* elem);
+ virtual ElemTemplateElement*
+ getNextSiblingElem() const;
/**
- * Return the nodelist (same reference).
- *
- * @return list of child nodes
+ * Set the next sibling.
+ *
+ * theSibling - the new value for the next sibling.
+ *
+ * @return nothing
*/
- virtual NodeListImpl* getChildNodes();
+ virtual void
+ setNextSiblingElem(ElemTemplateElement* theSibling);
/**
- * Get the first child
+ * Get the previous sibling.
*
- * @return pointer to first child node
+ * @return previous sibling node of this node
*/
- virtual NodeImpl* getFirstChild();
+ virtual ElemTemplateElement*
+ getPreviousSiblingElem() const;
/**
- * Get the last child.
- *
- * @return pointer to last child node
+ * Set the previous sibling.
+ *
+ * theSibling - the new value for the previous sibling.
+ *
+ * @return nothing
*/
- virtual NodeImpl*getLastChild();
-
+ virtual void
+ setPreviousSiblingElem(ElemTemplateElement* theSibling);
/**
- * Get the next sibling or return null.
+ * Get the parent node.
*
- * @return pointer to next sibling node
+ * @return parent node of this node
*/
- virtual NodeImpl* getNextSibling();
+ virtual ElemTemplateElement*
+ getParentNodeElem() const;
/**
- * Set the next sibling.
+ * Set the parent node.
+ *
+ * theParent - the new value for the parent.
+ *
+ * @return nothing
*/
- virtual void setNextSibling(NodeImpl* elem);
+ virtual void
+ setParentNodeElem(ElemTemplateElement* theParent);
/**
- * Count the immediate children of this node.
- *
- * @return number of immediate children of this node
+ * Append a child.
+ *
+ * theParent - the new value for the parent.
+ *
+ * @return nothing
*/
- virtual unsigned int getLength();
-
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual NodeImpl*
-#else
virtual ElemTemplateElement*
-#endif
- cloneNode(bool deep);
-
- // Type-safe getters...
+ appendChildElem(ElemTemplateElement* newChild);
/**
- * Get the first child.
- *
- * @return first child node of this node
+ * Append a child.
+ *
+ * @param newChild the new child to insert
+ * @param refChild the node before which to insert the new node
+ *
+ * @return newChild
*/
virtual ElemTemplateElement*
- getFirstChild() const;
+ insertBeforeElem(
+ ElemTemplateElement* newChild,
+ ElemTemplateElement* refChild);
/**
- * Get the next sibling.
- *
- * @return next sibling node of this node
+ * Replace a child.
+ *
+ * @param newChild the new child to insert
+ * @param oldChild the child to be replaced
+ *
+ * @return oldChild
*/
virtual ElemTemplateElement*
- getNextSibling() const;
+ replaceChildElem(
+ ElemTemplateElement* newChild,
+ ElemTemplateElement* oldChild);
- /**
- * Get the parent node.
- *
- * @return parent node of this node
- */
- virtual ElemTemplateElement*
+ // These interfaces are inherited from XalanElement ...
+
+ virtual XalanDOMString
+ getNodeName() const;
+
+ virtual XalanDOMString
+ getNodeValue() const;
+
+ virtual NodeType
+ getNodeType() const;
+
+ virtual XalanNode*
getParentNode() const;
- /**
- * Return the Nth immediate child of this node, or null if the index is out
- * of bounds.
- *
- * @param i index
- * @return child node corresponding to index i
- */
+ virtual const XalanNodeList*
+ getChildNodes() const;
+
+ virtual XalanNode*
+ getFirstChild() const;
+
+ virtual XalanNode*
+ getLastChild() const;
+
+ virtual XalanNode*
+ getPreviousSibling() const;
+
+ virtual XalanNode*
+ getNextSibling() const;
+
+ virtual const XalanNamedNodeMap*
+ getAttributes() const;
+
+ virtual XalanDocument*
+ getOwnerDocument() const;
+
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual NodeImpl*
+ virtual XalanNode*
#else
virtual ElemTemplateElement*
#endif
- item(unsigned int i);
+ cloneNode(bool deep) const;
- /**
- * Return the element name.
- *
- * @return element name string
- */
- virtual DOMString
- getTagName();
+ virtual XalanNode*
+ insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild);
- /**
- * Return the node name.
- *
- * @return node name string
- */
- virtual DOMString
- getNodeName();
+ virtual XalanNode*
+ replaceChild(
+ XalanNode* newChild,
+ XalanNode* oldChild);
+
+ virtual XalanNode*
+ removeChild(XalanNode* oldChild);
+
+ virtual XalanNode*
+ appendChild(XalanNode* newChild);
+
+ virtual bool
+ hasChildNodes() const;
+
+ virtual void
+ setNodeValue(const XalanDOMString& nodeValue);
+
+ virtual void
+ normalize();
+
+ virtual bool
+ supports(
+ const XalanDOMString& feature,
+ const XalanDOMString& version) const;
+
+ virtual XalanDOMString
+ getNamespaceURI() const;
+
+ virtual XalanDOMString
+ getPrefix() const;
+
+ virtual XalanDOMString
+ getLocalName() const;
+
+ virtual void
+ setPrefix(const XalanDOMString& prefix);
+
+ virtual XalanDOMString
+ getTagName() const;
+
+ virtual XalanDOMString
+ getAttribute(const XalanDOMString& name) const;
+
+ virtual XalanAttr*
+ getAttributeNode(const XalanDOMString& name) const;
+ virtual XalanNodeList*
+ getElementsByTagName(const XalanDOMString& name) const;
+
+ virtual void
+ setAttribute(
+ const XalanDOMString& name,
+ const XalanDOMString& value);
+
+ virtual XalanAttr*
+ setAttributeNode(XalanAttr* newAttr);
+
+ virtual XalanAttr*
+ removeAttributeNode(XalanAttr* oldAttr);
+
+ virtual void
+ removeAttribute(const XalanDOMString& name);
+
+ virtual XalanDOMString
+ getAttributeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName) const;
+
+ virtual void
+ setAttributeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& qualifiedName,
+ const XalanDOMString& value);
+
+ virtual void
+ removeAttributeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName);
+
+ virtual XalanAttr*
+ getAttributeNodeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName) const;
+
+ virtual XalanAttr*
+ setAttributeNodeNS(XalanAttr* newAttr);
+
+ virtual XalanNodeList*
+ getElementsByTagNameNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName) const;
+
+
+ // These interfaces are inherited from PrefixResolver...
+
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
+
+
+ virtual XalanDOMString
+ getURI() const;
+
+
protected:
+
/**
* Perform a query if needed, and call transformChild for each child.
*
@@ -504,17 +628,17 @@
* @param xslToken The current XSLT instruction (deprecated -- I do not
* think we want this).
*/
- void transformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const Stylesheet& stylesheetTree,
- const ElemTemplateElement& xslInstruction, // xsl:apply-templates or xsl:for-each
- const ElemTemplateElement* theTemplate, // The template to copy to the result tree
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNodeContext,
- const QName& mode,
- const XPath* selectPattern,
- int xslToken) const;
-
+ void
+ transformSelectedChildren(
+ StylesheetExecutionContext& executionContext,
+ const Stylesheet& stylesheetTree,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceTree,
+ XalanNode* sourceNodeContext,
+ const QName& mode,
+ const XPath* selectPattern,
+ int xslToken) const;
/**
* Given an element and mode, find the corresponding
@@ -532,30 +656,55 @@
* ELEMNAME_FOREACH.
* @return true if applied a template, false if not.
*/
- bool transformChild(
- StylesheetExecutionContext& executionContext,
- const Stylesheet& stylesheetTree,
- const ElemTemplateElement* xslInstruction, // xsl:apply-templates or xsl:for-each
- const ElemTemplateElement* theTemplate, // may be null
- const DOM_Node& sourceTree, const DOM_Node& selectContext,
- const DOM_Node& child, const QName& mode,
- int xslToken) const;
-
-
- // Implemented DOM Element methods.
+ bool
+ transformChild(
+ StylesheetExecutionContext& executionContext,
+ const Stylesheet& stylesheetTree,
+ const ElemTemplateElement* xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceTree,
+ XalanNode* selectContext,
+ XalanNode* child,
+ const QName& mode,
+ int xslToken) const;
+
+ /**
+ * Given an xsl token type, determine whether or not a child
+ * of that type is allowed. This is so derived types can
+ * determine whether a particular type of child is allowed for
+ * the instance. It is called from appendChildElem().
+ *
+ * The default is to allow no types (no children)
+ *
+ * @param xslToken The xsl token value of the child.
+ *
+ * @return true if the child is allowed, or false if not.
+ */
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
+
+ Stylesheet& m_stylesheet;
- const Stylesheet& m_stylesheet;
const int m_lineNumber;
const int m_columnNumber;
+
NamespaceVectorType m_namespaces;
+
bool m_defaultSpace;
bool m_finishedConstruction;
- const DOMString m_elemName;
+
+ const XalanDOMString m_elemName;
+
+ const int m_xslToken;
+
ElemTemplateElement* m_parentNode;
ElemTemplateElement* m_nextSibling;
+ ElemTemplateElement* m_previousSibling;
ElemTemplateElement* m_firstChild;
+
+ XalanNodeListSurrogate m_surrogateChildren;
};
1.3 +19 -28 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemText.cpp 2000/01/26 14:26:58 1.2
+++ ElemText.cpp 2000/04/11 15:09:26 1.3
@@ -61,6 +61,7 @@
#include <sax/AttributeList.hpp>
+
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -78,7 +79,7 @@
ElemText::ElemText(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -86,15 +87,16 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_TEXT),
m_disableOutputEscaping(false)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
-
+ const XalanDOMChar* const aname = atts.getName(i);
+
if(equals(aname, Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING))
{
m_disableOutputEscaping =
@@ -117,32 +119,21 @@
-NodeImpl*
-ElemText::appendChild(NodeImpl* newChild)
+bool
+ElemText::childTypeAllowed(int xslToken) const
{
- assert(dynamic_cast<ElemTemplateElement*>(newChild) != 0);
-
- const int type = dynamic_cast<ElemTemplateElement*>(newChild)->getXSLToken();
+ bool fResult = false;
- switch(type)
- {
+ switch(xslToken)
+ {
+ // char-instructions
case Constants::ELEMNAME_TEXTLITERALRESULT:
- break;
-
+ fResult = true;
+ break;
+
default:
- error("Can not add " +
- dynamic_cast<ElemTemplateElement*>(newChild)->getTagName() +
- " to " +
- getTagName());
+ break;
}
- return ElemTemplateElement::appendChild(newChild);
-}
-
-
-
-int
-ElemText::getXSLToken() const
-{
- return Constants::ELEMNAME_TEXT;
+ return fResult;
}
1.4 +6 -7 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemText.hpp 2000/02/29 20:54:22 1.3
+++ ElemText.hpp 2000/04/11 15:09:26 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMTEXT_HEADER_GUARD
/**
- * $Id: ElemText.hpp,v 1.3 2000/02/29 20:54:22 jdonohue Exp $
+ * $Id: ElemText.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -98,7 +98,7 @@
ElemText(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -117,13 +117,12 @@
return m_disableOutputEscaping;
}
+protected:
+
// These methods are inherited from ElemTemplateElement ...
-
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
- virtual int
- getXSLToken() const;
+ virtual bool
+ childTypeAllowed(int xslToken) const;
private:
1.3 +11 -14 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemTextLiteral.cpp 2000/01/26 14:26:59 1.2
+++ ElemTextLiteral.cpp 2000/04/11 15:09:26 1.3
@@ -62,6 +62,10 @@
+#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include "Constants.hpp"
#include "StylesheetExecutionContext.hpp"
@@ -80,9 +84,10 @@
bool disableOutputEscaping) :
ElemTemplateElement(constructionContext,
stylesheetTree,
- DOMString("#text"),
+ XALAN_STATIC_UCODE_STRING("#text"),
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_TEXTLITERALRESULT),
m_isCData(isCData),
m_preserveSpace(preserveSpace),
m_ch(ch + start, ch + start + length),
@@ -100,29 +105,21 @@
-int
-ElemTextLiteral::getXSLToken() const
-{
- return Constants::ELEMNAME_TEXTLITERALRESULT;
-}
-
-
-
void
ElemTextLiteral::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
if(!m_disableOutputEscaping)
{
- executionContext.characters(m_ch.begin(), 0, static_cast<int>(m_ch.size()));
+ executionContext.characters(m_ch.begin(), 0, static_cast<unsigned int>(m_ch.size()));
}
else
{
- executionContext.charactersRaw(m_ch.begin(), 0, static_cast<int>(m_ch.size()));
+ executionContext.charactersRaw(m_ch.begin(), 0, static_cast<unsigned int>(m_ch.size()));
}
}
1.5 +6 -9 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemTextLiteral.hpp 2000/03/03 19:00:33 1.4
+++ ElemTextLiteral.hpp 2000/04/11 15:09:26 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMTEXTLITERAL_HEADER_GUARD
/**
- * $Id: ElemTextLiteral.hpp,v 1.4 2000/03/03 19:00:33 jdonohue Exp $
+ * $Id: ElemTextLiteral.hpp,v 1.5 2000/04/11 15:09:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -102,7 +102,7 @@
Stylesheet& stylesheetTree,
int lineNumber,
int columnNumber,
- const XMLCh* ch,
+ const XalanDOMChar* ch,
int start,
int length,
bool isCData,
@@ -125,14 +125,11 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
@@ -148,9 +145,9 @@
const bool m_disableOutputEscaping;
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<XMLCh> XMLChVectorType;
+ typedef vector<XalanDOMChar> XMLChVectorType;
#else
- typedef std::vector<XMLCh> XMLChVectorType;
+ typedef std::vector<XalanDOMChar> XMLChVectorType;
#endif
const XMLChVectorType m_ch;
1.3 +16 -26 xml-xalan/c/src/XSLT/ElemUse.cpp
Index: ElemUse.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemUse.cpp 2000/01/26 14:26:59 1.2
+++ ElemUse.cpp 2000/04/11 15:09:26 1.3
@@ -70,7 +70,6 @@
-#include "Constants.hpp"
#include "Stylesheet.hpp"
#include "StylesheetConstructionContext.hpp"
@@ -84,14 +83,16 @@
ElemUse::ElemUse(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
int lineNumber,
- int columnNumber) :
+ int columnNumber,
+ int xslToken) :
ElemTemplateElement(constructionContext,
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ xslToken),
m_attributeSetsNames()
{
}
@@ -107,8 +108,8 @@
void
ElemUse::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
@@ -120,24 +121,10 @@
-int ElemUse::getXSLToken() const
-{
- return Constants::ELEMNAME_USE;
-}
-
-/**
- * See if this is a use-attribute-sets attribute, and, if so, process it.
- *
- * @param attrName Qualified name of attribute.
- * @param atts The attribute list where the element comes from (not used at
- * this time).
- * @param which The index into the attribute list (not used at this time).
- * @return True if this is a use-attribute-sets attribute.
- */
bool
ElemUse::processUseAttributeSets(
StylesheetConstructionContext& constructionContext,
- const DOMString& attrName,
+ const XalanDOMString& attrName,
const AttributeList& atts,
int which)
{
@@ -145,7 +132,7 @@
if(Constants::ELEMNAME_LITERALRESULT == getXSLToken())
{
- const QName qname(attrName, getStylesheet().getNamespaces());
+ const QName qname(attrName, getStylesheet().getNamespaces());
isUAS = ((equals(qname.getNamespace(),
constructionContext.getXSLNameSpaceURL())) &&
@@ -158,16 +145,19 @@
if(isUAS)
{
- const DOMString qnames = atts.getValue(which);
+ const XalanDOMChar* const qnames = atts.getValue(which);
+
+ StringTokenizer tokenizer(qnames,
+ XALAN_STATIC_UCODE_STRING(" \t\n\r"),
+ false);
- StringTokenizer tokenizer(qnames, " \t\n\r", false);
+ const unsigned int numTokens = tokenizer.countTokens();
- const int numTokens = tokenizer.countTokens();
m_attributeSetsNames.reserve(numTokens);
while(tokenizer.hasMoreTokens())
{
- const DOMString qname = tokenizer.nextToken();
+ const XalanDOMString qname = tokenizer.nextToken();
assert(length(qname) != 0);
m_attributeSetsNames.push_back(QName(qname, getStylesheet().getNamespaces()));
1.5 +16 -17 xml-xalan/c/src/XSLT/ElemUse.hpp
Index: ElemUse.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemUse.hpp 2000/03/03 19:00:33 1.4
+++ ElemUse.hpp 2000/04/11 15:09:26 1.5
@@ -57,17 +57,13 @@
#if !defined(XALAN_ELEMUSE_HEADER_GUARD)
#define XALAN_ELEMUSE_HEADER_GUARD
-/**
- * $Id: ElemUse.hpp,v 1.4 2000/03/03 19:00:33 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com)
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
@@ -77,6 +73,10 @@
+#include "Constants.hpp"
+
+
+
class ElemUse : public ElemTemplateElement
{
public:
@@ -96,9 +96,10 @@
ElemUse(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
int lineNumber,
- int columnNumber);
+ int columnNumber,
+ int xslToken = Constants::ELEMNAME_USE);
virtual
~ElemUse();
@@ -115,7 +116,7 @@
bool
processUseAttributeSets(
StylesheetConstructionContext& constructionContext,
- const DOMString& attrName,
+ const XalanDOMString& attrName,
const AttributeList& atts,
int which);
@@ -124,20 +125,18 @@
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
- virtual int
- getXSLToken() const;
-
private:
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<QName> QNameVectorType;
+ typedef vector<QName> QNameVectorType;
#else
- typedef std::vector<QName> QNameVectorType;
+ typedef std::vector<QName> QNameVectorType;
#endif
+
QNameVectorType m_attributeSetsNames;
};
1.3 +17 -31 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemValueOf.cpp 2000/01/26 14:26:59 1.2
+++ ElemValueOf.cpp 2000/04/11 15:09:26 1.3
@@ -61,7 +61,11 @@
#include <sax/AttributeList.hpp>
+
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/XPath.hpp>
@@ -78,7 +82,7 @@
ElemValueOf::ElemValueOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -86,17 +90,19 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_VALUEOF),
m_selectPattern(0),
m_disableOutputEscaping(false)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -136,31 +142,11 @@
-int
-ElemValueOf::getXSLToken() const
-{
- return Constants::ELEMNAME_VALUEOF;
-}
-
-
-/**
- * Add a child to the child list.
- */
-NodeImpl* ElemValueOf::appendChild(NodeImpl* newChild)
-{
- error("Can not add " +
- dynamic_cast<ElemTemplateElement *>(newChild)->getTagName()
- + " to " + this->getTagName());
-
- return 0;
-}
-
-
void
ElemValueOf::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
@@ -176,7 +162,7 @@
SelectionEvent(executionContext,
sourceNode,
*this,
- DOMString("select"),
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("select")),
*m_selectPattern,
value));
}
@@ -187,9 +173,9 @@
if (XObject::eTypeNull != type)
{
- const DOMString s = value->str();
+ const XalanDOMString s = value->str();
- const int len = length(s);
+ const unsigned int len = length(s);
if(len > 0)
{
1.4 +5 -17 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemValueOf.hpp 2000/02/29 20:54:22 1.3
+++ ElemValueOf.hpp 2000/04/11 15:09:26 1.4
@@ -57,14 +57,8 @@
#if !defined(XALAN_ELEMVALUEOF_HEADER_GUARD)
#define XALAN_ELEMVALUEOF_HEADER_GUARD
-/**
- * $Id: ElemValueOf.hpp,v 1.3 2000/02/29 20:54:22 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -96,7 +90,7 @@
ElemValueOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -105,18 +99,12 @@
~ElemValueOf();
// These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
-
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
private:
@@ -129,7 +117,7 @@
/**
* Tells if this element should disable escaping.
*/
- bool m_disableOutputEscaping;
+ bool m_disableOutputEscaping;
};
1.3 +21 -24 xml-xalan/c/src/XSLT/ElemVariable.cpp
Index: ElemVariable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemVariable.cpp 2000/01/26 14:26:59 1.2
+++ ElemVariable.cpp 2000/04/11 15:09:27 1.3
@@ -63,13 +63,15 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/ResultTreeFrag.hpp>
#include <XPath/XPath.hpp>
#include <XPath/XResultTreeFrag.hpp>
-#include "Constants.hpp"
#include "SelectionEvent.hpp"
#include "Stylesheet.hpp"
#include "StylesheetConstructionContext.hpp"
@@ -81,28 +83,31 @@
ElemVariable::ElemVariable(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
- int columnNumber) :
+ int columnNumber,
+ int xslToken) :
ElemTemplateElement(constructionContext,
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ xslToken),
m_selectPattern(0),
m_qname(),
m_isTopLevel(false),
m_value(0),
- m_varContext()
+ m_varContext(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -141,27 +146,20 @@
-int
-ElemVariable::getXSLToken() const
-{
- return Constants::ELEMNAME_VARIABLE;
-}
-
-
void
ElemVariable::execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const
-{
+{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
XObject* const var = getValue(executionContext, sourceTree, sourceNode);
executionContext.pushVariable(m_qname,
var,
- DOM_UnimplementedElement(const_cast<ElemTemplateElement*>(getParentNode())));
+ getParentNode());
}
@@ -169,8 +167,8 @@
XObject*
ElemVariable::getValue(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode) const
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const
{
XObject* var = 0;
@@ -183,7 +181,7 @@
{
getStylesheet().getStylesheetRoot().fireSelectedEvent(
SelectionEvent(executionContext, sourceNode,
- *this, DOMString("select"), *m_selectPattern, var));
+ *this, XalanDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_selectPattern, var));
}
}
else
@@ -195,4 +193,3 @@
return var;
}
-
1.4 +12 -10 xml-xalan/c/src/XSLT/ElemVariable.hpp
Index: ElemVariable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemVariable.hpp 2000/02/29 20:54:22 1.3
+++ ElemVariable.hpp 2000/04/11 15:09:27 1.4
@@ -58,7 +58,7 @@
#define XALAN_ELEMVARIABLE_HEADER_GUARD
/**
- * $Id: ElemVariable.hpp,v 1.3 2000/02/29 20:54:22 jdonohue Exp $
+ * $Id: ElemVariable.hpp,v 1.4 2000/04/11 15:09:27 dbertoni Exp $
*
* $State: Exp $
*
@@ -78,6 +78,10 @@
+#include <XSLT/Constants.hpp>
+
+
+
class XObject;
@@ -102,7 +106,8 @@
const DOMString& name,
const AttributeList& atts,
int lineNumber,
- int columnNumber);
+ int columnNumber,
+ int xslToken = Constants::ELEMNAME_VARIABLE);
virtual
~ElemVariable();
@@ -117,8 +122,8 @@
XObject*
getValue(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode) const;
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const;
/**
* Determines if this is a top level variable.
@@ -155,14 +160,11 @@
// These methods are inherited from ElemTemplateElement ...
- virtual int
- getXSLToken() const;
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) const;
protected:
@@ -183,7 +185,7 @@
const XObject* m_value;
- DOM_Node m_varContext;
+ XalanNode* m_varContext;
};
1.3 +8 -14 xml-xalan/c/src/XSLT/ElemWhen.cpp
Index: ElemWhen.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWhen.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemWhen.cpp 2000/01/26 14:26:59 1.2
+++ ElemWhen.cpp 2000/04/11 15:09:27 1.3
@@ -74,7 +74,7 @@
ElemWhen::ElemWhen(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -82,16 +82,18 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_WHEN),
m_pTest(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
- const int tok = constructionContext.getAttrTok(aname);
+ const int tok =
+ constructionContext.getAttrTok(aname);
switch(tok)
{
@@ -115,12 +117,4 @@
{
constructionContext.error("xsl:when must have a 'test' attribute.");
}
-}
-
-
-
-int
-ElemWhen::getXSLToken() const
-{
- return Constants::ELEMNAME_WHEN;
}
1.4 +3 -14 xml-xalan/c/src/XSLT/ElemWhen.hpp
Index: ElemWhen.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWhen.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemWhen.hpp 2000/02/29 20:54:22 1.3
+++ ElemWhen.hpp 2000/04/11 15:09:27 1.4
@@ -57,18 +57,13 @@
#if !defined(XALAN_ELEMWHEN_HEADER_GUARD)
#define XALAN_ELEMWHEN_HEADER_GUARD
-/**
- * $Id: ElemWhen.hpp,v 1.3 2000/02/29 20:54:22 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
@@ -95,7 +90,7 @@
ElemWhen (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -111,15 +106,9 @@
return m_pTest;
}
- // These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
-
private:
const XPath* m_pTest;
-
};
1.3 +6 -13 xml-xalan/c/src/XSLT/ElemWithParam.cpp
Index: ElemWithParam.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemWithParam.cpp 2000/01/26 14:26:59 1.2
+++ ElemWithParam.cpp 2000/04/11 15:09:27 1.3
@@ -75,7 +75,7 @@
ElemWithParam::ElemWithParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -83,15 +83,16 @@
stylesheetTree,
name,
lineNumber,
- columnNumber),
+ columnNumber,
+ Constants::ELEMNAME_PARAM),
m_selectPattern(0),
m_qname(0)
{
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname(atts.getName(i));
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_SELECT))
{
@@ -117,12 +118,4 @@
ElemWithParam::~ElemWithParam()
{
-}
-
-
-
-int
-ElemWithParam::getXSLToken() const
-{
- return Constants::ELEMNAME_PARAM;
}
1.4 +18 -18 xml-xalan/c/src/XSLT/ElemWithParam.hpp
Index: ElemWithParam.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemWithParam.hpp 2000/02/29 20:54:22 1.3
+++ ElemWithParam.hpp 2000/04/11 15:09:27 1.4
@@ -57,18 +57,13 @@
#if !defined(XALAN_ELEMWITHPARAM_HEADER_GUARD)
#define XALAN_ELEMWITHPARAM_HEADER_GUARD
-/**
- * $Id: ElemWithParam.hpp,v 1.3 2000/02/29 20:54:22 jdonohue Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
// Base class header file.
#include "ElemTemplateElement.hpp"
@@ -95,7 +90,7 @@
ElemWithParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -109,7 +104,10 @@
* @return qualified name
*/
const QName&
- getQName() const { return m_qname; }
+ getQName() const
+ {
+ return m_qname;
+ }
/**
* Retrieve XPath corresponding to "select" attribute
@@ -117,18 +115,20 @@
* @return pointer to XPath for select pattern
*/
const XPath*
- getSelectPattern() const { return m_selectPattern; }
+ getSelectPattern() const
+ {
+ return m_selectPattern;
+ }
- // These methods are inherited from ElemTemplateElement ...
-
- virtual int
- getXSLToken() const;
-
private:
+
// not implemented
- ElemWithParam(const ElemWithParam &);
- ElemWithParam& operator=(const ElemWithParam &);
+ ElemWithParam(const ElemWithParam&);
+
+ ElemWithParam&
+ operator=(const ElemWithParam&);
+ // Data members...
const XPath* m_selectPattern;
QName m_qname;
1.3 +7 -6 xml-xalan/c/src/XSLT/ElementMarker.cpp
Index: ElementMarker.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElementMarker.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElementMarker.cpp 2000/03/01 20:43:41 1.2
+++ ElementMarker.cpp 2000/04/11 15:09:27 1.3
@@ -61,7 +61,7 @@
#include "ElementMarker.hpp"
-ElementMarker::ElementMarker(const DOM_Node& elem) :
+ElementMarker::ElementMarker(const XalanNode* elem) :
StackEntry(eElementMarker),
m_elem(elem)
{
@@ -82,11 +82,16 @@
}
+
bool
-ElementMarker::equals(const StackEntry& rhs) const
+ElementMarker::equals(const StackEntry& rhs) const
{
if (getType() == rhs.getType() &&
+#if defined(XALAN_OLD_STYLE_CASTS)
+ m_elem == ((const ElementMarker&)rhs).m_elem)
+#else
m_elem == static_cast<const ElementMarker&>(rhs).m_elem)
+#endif
{
return true;
}
@@ -107,7 +112,3 @@
{
return new ElementMarker(*this);
}
-
-/*
- * $ Log: $
- */
1.4 +7 -11 xml-xalan/c/src/XSLT/ElementMarker.hpp
Index: ElementMarker.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElementMarker.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElementMarker.hpp 2000/03/01 20:43:41 1.3
+++ ElementMarker.hpp 2000/04/11 15:09:27 1.4
@@ -68,13 +68,13 @@
-#include <dom/DOM_Node.hpp>
+// Base class header file.
+#include "StackEntry.hpp"
-// Base class header file.
-#include "StackEntry.hpp"
-#include "ElemTemplateElement.hpp"
+class XalanNode;
+
// This class marks the point in the stack where an Element's context
@@ -83,7 +83,7 @@
{
public:
- ElementMarker(const DOM_Node& elem);
+ ElementMarker(const XalanNode* elem);
ElementMarker(const ElementMarker& theSource);
@@ -95,7 +95,7 @@
*
* @return DOM Node corresponding to marker
*/
- const DOM_Node&
+ const XalanNode*
getElement() const
{
return m_elem;
@@ -121,13 +121,9 @@
private:
- const DOM_Node& m_elem;
+ const XalanNode* m_elem;
};
#endif // XALAN_ELEMENTMARKER_HEADER_GUARD
-
-/*
- * $ Log: $
- */
1.2 +4 -4 xml-xalan/c/src/XSLT/FunctionCurrent.cpp
Index: FunctionCurrent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionCurrent.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionCurrent.cpp 1999/12/18 19:48:04 1.1
+++ FunctionCurrent.cpp 2000/04/11 15:09:27 1.2
@@ -80,9 +80,9 @@
XObject*
FunctionCurrent::execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args)
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args)
{
if (args.size() != 0)
{
@@ -100,7 +100,7 @@
}
else
{
- return executionContext.getXObjectFactory().createNodeSet(context);
+ return executionContext.getXObjectFactory().createNodeSet(*context);
}
}
1.3 +4 -4 xml-xalan/c/src/XSLT/FunctionCurrent.hpp
Index: FunctionCurrent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionCurrent.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionCurrent.hpp 2000/02/29 20:54:23 1.2
+++ FunctionCurrent.hpp 2000/04/11 15:09:27 1.3
@@ -91,13 +91,13 @@
~FunctionCurrent();
// These methods are inherited from XPath/Function ...
-
+
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.5 +64 -36 xml-xalan/c/src/XSLT/FunctionDocument.cpp
Index: FunctionDocument.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionDocument.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionDocument.cpp 2000/03/22 19:55:44 1.4
+++ FunctionDocument.cpp 2000/04/11 15:09:27 1.5
@@ -58,7 +58,8 @@
-#include <util/XMLURL.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
@@ -85,15 +86,15 @@
-static DOM_Document
+static XalanDocument*
getDoc(
XPathExecutionContext& executionContext,
- const DOMString& uri,
- const DOMString& base)
+ const XalanDOMString& uri,
+ const XalanDOMString& base)
{
- DOMString localURI(uri);
+ XalanDOMString localURI(uri);
- DOM_Document newDoc = executionContext.getSourceDocument(localURI);
+ XalanDocument* newDoc = executionContext.getSourceDocument(localURI);
if(newDoc == 0)
{
@@ -116,17 +117,13 @@
if(newDoc == 0)
{
- DOMString theMessage("Cannot load requested doc: ");
+ XalanDOMString theMessage("Cannot load requested doc: ");
theMessage += base;
theMessage += localURI;
executionContext.warn(theMessage);
}
- else
- {
- executionContext.setSourceDocument(localURI, newDoc);
- }
}
return newDoc;
@@ -137,9 +134,9 @@
XObject*
FunctionDocument::execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int /* opPos */,
- const std::vector<XObject*>& args)
+ const XObjectArgVectorType& args)
{
if (args.size() == 0)
{
@@ -148,16 +145,23 @@
return 0;
}
+ else if (context == 0)
+ {
+ executionContext.error("The document() function requires a non-null context node!",
+ context);
+
+ return 0;
+ }
else
{
- DOM_Document docContext = DOM_Node::DOCUMENT_NODE == context.getNodeType() ?
- static_cast<const DOM_Document&>(context) :
- context.getOwnerDocument();
+ XalanDocument* const docContext = XalanNode::DOCUMENT_NODE == context->getNodeType() ?
+ static_cast<XalanDocument*>(context) :
+ context->getOwnerDocument();
const XObject* const arg = args[0];
assert(arg != 0);
- DOMString base;
+ XalanDOMString base;
if(args.size() > 1)
{
@@ -166,12 +170,13 @@
if(XObject::eTypeNodeSet == arg2->getType())
{
- const DOM_Node baseNode(arg2->nodeset().item(0));
+ XalanNode* const baseNode =
+ arg2->nodeset().item(0);
assert(baseNode != 0);
- const DOM_Document baseDoc = DOM_Node::DOCUMENT_NODE == baseNode.getNodeType() ?
- static_cast<const DOM_Document&>(baseNode) :
- baseNode.getOwnerDocument();
+ XalanDocument* const baseDoc = XalanNode::DOCUMENT_NODE == baseNode->getNodeType() ?
+ static_cast<XalanDocument*>(baseNode) :
+ baseNode->getOwnerDocument();
base = executionContext.findURIFromDoc(baseDoc);
}
@@ -189,15 +194,29 @@
// Chop off the file name part of the URI, this includes the
// trailing separator
- DOMString newBase;
+ XalanDOMString newBase;
+
+ if (length(base) > 0)
{
- int indexOfSlash = lastIndexOf(base, '/');
+ const unsigned int theLength = length(base);
+
+ unsigned int indexOfSlash = lastIndexOf(base, '/');
#if defined(WIN32)
- const int indexOfBackSlash = lastIndexOf(base, '\\');
- if(indexOfBackSlash > indexOfSlash)
+ const unsigned int indexOfBackSlash = lastIndexOf(base, '\\');
+
+ if(indexOfBackSlash > indexOfSlash && indexOfBackSlash < theLength)
+ {
indexOfSlash = indexOfBackSlash;
-#endif
- newBase = substring(base, 0, indexOfSlash+1);
+ }
+#endif
+ if (indexOfSlash < theLength)
+ {
+ newBase = substring(base, 0, indexOfSlash + 1);
+ }
+ else
+ {
+ newBase = base;
+ }
}
MutableNodeRefList mnl(executionContext.createMutableNodeRefList());
@@ -208,8 +227,11 @@
for(int i = 0; i < nRefs; i++)
{
- const DOMString ref = XObject::eTypeNodeSet == arg->getType() ?
- executionContext.getNodeData(arg->nodeset().item(i)) :
+ assert(XObject::eTypeNodeSet != arg->getType() ||
+ arg->nodeset().item(i) != 0);
+
+ const XalanDOMString ref = XObject::eTypeNodeSet == arg->getType() ?
+ executionContext.getNodeData(*arg->nodeset().item(i)) :
arg->str();
if(length(ref) > 0)
@@ -225,21 +247,27 @@
// characters. Systems not requiring partial forms should not use any
// unencoded slashes in their naming schemes. If they do, absolute URIs
// will still work, but confusion may result.
- const int indexOfColon = indexOf(ref, ':');
- int indexOfSlash = indexOf(ref, '/');
+ const unsigned int theLength = length(ref);
+
+ const unsigned int indexOfColon = indexOf(ref, ':');
+ unsigned int indexOfSlash = indexOf(ref, '/');
+
#if defined(WIN32)
- const int indexOfBackSlash = indexOf(ref, '\\');
- if(indexOfBackSlash > indexOfSlash)
+ const unsigned int indexOfBackSlash = indexOf(ref, '\\');
+
+ if(indexOfBackSlash > indexOfSlash && indexOfBackSlash < theLength)
+ {
indexOfSlash = indexOfBackSlash;
+ }
#endif
- if(indexOfColon != -1 && indexOfSlash != -1 && indexOfColon < indexOfSlash)
+ if(indexOfColon < theLength && indexOfSlash < theLength && indexOfColon < indexOfSlash)
{
// The url (or filename, for that matter) is absolute.
- newBase = DOMString();
+ newBase = XalanDOMString();
}
- const DOM_Document newDoc = getDoc(executionContext, ref, newBase);
+ XalanDocument* const newDoc = getDoc(executionContext, ref, newBase);
if(newDoc != 0)
{
1.3 +3 -14 xml-xalan/c/src/XSLT/FunctionDocument.hpp
Index: FunctionDocument.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionDocument.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionDocument.hpp 2000/02/29 20:54:23 1.2
+++ FunctionDocument.hpp 2000/04/11 15:09:27 1.3
@@ -64,21 +64,10 @@
-#include <set>
-#include <vector>
-
-
-
#include <XPath/Function.hpp>
-class DOM_Node;
-class XObject;
-class XPathExecutionContext;
-
-
-
// Implements the XSLT current() function.
//
class XALAN_XSLT_EXPORT FunctionDocument : public Function
@@ -95,9 +84,9 @@
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.2 +42 -9 xml-xalan/c/src/XSLT/FunctionFormatNumber.cpp
Index: FunctionFormatNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFormatNumber.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionFormatNumber.cpp 1999/12/18 19:48:04 1.1
+++ FunctionFormatNumber.cpp 2000/04/11 15:09:27 1.2
@@ -62,15 +62,22 @@
-
+#include <PlatformSupport/DecimalFormat.hpp>
+#include <PlatformSupport/DecimalFormatSymbols.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathExecutionContext.hpp>
+#include "Constants.hpp"
+
+
FunctionFormatNumber::FunctionFormatNumber()
{
}
@@ -86,11 +93,11 @@
XObject*
FunctionFormatNumber::execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int /* opPos */,
- const std::vector<XObject*>& args)
+ const XObjectArgVectorType& args)
{
- const std::vector<XObject*>::size_type theSize =
+ const XObjectArgVectorType::size_type theSize =
args.size();
if (theSize < 2 || theSize > 3)
@@ -102,19 +109,45 @@
}
else
{
- executionContext.warn("format-number() is not fully implemented!",
+ executionContext.warn(XALAN_STATIC_UCODE_STRING("format-number() is not fully implemented!"),
context);
assert(args[0] != 0);
assert(args[1] != 0);
assert(theSize == 2 || args[2] != 0);
+
+ DecimalFormat theFormatter;
+
+ const double theNumber = args[0]->num();
+ const XalanDOMString theFormatString = args[1]->str();
+
+ const DecimalFormatSymbols* theDFS = 0;
+
+ if (theSize == 3)
+ {
+ const XalanDOMString theDecimalFormatName = args[2]->str();
+ assert(length(theDecimalFormatName) != 0);
+
+ theDFS = executionContext.getDecimalFormatSymbols(theDecimalFormatName);
+
+ if (theDFS == 0)
+ {
+ executionContext.warn("format-number: Specified decimal-format element not found!!!",
+ context);
+ }
+ }
+
+ if (theDFS == 0)
+ {
+ theDFS = executionContext.getDecimalFormatSymbols(Constants::DEFAULT_DECIMAL_FORMAT);
+ }
+
+ theFormatter.setDecimalFormatSymbols(theDFS == 0 ? DecimalFormatSymbols() : *theDFS);
- const double theNumber = args[0]->num();
- const DOMString theFormatString = args[1]->str();
- const DOMString theDecimalFormat = theSize == 3 ? args[2]->str() : DOMString();
+ theFormatter.applyLocalizedPattern(theFormatString);
// $$$ ToDo: This is not really working according to the spec.
- return executionContext.getXObjectFactory().createString(DoubleToDOMString(theNumber));
+ return executionContext.getXObjectFactory().createString(theFormatter.format(theNumber));
}
}
1.3 +3 -3 xml-xalan/c/src/XSLT/FunctionFormatNumber.hpp
Index: FunctionFormatNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFormatNumber.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionFormatNumber.hpp 2000/02/29 20:54:23 1.2
+++ FunctionFormatNumber.hpp 2000/04/11 15:09:27 1.3
@@ -90,13 +90,13 @@
~FunctionFormatNumber();
// These methods are inherited from XPath/Function ...
-
+
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
- const std::vector<XObject*>& args);
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.2 +17 -20 xml-xalan/c/src/XSLT/FunctionGenerateID.cpp
Index: FunctionGenerateID.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionGenerateID.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionGenerateID.cpp 1999/12/18 19:48:04 1.1
+++ FunctionGenerateID.cpp 2000/04/11 15:09:27 1.2
@@ -56,40 +56,40 @@
*/
#include "FunctionGenerateID.hpp"
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOMString.hpp>
-#include <Include/DOMHelper.hpp>
+
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <XPath/MutableNodeRefList.hpp>
+
+
+
#include <XPath/NodeRefListBase.hpp>
#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathExecutionContext.hpp>
+
-FunctionGenerateID::FunctionGenerateID()
+FunctionGenerateID::FunctionGenerateID() :
+ Function()
{
- // do nothing
}
FunctionGenerateID::~FunctionGenerateID()
{
- // do nothing
}
-XObject* FunctionGenerateID::execute(
- XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args)
+XObject*
+FunctionGenerateID::execute(
+ XPathExecutionContext& executionContext,
+ XalanNode* context,
+ int /* opPos */,
+ const XObjectArgVectorType& args)
{
- DOM_Node theContext = context;
+ XalanNode* theContext = context;
if (args.size() > 0)
{
@@ -98,20 +98,17 @@
if (nl.getLength() > 0)
theContext = nl.item(0);
else
- theContext = DOM_Node();
+ theContext = 0;
}
// We're assuming here that each nodes has an implementation with a
// unique address that we can convert into a string
- DOMString id;
+ XalanDOMString id;
if (0 != theContext)
{
- XALAN_DOM_NodeHack hack(theContext);
-
- NodeImpl *impl = hack.getImplementationObject();
- id = "N" + LongToDOMString(reinterpret_cast<long>(impl));
+ id = XALAN_STATIC_UCODE_STRING("N") + LongToDOMString(reinterpret_cast<long>(theContext));
}
return executionContext.getXObjectFactory().createString(id);
1.3 +7 -8 xml-xalan/c/src/XSLT/FunctionGenerateID.hpp
Index: FunctionGenerateID.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionGenerateID.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionGenerateID.hpp 2000/02/29 20:54:23 1.2
+++ FunctionGenerateID.hpp 2000/04/11 15:09:27 1.3
@@ -60,13 +60,11 @@
// Base header file. Must be first.
#include <XSLT/XSLTDefinitions.hpp>
-#include <vector>
+
#include <XPath/Function.hpp>
+
-class DOM_Node;
-class XObject;
-class XPathExecutionContext;
// Implementation of the XSLT function generate-id().
//
@@ -76,16 +74,17 @@
FunctionGenerateID();
- virtual ~FunctionGenerateID();
+ virtual
+ ~FunctionGenerateID();
// These methods are inherited from XPath/Function ...
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.4 +38 -23 xml-xalan/c/src/XSLT/FunctionKey.cpp
Index: FunctionKey.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionKey.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionKey.cpp 2000/03/08 16:29:35 1.3
+++ FunctionKey.cpp 2000/04/11 15:09:27 1.4
@@ -62,14 +62,16 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
-#include <Include/DOMHelper.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/NodeRefListBase.hpp>
#include <XPath/XObject.hpp>
@@ -96,9 +98,9 @@
XObject*
FunctionKey::execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int /* opPos */,
- const std::vector<XObject*>& args)
+ const XObjectArgVectorType& args)
{
if (args.size() != 2)
{
@@ -107,20 +109,29 @@
return 0;
}
+ else if (context == 0)
+ {
+ executionContext.error("The key() function requires a non-null context node!",
+ context);
+
+ return 0;
+ }
else
{
- DOM_Document docContext =
- DOM_Node::DOCUMENT_NODE == context.getNodeType() ?
- static_cast<const DOM_Document&>(context) :
- context.getOwnerDocument();
+ XalanDocument* const docContext =
+ XalanNode::DOCUMENT_NODE == context->getNodeType() ?
+ static_cast<XalanDocument*>(context) :
+ context->getOwnerDocument();
if(0 == docContext)
{
executionContext.error("Context does not have an owner document!",
context);
}
+
+ assert(executionContext.getPrefixResolver() != 0);
- const DOMString keyname = args[0]->str();
+ const XalanDOMString keyname = args[0]->str();
const XObject* const arg = args[1];
assert(arg != 0);
@@ -135,16 +146,22 @@
{
const NodeRefListBase& theNodeSet = arg->nodeset();
- const int nRefs = theNodeSet.getLength();
+ const unsigned int nRefs = theNodeSet.getLength();
if (nRefs > 0)
{
- std::set<DOMString> usedrefs;
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::set;
+#endif
- for(int i = 0; i < nRefs; i++)
+ set<XalanDOMString> usedrefs;
+
+ for(unsigned int i = 0; i < nRefs; i++)
{
- const DOMString ref =
- executionContext.getNodeData(theNodeSet.item(i));
+ assert(theNodeSet.item(i) != 0);
+
+ const XalanDOMString ref =
+ executionContext.getNodeData(*theNodeSet.item(i));
if(0 != length(ref))
{
@@ -154,15 +171,13 @@
usedrefs.insert(ref);
const NodeRefListBase* const nl =
- executionContext.getNodeSetByKey(docContext,
+ executionContext.getNodeSetByKey(*docContext,
keyname,
ref,
*executionContext.getPrefixResolver());
+ assert(nl != 0);
- if (nl != 0)
- {
- theNodeRefList.addNodesInDocOrder(*nl);
- }
+ theNodeRefList.addNodesInDocOrder(*nl);
}
}
}
@@ -170,10 +185,10 @@
}
else
{
- const DOMString ref = arg->str();
+ const XalanDOMString ref = arg->str();
const NodeRefListBase* const nl =
- executionContext.getNodeSetByKey(docContext,
+ executionContext.getNodeSetByKey(*docContext,
keyname,
ref,
*executionContext.getPrefixResolver());
1.3 +4 -4 xml-xalan/c/src/XSLT/FunctionKey.hpp
Index: FunctionKey.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionKey.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionKey.hpp 2000/02/29 20:54:23 1.2
+++ FunctionKey.hpp 2000/04/11 15:09:27 1.3
@@ -90,13 +90,13 @@
~FunctionKey();
// These methods are inherited from XPath/Function ...
-
+
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.2 +38 -30 xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp
Index: FunctionSystemProperty.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionSystemProperty.cpp 1999/12/18 19:48:04 1.1
+++ FunctionSystemProperty.cpp 2000/04/11 15:09:27 1.2
@@ -56,14 +56,17 @@
*/
#include "FunctionSystemProperty.hpp"
-#include <set>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOMString.hpp>
-#include <Include/DOMHelper.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/NodeRefListBase.hpp>
#include <XPath/XObject.hpp>
@@ -71,61 +74,65 @@
#include <XPath/XPathExecutionContext.hpp>
-FunctionSystemProperty::FunctionSystemProperty()
+
+FunctionSystemProperty::FunctionSystemProperty() :
+ Function()
{
- // do nothing
}
FunctionSystemProperty::~FunctionSystemProperty()
{
- // do nothing
}
-XObject* FunctionSystemProperty::execute(
- XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args)
+XObject*
+FunctionSystemProperty::execute(
+ XPathExecutionContext& executionContext,
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args)
{
if (args.size() != 1)
{
executionContext.error("The system-property() function takes a single argument!", context);
+
return 0;
}
- const DOMString fullName = args[0]->str();
- const int indexOfNSSep = indexOf(fullName,':');
+ const XalanDOMString fullName = args[0]->str();
+ const unsigned int fullNameLength = length(fullName);
+ const unsigned int indexOfNSSep = indexOf(fullName,':');
- DOMString result;
+ XalanDOMString result;
- if(indexOfNSSep > 0)
+ if(indexOfNSSep < fullNameLength)
{
- const DOMString prefix = (indexOfNSSep >= 0) ? substring(fullName, 0, indexOfNSSep) : DOMString();
+ const XalanDOMString prefix = substring(fullName, 0, indexOfNSSep);
- //to do:
-// const DOMString nspace = executionContext.getNamespaceForPrefix(prefix);
- DOMString nspace = "http://www.w3.org/1999/XSL/Transform";
+ //$$$ ToDo: Fix this!!!
+// const XalanDOMString nspace = executionContext.getNamespaceForPrefix(prefix);
+ const XalanDOMString nspace =
+ XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform");
-
- const DOMString propName = (indexOfNSSep < 0) ? fullName : substring(fullName,indexOfNSSep+1);
- if(startsWith(nspace,"http://www.w3.org/1999/XSL/Transform"))
+ const XalanDOMString propName = substring(fullName, indexOfNSSep + 1);
+
+ if(startsWith(nspace, XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform")))
{
- if(equals(propName, "version"))
+ if(equals(propName, XALAN_STATIC_UCODE_STRING("version")))
{
- result = "1.0";
+ result = XALAN_STATIC_UCODE_STRING("1.0");
}
- else if(equals(propName, "vendor"))
+ else if(equals(propName, XALAN_STATIC_UCODE_STRING("vendor")))
{
- result = "xml.apache.org";
+ result = XALAN_STATIC_UCODE_STRING("xml.apache.org");
}
- else if(equals(propName, "vendor-url"))
+ else if(equals(propName, XALAN_STATIC_UCODE_STRING("vendor-url")))
{
- result = "http://xml.apache.org/xslt";
+ result = XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt");
}
else
{
@@ -135,6 +142,7 @@
else
{
executionContext.warn("Don't currently do anything with namespace " + nspace + " in property: " + fullName);
+
result = ::getenv(DOMStringToStdString(propName).c_str());
}
}
1.3 +6 -8 xml-xalan/c/src/XSLT/FunctionSystemProperty.hpp
Index: FunctionSystemProperty.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionSystemProperty.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionSystemProperty.hpp 2000/02/29 20:54:23 1.2
+++ FunctionSystemProperty.hpp 2000/04/11 15:09:27 1.3
@@ -58,16 +58,14 @@
#define FUNCTIONSYSTEMPROPERTY_HEADER_GUARD_1357924680
+
// Base header file. Must be first.
#include <XSLT/XSLTDefinitions.hpp>
+
-#include <vector>
#include <XPath/Function.hpp>
-class DOM_Node;
-class XObject;
-class XPathExecutionContext;
// Implementation of the XSLT function sytsem-property().
@@ -82,13 +80,13 @@
~FunctionSystemProperty();
// These methods are inherited from XPath/Function ...
-
+
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.3 +27 -13 xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.cpp
Index: FunctionUnparsedEntityURI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionUnparsedEntityURI.cpp 2000/01/28 14:32:31 1.2
+++ FunctionUnparsedEntityURI.cpp 2000/04/11 15:09:28 1.3
@@ -57,15 +57,18 @@
#include "FunctionUnparsedEntityURI.hpp"
+
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+
+
+
#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathExecutionContext.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOM_Node.hpp>
-
FunctionUnparsedEntityURI::FunctionUnparsedEntityURI()
{
}
@@ -91,20 +94,31 @@
XObject*
FunctionUnparsedEntityURI::execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args)
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args)
{
if(args.size() != 1)
{
executionContext.error("The unparsed-entity-uri function should take one argument!");
}
- DOMString name = (args[0])->str();
- DOM_Document doc =
- (DOM_Node::DOCUMENT_NODE == context.getNodeType()) ?
- static_cast<const DOM_Document&>(context) :
- context.getOwnerDocument();
- DOMString uri = executionContext.getUnparsedEntityURI(name, doc);
+ else if (context == 0)
+ {
+ executionContext.error("The unparser-entity-URI() function requires a non-null context node!",
+ context);
+
+ return 0;
+ }
+
+ const XalanDOMString name = (args[0])->str();
+
+ XalanDocument* const doc =
+ XalanNode::DOCUMENT_NODE == context->getNodeType() ?
+ static_cast<XalanDocument*>(context) :
+ context->getOwnerDocument();
+ assert(doc != 0);
+
+ const XalanDOMString uri = executionContext.getUnparsedEntityURI(name, *doc);
+
return executionContext.getXObjectFactory().createString(uri);
}
-
1.3 +3 -3 xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.hpp
Index: FunctionUnparsedEntityURI.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FunctionUnparsedEntityURI.hpp 2000/02/29 20:54:23 1.2
+++ FunctionUnparsedEntityURI.hpp 2000/04/11 15:09:28 1.3
@@ -94,9 +94,9 @@
virtual XObject*
execute(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
- int /* opPos */,
- const std::vector<XObject*>& args);
+ XalanNode* context,
+ int opPos,
+ const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
1.2 +71 -50 xml-xalan/c/src/XSLT/GenerateEvent.cpp
Index: GenerateEvent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/GenerateEvent.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenerateEvent.cpp 1999/12/18 19:48:04 1.1
+++ GenerateEvent.cpp 2000/04/11 15:09:28 1.2
@@ -58,67 +58,88 @@
-/**
-* Constructor for startDocument, endDocument events.
-*
-* @param processor The XSLT Processor instance.
-* @param eventType One of the EVENTTYPE_XXX constants.
-*/
-GenerateEvent::GenerateEvent(XSLTEngineImpl* processor, EventType eventType) : m_pProcessor(processor),
- m_eventType(eventType), m_start(0), m_length(0), m_pAtts(0)
+GenerateEvent::GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType) :
+ m_eventType(eventType),
+ m_characters(),
+ m_start(0),
+ m_length(0),
+ m_name(),
+ m_data(),
+ m_pAtts(0),
+ m_pProcessor(processor)
{
}
-/**
-* Constructor for startElement, endElement events.
-*
-* @param processor The XSLT Processor Instance.
-* @param eventType One of the EVENTTYPE_XXX constants.
-* @param name The name of the element.
-* @param atts The SAX attribute list.
-*/
-GenerateEvent::GenerateEvent(XSLTEngineImpl* processor, EventType eventType, DOMString name, AttributeList* atts):
- m_name(name), m_pAtts(atts), m_pProcessor(processor), m_eventType(eventType), m_start(0), m_length(0)
-{
-}
+
-/**
-* Constructor for characters, cdate events.
-*
-* @param processor The XSLT Processor instance.
-* @param eventType One of the EVENTTYPE_XXX constants.
-* @param ch The char array from the SAX event.
-* @param start The start offset to be used in the char array.
-* @param length The end offset to be used in the chara array.
-*/
-GenerateEvent::GenerateEvent(XSLTEngineImpl* processor, EventType eventType, DOMString ch, int start, int length) :
- m_characters(ch), m_start(start), m_length(length), m_pProcessor(processor), m_eventType(eventType), m_pAtts(0)
+GenerateEvent::GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& name,
+ AttributeList* atts) :
+ m_eventType(eventType),
+ m_characters(),
+ m_start(0),
+ m_length(0),
+ m_name(name),
+ m_data(),
+ m_pAtts(atts),
+ m_pProcessor(processor)
{
}
+
+
-/**
-* Constructor for processingInstruction events.
-*
-* @param processor The instance of the XSLT processor.
-* @param eventType One of the EVENTTYPE_XXX constants.
-* @param name The name of the processing instruction.
-* @param data The processing instruction data.
-*/
-GenerateEvent::GenerateEvent(XSLTEngineImpl* processor, EventType eventType, DOMString name, DOMString data):
- m_name(name), m_data(data), m_pProcessor(processor), m_eventType(eventType)
+GenerateEvent::GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& ch,
+ unsigned int start,
+ unsigned int length) :
+ m_eventType(eventType),
+ m_characters(ch),
+ m_start(start),
+ m_length(length),
+ m_name(),
+ m_data(),
+ m_pAtts(0),
+ m_pProcessor(processor)
{
}
-/**
-* Constructor for comment and entity ref events.
-*
-* @param processor The XSLT processor instance.
-* @param eventType One of the EVENTTYPE_XXX constants.
-* @param data The comment or entity ref data.
-*/
-GenerateEvent::GenerateEvent(XSLTEngineImpl* processor, EventType eventType, DOMString data):
- m_data(data), m_pProcessor(processor), m_eventType(eventType)
+
+
+GenerateEvent::GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& name,
+ const XalanDOMString& data) :
+ m_eventType(eventType),
+ m_characters(),
+ m_start(0),
+ m_length(0),
+ m_name(name),
+ m_data(data),
+ m_pAtts(0),
+ m_pProcessor(processor)
{
}
+
+GenerateEvent::GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& data) :
+ m_eventType(eventType),
+ m_characters(),
+ m_start(0),
+ m_length(0),
+ m_name(),
+ m_data(data),
+ m_pAtts(0),
+ m_pProcessor(processor)
+{
+}
1.3 +47 -31 xml-xalan/c/src/XSLT/GenerateEvent.hpp
Index: GenerateEvent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/GenerateEvent.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GenerateEvent.hpp 2000/02/29 20:54:23 1.2
+++ GenerateEvent.hpp 2000/04/11 15:09:28 1.3
@@ -57,14 +57,22 @@
#if !defined(XALAN_GenerateEvent_HEADER_GUARD)
#define XALAN_GenerateEvent_HEADER_GUARD
+
+
// Base include file. Must be first.
-#include "XSLTDefinitions.hpp"
+#include <XSLT/XSLTDefinitions.hpp>
+
+
+
+#include <XalanDOM/XalanDOMString.hpp>
-#include <dom/DOMString.hpp>
+
class XSLTEngineImpl;
class AttributeList;
+
+
/**
* This is the class for events generated by the XSL processor
* after it generates a new node in the result tree. It responds
@@ -73,7 +81,7 @@
*
* @see org.apache.xml.xpath4j.xml.FormatterListener
*/
-class GenerateEvent
+class XALAN_XSLT_EXPORT GenerateEvent
{
public:
@@ -138,7 +146,9 @@
* @param processor XSLT Processor instance
* @param eventType one of the EVENTTYPE_XXX constants
*/
- GenerateEvent(XSLTEngineImpl* processor, EventType eventType);
+ GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType);
/**
* Constructor for startElement, endElement events.
@@ -148,8 +158,11 @@
* @param name name of the element
* @param atts SAX attribute list
*/
- GenerateEvent(XSLTEngineImpl* processor, EventType eventType,
- DOMString name, AttributeList* atts);
+ GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& name,
+ AttributeList* atts);
/**
* Constructor for characters, cdate events.
@@ -160,8 +173,12 @@
* @param start start offset to be used in the char array
* @param length end offset to be used in the chara array
*/
- GenerateEvent(XSLTEngineImpl* processor, EventType eventType,
- DOMString ch, int start, int length);
+ GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& ch,
+ unsigned int start,
+ unsigned int length);
/**
* Constructor for processingInstruction events.
@@ -171,8 +188,11 @@
* @param name name of the processing instruction
* @param data processing instruction data
*/
- GenerateEvent(XSLTEngineImpl* processor, EventType eventType,
- DOMString name, DOMString data);
+ GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& name,
+ const XalanDOMString& data);
/**
* Constructor for comment and entity ref events.
@@ -181,57 +201,53 @@
* @param eventType one of the EVENTTYPE_XXX constants
* @param data comment or entity ref data
*/
- GenerateEvent(XSLTEngineImpl* processor, EventType eventType,
- DOMString data);
-
+ GenerateEvent(
+ XSLTEngineImpl* processor,
+ EventType eventType,
+ const XalanDOMString& data);
+
/**
* The type of SAX event that was generated, as enumerated in the
* EVENTTYPE_XXX constants above.
*/
- EventType m_eventType;
+ EventType m_eventType;
/**
* Character data from a character or cdata event.
*/
- DOMString m_characters;
+ XalanDOMString m_characters;
/**
* The start position of the current data in m_characters.
*/
- int m_start;
+ unsigned int m_start;
/**
* The length of the current data in m_characters.
*/
- int m_length;
+ unsigned int m_length;
/**
* The name of the element or PI.
*/
- DOMString m_name;
+ XalanDOMString m_name;
/**
* The string data in the element (comments and PIs).
*/
- DOMString m_data;
+ XalanDOMString m_data;
/**
* The current attribute list.
*/
- AttributeList* m_pAtts;
+ AttributeList* m_pAtts;
private:
-/**
-* The XSLT Processor, which either directly or indirectly contains most needed information. Accessing the m_stylesheetRoot member variable will get you to the stylesheet information.
-*
-* @see org.apache.xml.xslt4j.XSLTEngineImpl, org.apache.xml.xslt4j.StylesheetRoot,
-* org.apache.xml.xslt4j.Stylesheet
- */
- XSLTEngineImpl* m_pProcessor;
-
- // not implemented
- GenerateEvent& operator=(const GenerateEvent &);
-
+
+ XSLTEngineImpl* m_pProcessor;
};
+
+
+
#endif //XALAN_GenerateEvent_HEADER_GUARD
1.4 +36 -7 xml-xalan/c/src/XSLT/KeyDeclaration.hpp
Index: KeyDeclaration.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyDeclaration.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- KeyDeclaration.hpp 2000/02/29 20:54:23 1.3
+++ KeyDeclaration.hpp 2000/04/11 15:09:28 1.4
@@ -64,9 +64,10 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
+
class XPath;
@@ -86,12 +87,13 @@
* @paramuse XPath for "use" attribute
*/
KeyDeclaration(
- const DOMString& name,
- XPath& matchPattern,
- XPath& use) :
+ const XalanDOMString& name,
+ XPath& matchPattern,
+ XPath& use) :
m_name(name),
m_match(&matchPattern),
- m_use(&use)
+ m_use(&use),
+ m_inConstruction(false)
{
}
@@ -100,7 +102,7 @@
*
* @return name string
*/
- const DOMString&
+ const XalanDOMString&
getName() const
{
return m_name;
@@ -128,14 +130,41 @@
return *m_match;
}
+ bool
+ getInConstruction() const
+ {
+ return m_inConstruction;
+ }
+
+ void
+ beginConstruction() const
+ {
+#if defined(XALAN_NO_MUTABLE)
+ ((KeyDeclaration*)this->m_inConstruction = true;
+#else
+ m_inConstruction = true;
+#endif
+ }
+
+ void
+ endConstruction() const
+ {
+#if defined(XALAN_NO_MUTABLE)
+ ((KeyDeclaration*)this->m_inConstruction = false;
+#else
+ m_inConstruction = false;
+#endif
+ }
+
private:
- DOMString m_name;
+ XalanDOMString m_name;
XPath* m_match;
XPath* m_use;
+ mutable bool m_inConstruction;
};
1.5 +149 -111 xml-xalan/c/src/XSLT/KeyTable.cpp
Index: KeyTable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- KeyTable.cpp 2000/03/17 17:12:22 1.4
+++ KeyTable.cpp 2000/04/11 15:09:28 1.5
@@ -63,12 +63,13 @@
-#include <dom/DOM_NamedNodeMap.hpp>
-#include <dom/DOM_NodeList.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
-#include <Include/DOMHelper.hpp>
#include <XPath/XPath.hpp>
#include <XPath/XPathExecutionContext.hpp>
@@ -78,33 +79,41 @@
+const MutableNodeRefList KeyTable::s_dummyList;
+
+
+
KeyTable::KeyTable(
- const DOM_Node& doc,
- const DOM_Node& startNode,
+ XalanNode* doc,
+ XalanNode* startNode,
const PrefixResolver& resolver,
- const std::vector<KeyDeclaration>& keyDeclarations,
+ const XalanDOMString& name,
+ const KeyDeclarationVectorType& keyDeclarations,
XPathExecutionContext& executionContext) :
m_docKey(doc),
m_keys()
{
- DOM_Node pos = startNode;
+ XalanNode* pos = startNode;
+ bool fDone = false;
+
// Do a non-recursive pre-walk over the tree.
- while(0 != pos)
+ while(0 != pos && fDone == false)
{
- const int nDeclarations = keyDeclarations.size();
+ const KeyDeclarationVectorType::size_type nDeclarations =
+ keyDeclarations.size();
// We're going to have to walk the attribute list
// if it's an element, so get the attributes.
- DOM_NamedNodeMap attrs;
+ const XalanNamedNodeMap* attrs = 0;
- int nNodes = 0;
+ int nNodes = 0;
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
{
- attrs = static_cast<const DOM_Element&>(pos).getAttributes();
+ attrs = static_cast<const XalanElement*>(pos)->getAttributes();
- nNodes = attrs.getLength();
+ nNodes = attrs->getLength();
if(0 == nNodes)
{
@@ -115,122 +124,150 @@
// Walk the primary node, and each of the attributes.
// This loop is a little strange... it is meant to always
// execute once, then execute for each of the attributes.
- DOM_Node testNode = pos;
+ XalanNode* testNode = pos;
- for(int nodeIndex = -1; nodeIndex < nNodes;)
+ for(int nodeIndex = -1; nodeIndex < nNodes && fDone == false;)
{
// Walk through each of the declarations made with xsl:key
- for(int i = 0; i < nDeclarations; i++)
+ for(unsigned int i = 0; i < nDeclarations && fDone == false; i++)
{
const KeyDeclaration& kd = keyDeclarations[i];
-
- // See if our node matches the given key declaration according to
- // the match attribute on xsl:key.
- const double score = kd.getMatchPattern().getMatchScore(testNode, executionContext);
- if(score != kd.getMatchPattern().s_MatchScoreNone)
- {
- // Query from the node, according the the select pattern in the
- // use attribute in xsl:key.
- const XObject* const xuse =
- kd.getUse().execute(testNode, resolver, NodeRefList(), executionContext);
-
- const NodeRefListBase* nl = 0;
- int nUseValues;
- DOMString exprResult;
- if(xuse->getType() != xuse->eTypeNodeSet)
+ if (equals(kd.getName(), name))
{
- nUseValues = 1;
- exprResult = xuse->str();
- }
- else
- {
- nl = &xuse->nodeset();
- // Use each node in the node list as a key value that we'll be
- // able to use to look up the given node.
- nUseValues = nl->getLength();
- }
- // Use each node in the node list as a key value that we'll be
- // able to use to look up the given node.
- for(int k = 0; k < nUseValues; k++)
- {
-
- // Use getExpr to get the string value of the given node. I hope
- // the string assumption is the right thing... I can't see how
- // it could work any other way.
- if(0 != nl)
+ if (kd.getInConstruction() == true)
{
- DOM_Node useNode = nl->item(k);
- exprResult = executionContext.getNodeData(useNode);
+ fDone = true;
}
-
- if(length(exprResult) != 0)
+ else
{
- MutableNodeRefList& keyNodes =
- m_keys[kd.getName()][exprResult];
-
- // See if the matched node is already in the
- // table set. If it is there, we're done, otherwise
- // add it.
- bool foundit = false;
+ kd.beginConstruction();
- const int nKeyNodes = keyNodes.getLength(); //size();
+ // See if our node matches the given key declaration according to
+ // the match attribute on xsl:key.
+ const double score = kd.getMatchPattern().getMatchScore(testNode,
+ resolver,
+ executionContext);
- for(int j = 0; j < nKeyNodes; j++)
+ if(score == kd.getMatchPattern().s_MatchScoreNone)
+ {
+ kd.endConstruction();
+ }
+ else
{
- if(testNode == keyNodes.item(j))
+ // Query from the node, according the the select pattern in the
+ // use attribute in xsl:key.
+ const XObject* const xuse =
+ kd.getUse().execute(testNode, resolver, NodeRefList(), executionContext);
+
+ const NodeRefListBase* nl = 0;
+ unsigned int nUseValues;
+ XalanDOMString exprResult;
+ if(xuse->getType() != xuse->eTypeNodeSet)
{
- foundit = true;
- break;
+ nUseValues = 1;
+ exprResult = xuse->str();
}
- } // end for j
+ else
+ {
+ nl = &xuse->nodeset();
+ // Use each node in the node list as a key value that we'll be
+ // able to use to look up the given node.
+ nUseValues = nl->getLength();
+ }
+ // Use each node in the node list as a key value that we'll be
+ // able to use to look up the given node.
+ for(unsigned int k = 0; k < nUseValues; k++)
+ {
- if(foundit == false)
- {
- keyNodes.addNode(testNode);
- }
- }
- } // end for(int k = 0; k < nUseValues; k++)
- } // if(score != kd.getMatchPattern().s_MatchScoreNone)
+ // Use getExpr to get the string value of the given node. I hope
+ // the string assumption is the right thing... I can't see how
+ // it could work any other way.
+ if(0 != nl)
+ {
+ XalanNode* const useNode = nl->item(k);
+ assert(useNode != 0);
+
+ exprResult = executionContext.getNodeData(*useNode);
+ }
+
+ if(length(exprResult) != 0)
+ {
+ MutableNodeRefList& keyNodes =
+ m_keys[kd.getName()][exprResult];
+
+ // See if the matched node is already in the
+ // table set. If it is there, we're done, otherwise
+ // add it.
+ bool foundit = false;
+
+ const unsigned int nKeyNodes = keyNodes.getLength(); //size();
+
+ for(unsigned int j = 0; j < nKeyNodes; j++)
+ {
+ if(testNode == keyNodes.item(j))
+ {
+ foundit = true;
+ break;
+ }
+ } // end for j
+
+ if(foundit == false)
+ {
+ keyNodes.addNode(testNode);
+ }
+ }
+ } // end for(int k = 0; k < nUseValues; k++)
+
+ kd.endConstruction();
+ } // if(score != kd.getMatchPattern().s_MatchScoreNone)
+ } // if (kd.getInConstruction() == true)
+ } // if (equals(kd.getName(), name)
} // end for(int i = 0; i < nDeclarations; i++)
- nodeIndex++;
-
- if(0 != attrs)
+ if (fDone == false)
{
- testNode = attrs.item(nodeIndex);
+ nodeIndex++;
+
+ if(0 != attrs)
+ {
+ testNode = attrs->item(nodeIndex);
+ }
}
} // for(int nodeIndex = -1; nodeIndex < nNodes;)
-
- // The rest of this is getting the next prewalk position in
- // the tree.
-
- DOM_Node nextNode = pos.getFirstChild();
- while(0 == nextNode)
+ if (fDone == false)
{
- if(startNode == pos)
- {
- break;
- }
- else
- {
- nextNode = pos.getNextSibling();
+ // The rest of this is getting the next prewalk position in
+ // the tree.
- if(0 == nextNode)
+ XalanNode* nextNode = pos->getFirstChild();
+
+ while(0 == nextNode)
+ {
+ if(startNode == pos)
+ {
+ break;
+ }
+ else
{
- pos = pos.getParentNode();
+ nextNode = pos->getNextSibling();
- if((startNode == pos) || (0 == pos))
+ if(0 == nextNode)
{
- nextNode = 0;
- break;
+ pos = pos->getParentNode();
+
+ if((startNode == pos) || (0 == pos))
+ {
+ nextNode = 0;
+ break;
+ }
}
}
}
- }
- pos = nextNode;
+ pos = nextNode;
+ } // if (fDone == false)
} // while(0 != pos)
} // end buildKeysTable method
@@ -244,27 +281,28 @@
const NodeRefListBase*
KeyTable::getNodeSetByKey(
- const DOMString& name,
- const DOMString& ref) const
+ const XalanDOMString& name,
+ const XalanDOMString& ref) const
{
- const MutableNodeRefList* nl =0;
+ // It makes things much easier if we always return
+ // a list of nodes. So this is just an empty one
+ // to return when the ref is not found.
+ const MutableNodeRefList* nl = &s_dummyList;
+
+ const KeysMapType::const_iterator i = m_keys.find(name);
- KeysMapType::const_iterator i = m_keys.find(name);
if (i != m_keys.end())
{
- const NodeListMapType& theMap = (*i).second;
- NodeListMapType::const_iterator j = theMap.find(ref);
+ const NodeListMapType& theMap = (*i).second;
+
+ const NodeListMapType::const_iterator j = theMap.find(ref);
+
if (j != theMap.end())
{
nl = &(*j).second;
- return nl;
}
- else
- {
- std::auto_ptr<MutableNodeRefList> newnl(new MutableNodeRefList());
- return newnl.release();
- }
}
+
return nl;
}
1.5 +31 -40 xml-xalan/c/src/XSLT/KeyTable.hpp
Index: KeyTable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- KeyTable.hpp 2000/03/08 20:54:55 1.4
+++ KeyTable.hpp 2000/04/11 15:09:28 1.5
@@ -58,7 +58,7 @@
#define XALAN_KEYTABLE_HEADER_GUARD
/**
- * $Id: KeyTable.hpp,v 1.4 2000/03/08 20:54:55 jdonohue Exp $
+ * $Id: KeyTable.hpp,v 1.5 2000/04/11 15:09:28 dbertoni Exp $
*
* $State: Exp $
*
@@ -72,26 +72,12 @@
-#if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
-#include <hash_map>
-#else
#include <map>
-#endif
-
-#include<vector>
-
-
-
-// Base class header file.
-//#include "UnImplNode.hpp"
-//#include "PrefixResolver.hpp"
-//#include "Constants.hpp"
+#include <vector>
-// Xerces XML4C header files.
-#include <dom/DOM_Node.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -99,11 +85,11 @@
-class DOM_Element;
-class DOM_Node;
class KeyDeclaration;
class NodeRefListBase;
class PrefixResolver;
+class XalanElement;
+class XalanNode;
class XPathExecutionContext;
@@ -118,6 +104,12 @@
{
public:
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<KeyDeclaration> KeyDeclarationVectorType;
+#else
+ typedef std::vector<KeyDeclaration> KeyDeclarationVectorType;
+#endif
+
/**
* Build a keys table.
*
@@ -130,10 +122,11 @@
* @param executionContext current execution context
*/
KeyTable(
- const DOM_Node& doc,
- const DOM_Node& startNode,
+ XalanNode* doc,
+ XalanNode* startNode,
const PrefixResolver& resolver,
- const std::vector<KeyDeclaration>& keyDeclarations,
+ const XalanDOMString& name,
+ const KeyDeclarationVectorType& keyDeclarations,
XPathExecutionContext& executionContext);
virtual
@@ -153,8 +146,8 @@
*/
const NodeRefListBase*
getNodeSetByKey(
- const DOMString& name,
- const DOMString& ref) const;
+ const XalanDOMString& name,
+ const XalanDOMString& ref) const;
/**
* Retrieve the document key. This table should only be used with contexts
@@ -162,7 +155,7 @@
*
* @return Node for document
*/
- DOM_Node
+ const XalanNode*
getDocKey() const
{
return m_docKey;
@@ -174,7 +167,7 @@
* The document key. This table should only be used with contexts
* whose Document roots match this key.
*/
- DOM_Node m_docKey;
+ const XalanNode* m_docKey;
/**
/**
@@ -189,25 +182,23 @@
* look up the nodelist by the given reference.
*/
-#if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
- typedef hash_map<DOMString,
- MutableNodeRefList,
- DOMStringHashFunction,
- DOMStringEqualsFunction> NodeListMapType;
-
- typedef hash_map<DOMString,
- NodeListMapType,
- DOMStringHashFunction,
- DOMStringEqualsFunction> KeysMapType;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef map<XalanDOMString,
+ MutableNodeRefList> NodeListMapType;
+
+ typedef map<XalanDOMString,
+ NodeListMapType> KeysMapType;
#else
- typedef std::map<DOMString,
+ typedef std::map<XalanDOMString,
MutableNodeRefList> NodeListMapType;
- typedef std::map<DOMString,
- NodeListMapType> KeysMapType;
+ typedef std::map<XalanDOMString,
+ NodeListMapType> KeysMapType;
#endif
+
+ KeysMapType m_keys;
- KeysMapType m_keys;
+ static const MutableNodeRefList s_dummyList;
};
1.4 +1 -1 xml-xalan/c/src/XSLT/NodeSortKey.cpp
Index: NodeSortKey.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSortKey.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NodeSortKey.cpp 2000/03/01 20:43:42 1.3
+++ NodeSortKey.cpp 2000/04/11 15:09:28 1.4
@@ -72,7 +72,7 @@
const XPath& selectPat,
bool treatAsNumbers,
bool descending,
- const DOMString& /* langValue */,
+ const XalanDOMString& /* langValue */,
const PrefixResolver& resolver) :
m_executionContext(&executionContext),
m_selectPat(&selectPat),
1.6 +5 -4 xml-xalan/c/src/XSLT/NodeSortKey.hpp
Index: NodeSortKey.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSortKey.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NodeSortKey.hpp 2000/03/03 19:00:33 1.5
+++ NodeSortKey.hpp 2000/04/11 15:09:28 1.6
@@ -74,9 +74,11 @@
+// $$$ ToDo: This is necessary while XalanDOMString is a typedef.
+#include <XalanDOM/XalanDOMString.hpp>
-class DOMString;
+
class ExecutionContext;
class PrefixResolver;
class XPath;
@@ -86,7 +88,7 @@
/**
* Simple data structure class for use by the NodeSorter class.
*/
-class NodeSortKey
+class XALAN_XSLT_EXPORT NodeSortKey
{
public:
@@ -105,7 +107,7 @@
const XPath& selectPat,
bool treatAsNumbers,
bool descending,
- const DOMString& langValue,
+ const XalanDOMString& langValue,
const PrefixResolver& resolver);
~NodeSortKey();
@@ -180,4 +182,3 @@
/*
* $ Log: $
*/
-
1.5 +6 -6 xml-xalan/c/src/XSLT/NodeSorter.cpp
Index: NodeSorter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeSorter.cpp 2000/03/07 16:20:04 1.4
+++ NodeSorter.cpp 2000/04/11 15:09:28 1.5
@@ -92,8 +92,8 @@
void
NodeSorter::sort(
- DOMNodeVectorType& v,
- const DOMNodeSortKeyVectorType& keys)
+ NodeVectorType& v,
+ const NodeSortKeyVectorType& keys)
{
#if !defined(XALAN_NO_NAMESPACES)
using std::stable_sort;
@@ -116,13 +116,13 @@
void
NodeSorter::sort(
- MutableNodeRefList& theList,
- const DOMNodeSortKeyVectorType& keys)
+ MutableNodeRefList& theList,
+ const NodeSortKeyVectorType& keys)
{
const unsigned int theLength = theList.getLength();
// Copy the nodes to a vector...
- DOMNodeVectorType theNodes(theLength);
+ NodeVectorType theNodes(theLength);
unsigned int i = 0;
@@ -134,7 +134,7 @@
sort(theNodes,
keys);
assert(theNodes.size() ==
- static_cast<DOMNodeVectorType::size_type>(theLength));
+ static_cast<NodeVectorType::size_type>(theLength));
theList.clear();
1.4 +22 -22 xml-xalan/c/src/XSLT/NodeSorter.hpp
Index: NodeSorter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NodeSorter.hpp 2000/02/29 20:54:23 1.3
+++ NodeSorter.hpp 2000/04/11 15:09:28 1.4
@@ -74,15 +74,11 @@
-
-//#include <dom/DOM_Node.hpp>
-
-
-
#include "NodeSortKey.hpp"
-class DOM_Node;
+
+class XalanNode;
class MutableNodeRefList;
class XPath;
class XPathExecutionContext;
@@ -98,11 +94,11 @@
public:
#if defined(XALAN_NO_NAMESPACES)
-typedef vector<DOM_Node> DOMNodeVectorType;
-typedef vector<NodeSortKey> DOMNodeSortKeyVectorType;
+ typedef vector<XalanNode*> NodeVectorType;
+ typedef vector<NodeSortKey> NodeSortKeyVectorType;
#else
-typedef std::vector<DOM_Node> DOMNodeVectorType;
-typedef std::vector<NodeSortKey> DOMNodeSortKeyVectorType;
+ typedef std::vector<XalanNode*> NodeVectorType;
+ typedef std::vector<NodeSortKey> NodeSortKeyVectorType;
#endif
/**
@@ -124,8 +120,8 @@
*/
void
sort(
- DOMNodeVectorType& v,
- const DOMNodeSortKeyVectorType& keys);
+ NodeVectorType& v,
+ const NodeSortKeyVectorType& keys);
/**
* Given a vector of nodes, sort each node according to the criteria in the
@@ -136,8 +132,8 @@
*/
void
sort(
- MutableNodeRefList& theList,
- const DOMNodeSortKeyVectorType& keys);
+ MutableNodeRefList& theList,
+ const NodeSortKeyVectorType& keys);
/*
* TODO: Optimize compare -- cache the getStringExpr results,
@@ -147,7 +143,11 @@
/**
* Return the results of a compare of two nodes.
*/
- struct NodeSortKeyCompare : public std::binary_function<const DOM_Node&, const DOM_Node&, bool>
+#if defined(XALAN_NO_NAMESPACES)
+ struct NodeSortKeyCompare : public binary_function<XalanNode*, XalanNode*, bool>
+#else
+ struct NodeSortKeyCompare : public std::binary_function<XalanNode*, XalanNode*, bool>
+#endif
{
public:
@@ -159,8 +159,8 @@
* @param theNodeSortKeys vector of keys upon which to sort
*/
NodeSortKeyCompare(XPathExecutionContext& executionContext,
- const DOMNodeVectorType& theNodes,
- const DOMNodeSortKeyVectorType& theNodeSortKeys) :
+ const NodeVectorType& theNodes,
+ const NodeSortKeyVectorType& theNodeSortKeys) :
m_executionContext(executionContext),
m_nodes(theNodes),
m_nodeSortKeys(theNodeSortKeys)
@@ -179,16 +179,16 @@
second_argument_type theRHS,
unsigned int theKeyIndex = 0) const;
- XPathExecutionContext& m_executionContext;
- const DOMNodeVectorType& m_nodes;
- const DOMNodeSortKeyVectorType& m_nodeSortKeys;
+ XPathExecutionContext& m_executionContext;
+ const NodeVectorType& m_nodes;
+ const NodeSortKeyVectorType& m_nodeSortKeys;
};
private:
- XPathExecutionContext& m_executionContext;
+ XPathExecutionContext& m_executionContext;
- DOMNodeSortKeyVectorType m_keys; // vector of NodeSortKeys
+ NodeSortKeyVectorType m_keys; // vector of NodeSortKeys
/**
* @@ TODO: Adjust this for locale.
* JMD: java: not used yet, placeholder
1.6 +32 -32 xml-xalan/c/src/XSLT/NumeratorFormatter.cpp
Index: NumeratorFormatter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NumeratorFormatter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NumeratorFormatter.cpp 2000/03/17 21:45:18 1.5
+++ NumeratorFormatter.cpp 2000/04/11 15:09:28 1.6
@@ -136,7 +136,7 @@
// See http://www.w3.org/TR/WD-xsl#convert for the form
// of the format string, which tells how the numbers should be
// formatted.
- DOMString formatValue =
+ XalanDOMString formatValue =
m_xslProcessor->getProcessedAttrVal(m_xslNumberElement,
Constants::ATTRNAME_FORMAT,
contextNode);
@@ -152,7 +152,7 @@
// that use letters. A value of "alphabetic" specifies the alphabetic
// sequence; a value of "other" specifies the other sequence.
// TODO: Handle letter-value attribute.
- const DOMString letterValue =
+ const XalanDOMString letterValue =
m_xslProcessor->getProcessedAttrVal(m_xslNumberElement,
Constants::ATTRNAME_LETTERVALUE,
contextNode);
@@ -161,13 +161,13 @@
{
m_xslProcessor->warn(DOM_Node(),
contextNode,
- DOMString(Constants::ATTRNAME_LETTERVALUE) +
+ XalanDOMString(Constants::ATTRNAME_LETTERVALUE) +
" not supported yet!");
}
// When numbering with an alphabetic sequence, the xml:lang
// attribute specifies which language's alphabet is to be used.
- const DOMString langValue =
+ const XalanDOMString langValue =
m_xslProcessor->getAttrVal(m_xslNumberElement, "xml:lang");
#if 0
@@ -197,12 +197,12 @@
// of digits, and the optional n-digits-per-group specifies the
// number of digits per group. For example, digit-group-sep=","
// and n-digits-per-group="3" would produce numbers of the form 1,000,000.
- const DOMString digitGroupSepValue =
+ const XalanDOMString digitGroupSepValue =
m_xslProcessor->getProcessedAttrVal(m_xslNumberElement,
Constants::ATTRNAME_DIGITGROUPSEP,
contextNode);
- const DOMString nDigitsPerGroupValue =
+ const XalanDOMString nDigitsPerGroupValue =
m_xslProcessor->getProcessedAttrVal(m_xslNumberElement,
Constants::ATTRNAME_NDIGITSPERGROUP,
contextNode);
@@ -219,7 +219,7 @@
// that contains a whitespace separated list of the members of
// the numbering sequence.
// (Used with letter-value="other", I think.)
- const DOMString sequenceSrcValue =
+ const XalanDOMString sequenceSrcValue =
m_xslProcessor->getProcessedAttrVal(m_xslNumberElement,
Constants::ATTRNAME_SEQUENCESRC,
contextNode);
@@ -228,7 +228,7 @@
{
m_xslProcessor->warn(DOM_Node(),
contextNode,
- DOMString(Constants::ATTRNAME_SEQUENCESRC) +
+ XalanDOMString(Constants::ATTRNAME_SEQUENCESRC) +
" not supported yet!");
}
*/
@@ -236,25 +236,25 @@
-DOMString
+XalanDOMString
NumeratorFormatter::formatNumberList(const IntVectorType& theList)
{
- DOMString formattedNumber;
+ XalanDOMString formattedNumber;
const int nNumbers = theList.size();
XMLCh numberType = '1';
int numberWidth = 1;
- DOMString formatToken;
- DOMString sepString;
- DOMString lastSepString;
+ XalanDOMString formatToken;
+ XalanDOMString sepString;
+ XalanDOMString lastSepString;
// $$$ ToDo: Fix this!
-// DOMString padString = m_formatter.format(0);
- DOMString padString = LongToDOMString(0);
+// XalanDOMString padString = m_formatter.format(0);
+ XalanDOMString padString = LongToDOMString(0);
- DOMString lookahead; // next token
+ XalanDOMString lookahead; // next token
m_formatTokenizer.reset();
@@ -265,7 +265,7 @@
if(length(lookahead) != 0)
{
formatToken = lookahead;
- lookahead = "";
+ clear(lookahead);
}
else
{
@@ -289,7 +289,7 @@
if(isLetterOrDigit(charAt(lookahead, 0)) == false)
{
sepString += lookahead;
- lookahead = ""; // consume
+ clear(lookahead); // consume
}
else
{
@@ -350,8 +350,8 @@
default: // "1"
{
// $$$ ToDo: Fix this!!!
- // DOMString numString = m_formatter.format(theList[i]);
- DOMString numString(LongToDOMString(theList[i]));
+ // XalanDOMString numString = m_formatter.format(theList[i]);
+ XalanDOMString numString(LongToDOMString(theList[i]));
const int nPadding = numberWidth - numString.length();
@@ -370,7 +370,7 @@
// Check to see if we finished up the format string...
if(0 == length(lastSepString))
{
- lastSepString = "";
+ clear(lastSepString);
while(m_formatTokenizer.hasMoreTokens() == true)
{
@@ -383,7 +383,7 @@
}
else
{
- lastSepString = "";
+ clear(lastSepString);
}
}
}
@@ -398,7 +398,7 @@
-DOMString
+XalanDOMString
NumeratorFormatter::int2alphaCount(
int val,
const XMLCh table[],
@@ -472,21 +472,21 @@
}
while (val > 0);
- return DOMString(&buf[charPos + 1]);
+ return XalanDOMString(&buf[charPos + 1]);
}
-DOMString
+XalanDOMString
NumeratorFormatter::long2roman(
long val,
bool prefixesAreOK)
{
- DOMString roman;
+ XalanDOMString roman;
if(val <= 0)
{
- roman = DOMString("#E(") + DOMString(val) + DOMString(")");
+ roman = XalanDOMString(XALAN_STATIC_UCODE_STRING("#E(")) + XalanDOMString(val) + XalanDOMString(XALAN_STATIC_UCODE_STRING(")"));
}
else
{
@@ -527,7 +527,7 @@
NumeratorFormatter::NumberFormatStringTokenizer::NumberFormatStringTokenizer(
- const DOMString& theStr) :
+ const XalanDOMString& theStr) :
m_currentPosition(0),
m_maxPosition(length(theStr)),
m_str(theStr)
@@ -537,7 +537,7 @@
void
-NumeratorFormatter::NumberFormatStringTokenizer::setString(const DOMString& theString)
+NumeratorFormatter::NumberFormatStringTokenizer::setString(const XalanDOMString& theString)
{
m_str = theString;
@@ -547,7 +547,7 @@
-DOMString
+XalanDOMString
NumeratorFormatter::NumberFormatStringTokenizer::nextToken()
{
if (m_currentPosition >= m_maxPosition)
@@ -573,8 +573,8 @@
// @@ This didn't seem to be working right when start=current=0
// return substring(m_str, start, m_currentPosition);
- DOMString sub = substring(m_str, start, m_currentPosition);
- return DOMString(toCharArray(sub), m_currentPosition-start);
+ XalanDOMString sub = substring(m_str, start, m_currentPosition);
+ return XalanDOMString(toCharArray(sub), m_currentPosition-start);
}
1.4 +36 -39 xml-xalan/c/src/XSLT/ProblemListener.hpp
Index: ProblemListener.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ProblemListener.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProblemListener.hpp 2000/03/03 19:00:33 1.3
+++ ProblemListener.hpp 2000/04/11 15:09:28 1.4
@@ -55,31 +55,28 @@
* <http://www.apache.org/>.
*/
/*
- * $Id: ProblemListener.hpp,v 1.3 2000/03/03 19:00:33 jdonohue Exp $
+ * $Id: ProblemListener.hpp,v 1.4 2000/04/11 15:09:28 dbertoni Exp $
*/
-
-
#if !defined(XALAN_PROBLEMLISTENER_HEADER_GUARD)
#define XALAN_PROBLEMLISTENER_HEADER_GUARD
-/**
- * @author Scott Boag (scott_boag@lotus.com)
- * @author David N. Bertoni (david_n_bertoni@lotus.com)
- */
-
-
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
-#include <dom/DOMString.hpp>
-class DOMString;
-class DOM_Node;
+
+// $$$ ToDo: This is necessary while XalanDOMString is still a typedef.
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
+class XalanNode;
class PrintWriter;
+
/**
* This is the abstract class that the XSL processor uses when it has a
* problem of some kind, that requires a message, an error or a warning. Users
@@ -97,8 +94,8 @@
/// Severity of problem
enum eClassification { eMESSAGE = 0,
- eWARNING = 1,
- eERROR = 2 };
+ eWARNING = 1,
+ eERROR = 2 };
ProblemListener();
@@ -113,33 +110,33 @@
virtual void
setPrintWriter(PrintWriter* pw) = 0;
- /**
- * Function that is called when a problem event occurs.
- *
- * @param where either in XMLPARSER, XSLPROCESSOR, or QUERYENGINE
- * @param classification either MESSAGE, ERROR or WARNING
- * @param styleNode style tree node where the problem occurred
- * (may be null)
- * @param sourceNode source tree node where the problem occurred
- * (may be null)
- * @param msg string message explaining the problem.
- * @param lineNo line number where the problem occurred,
- * if it is known, else zero
- * @param charOffset character offset where the problem,
- * occurred if it is known, else zero
- * @return true if the return is an ERROR, in which case exception will be
- * thrown. Otherwise the processor will continue to process.
- */
+ /**
+ * Function that is called when a problem event occurs.
+ *
+ * @param where either in XMLPARSER, XSLPROCESSOR, or QUERYENGINE
+ * @param classification either MESSAGE, ERROR or WARNING
+ * @param styleNode style tree node where the problem occurred
+ * (may be null)
+ * @param sourceNode source tree node where the problem occurred
+ * (may be null)
+ * @param msg string message explaining the problem.
+ * @param lineNo line number where the problem occurred,
+ * if it is known, else zero
+ * @param charOffset character offset where the problem,
+ * occurred if it is known, else zero
+ * @return true if the return is an ERROR, in which case exception will be
+ * thrown. Otherwise the processor will continue to process.
+ */
virtual bool
problem(
- eProblemSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- const XMLCh* id,
- int lineNo,
- int charOffset) = 0;
+ eProblemSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ const XalanDOMChar* id,
+ int lineNo,
+ int charOffset) = 0;
};
1.4 +13 -15 xml-xalan/c/src/XSLT/ProblemListenerDefault.cpp
Index: ProblemListenerDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ProblemListenerDefault.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProblemListenerDefault.cpp 2000/01/26 20:31:44 1.3
+++ ProblemListenerDefault.cpp 2000/04/11 15:09:28 1.4
@@ -66,16 +66,12 @@
-// Xerces XML4C header files
-#include <dom/DOM_Node.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanNode.hpp>
-// XSL header files.
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/PrintWriter.hpp>
-#include <Include/DOMHelper.hpp>
@@ -107,6 +103,7 @@
}
+
void
ProblemListenerDefault::setPrintWriter(PrintWriter* pw)
{
@@ -114,16 +111,17 @@
}
+
bool
ProblemListenerDefault::problem(
- eProblemSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- const XMLCh* /* id */,
- int lineNo,
- int charOffset)
+ eProblemSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ const XalanDOMChar* /* id */,
+ int lineNo,
+ int charOffset)
{
if (m_pw != 0)
{
@@ -154,13 +152,13 @@
if (0 != styleNode)
{
m_pw->print(styleTreeNodeHeader);
- m_pw->print(styleNode.getNodeName());
+ m_pw->print(styleNode->getNodeName());
}
if (0 != sourceNode)
{
m_pw->print(sourceTreeNodeHeader);
- m_pw->print(sourceNode.getNodeName());
+ m_pw->print(sourceNode->getNodeName());
}
if (0 != lineNo)
1.3 +8 -12 xml-xalan/c/src/XSLT/ProblemListenerDefault.hpp
Index: ProblemListenerDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ProblemListenerDefault.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProblemListenerDefault.hpp 2000/02/29 20:54:24 1.2
+++ ProblemListenerDefault.hpp 2000/04/11 15:09:28 1.3
@@ -75,10 +75,6 @@
-class DOMString;
-
-
-
/**
* The implementation of the default error handling for Xalan.
*/
@@ -98,14 +94,14 @@
virtual bool
problem(
- eProblemSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- const XMLCh* id,
- int lineNo,
- int charOffset);
+ eProblemSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ const XalanDOMChar* id,
+ int lineNo,
+ int charOffset);
private:
1.3 +2 -4 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SelectionEvent.cpp 2000/01/26 14:27:00 1.2
+++ SelectionEvent.cpp 2000/04/11 15:09:28 1.3
@@ -68,8 +68,8 @@
*/
SelectionEvent::SelectionEvent(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceNode,
+ StylesheetExecutionContext& executionContext,
+ const XalanNode* sourceNode,
const ElemTemplateElement& styleNode,
const DOMString& attributeName,
const XPath& xpath,
@@ -88,5 +88,3 @@
SelectionEvent::~SelectionEvent()
{
}
-
-
1.4 +21 -14 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SelectionEvent.hpp 2000/02/29 20:54:24 1.3
+++ SelectionEvent.hpp 2000/04/11 15:09:28 1.4
@@ -57,18 +57,26 @@
#if !defined(XALAN_SelectionEvent_HEADER_GUARD)
#define XALAN_SelectionEvent_HEADER_GUARD
+
+
// Base include file. Must be first.
-#include "XSLTDefinitions.hpp"
+#include <XSLT/XSLTDefinitions.hpp>
+
+
+
+#include <XalanDOM/XalanDOMString.hpp>
-class DOM_Node;
-class DOMString;
+
+
+class XalanNode;
class ElemTemplateElement;
class StylesheetExecutionContext;
class XPath;
class XObject;
-class SelectionEvent
+
+class XALAN_XSLT_EXPORT SelectionEvent
{
public:
@@ -83,10 +91,10 @@
* (should not be null, not enforced)
*/
SelectionEvent(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceNode,
+ StylesheetExecutionContext& executionContext,
+ const XalanNode* sourceNode,
const ElemTemplateElement& styleNode,
- const DOMString& attributeName,
+ const XalanDOMString& attributeName,
const XPath& xpath,
const XObject* selection);
@@ -102,33 +110,32 @@
/**
* The executionContext instance.
*/
- const StylesheetExecutionContext& m_executionContext;
+ const StylesheetExecutionContext& m_executionContext;
/**
* The current context node.
*/
- const DOM_Node& m_sourceNode;
+ const XalanNode* m_sourceNode;
/**
* The node in the style tree where the event occurs.
*/
- const ElemTemplateElement& m_styleNode;
+ const ElemTemplateElement& m_styleNode;
/**
* The attribute name from which the selection is made.
*/
- const DOMString& m_attributeName;
+ const XalanDOMString m_attributeName;
/**
* The XPath that executed the selection.
*/
- const XPath& m_xpath;
+ const XPath& m_xpath;
/**
* The result of the selection.
*/
- const XObject* const m_selection;
-
+ const XObject* const m_selection;
};
1.9 +1091 -520 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Stylesheet.cpp 2000/03/16 12:40:02 1.8
+++ Stylesheet.cpp 2000/04/11 15:09:28 1.9
@@ -10,33 +10,33 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
@@ -66,16 +66,27 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_NamedNodeMap.hpp>
#include <sax/AttributeList.hpp>
+#include <XalanDOM/XalanDOMException.hpp>
+
+
+
#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
+
+
+
#include <XMLSupport/XMLParserLiaison.hpp>
+
+
+
#include <XPath/ElementPrefixResolverProxy.hpp>
#include <XPath/XObject.hpp>
#include <XPath/XPath.hpp>
@@ -84,6 +95,7 @@
#include "Constants.hpp"
#include "ElemAttributeSet.hpp"
+#include "ElemDecimalFormat.hpp"
#include "ElemTemplate.hpp"
#include "ElemTemplateElement.hpp"
#include "ElemVariable.hpp"
@@ -93,16 +105,17 @@
#include "StylesheetRoot.hpp"
+
const Stylesheet::NamespaceVectorType Stylesheet::s_emptyNamespace;
Stylesheet::Stylesheet(
- StylesheetRoot& root,
- const DOMString& baseIdentifier,
+ StylesheetRoot& root,
+ const XalanDOMString& baseIdentifier,
StylesheetConstructionContext& constructionContext) :
- UnimplementedDocument(),
- UnimplementedElement(&root),
+ XalanDocument(),
+ PrefixResolver(),
m_stylesheetRoot(root),
m_baseIdent(baseIdentifier),
m_document(),
@@ -127,56 +140,66 @@
m_XSLTVerDeclared(1.0L),
m_isRoot(&root == this ? true: false),
m_patternTable(),
- m_attributeSets()
+ m_attributeSets(),
+ m_surrogateChildren(*this),
+ m_elemDecimalFormats()
{
- const XMLURL* const url = constructionContext.getURLFromString(m_baseIdent);
+ const XMLURL* const url = constructionContext.getURLFromString(m_baseIdent);
if (url != 0)
{
m_includeStack.push_back(url);
}
-
- // Register the java namespace as being implemented by the xslt-javaclass
- // engine. Note that there's no real code per se for this extension as the
- // functions carry the object on which to call etc. and all the logic of
- // breaking that up is in the xslt-javaclass engine.
-/*
- @@ LATER
- ExtensionFunctionHandler doesn't exist yet
- string uri("http://xml.apache.org");
- ExtensionFunctionHandler fh =
- new ExtensionFunctionHandler (uri, 0, "xslt-javaclass", 0, 0);
- XMLParserLiaisonDefault xld =
- reinterpret_cast<XMLParserLiaisonDefault> m_processor.m_parserLiaison;
- xld.addExtensionNamespace (uri, fh);
-*/
}
Stylesheet::~Stylesheet()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
// Clean up all entries in the vector.
- std::for_each(m_imports.begin(),
+ for_each(m_imports.begin(),
m_imports.end(),
DeleteFunctor<Stylesheet>());
// Clean up the key table vector
- std::for_each(m_key_tables.begin(),
+ for_each(m_key_tables.begin(),
m_key_tables.end(),
DeleteFunctor<KeyTable>());
+ // Clean up the atribute sets vector
+ for_each(m_attributeSets.begin(),
+ m_attributeSets.end(),
+ DeleteFunctor<ElemAttributeSet>());
+
+ // Clean up the atribute sets vector
+ for_each(m_topLevelVariables.begin(),
+ m_topLevelVariables.end(),
+ DeleteFunctor<ElemVariable>());
+
+ // Clean up the atribute sets vector
+ for_each(m_elemDecimalFormats.begin(),
+ m_elemDecimalFormats.end(),
+ DeleteFunctor<ElemDecimalFormat>());
+
// Clean up the match pattern vector
- PatternTableMapType::iterator it = m_patternTable.begin();
+ PatternTableMapType::iterator it = m_patternTable.begin();
for ( ; it != m_patternTable.end(); it++)
{
- PatternTableListType& theList = (*it).second;
+ PatternTableListType& theList = it->second;
- std::for_each(theList.begin(),
- theList.end(),
- DeleteFunctor<MatchPattern2>());
+ for_each(theList.begin(),
+ theList.end(),
+ DeleteFunctor<MatchPattern2>());
}
+
+ delete m_wrapperlessTemplate;
+
+ delete m_firstTemplate;
}
@@ -191,7 +214,7 @@
* document tree, and build a hash table:
* a) keyed by name,
* b) each with a value of a hashtable, keyed by the value returned by
- * the use attribute,
+ * the use attribute,
* c) each with a value that is a nodelist.
* Thus, for a given key or keyref, look up hashtable by name,
* look up the nodelist by the given reference.
@@ -203,98 +226,110 @@
StylesheetConstructionContext& constructionContext)
// throws XSLProcessorException
{
- const XMLCh* nameAttr = 0;
- XPath *matchAttr = 0;
- XPath *useAttr = 0;
+ const XalanDOMChar* nameAttr = 0;
+ XPath* matchAttr = 0;
+ XPath* useAttr = 0;
- int nAttrs = atts.getLength();
- for(int i = 0; i < nAttrs; i++)
+ const unsigned int nAttrs = atts.getLength();
+
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
+
if (equals(aname, Constants::ATTRNAME_NAME))
+ {
nameAttr = atts.getValue(i);
- else if(equals(aname, Constants::ATTRNAME_MATCH))
+ }
+ else if(equals(aname, Constants::ATTRNAME_MATCH))
{
matchAttr =
- constructionContext.createMatchPattern(DOMString(atts.getValue(i)),
+ constructionContext.createMatchPattern(XalanDOMString(atts.getValue(i)),
*nsContext);
}
- else if(equals(aname, Constants::ATTRNAME_USE))
+ else if(equals(aname, Constants::ATTRNAME_USE))
useAttr = constructionContext.createXPath(atts.getValue(i),
*nsContext);
else
+ {
constructionContext.error(
- DOMString("xsl:key, unrecognized keyword '")+Constants::ATTRNAME_NAME+DOMString("'!"));
+ XalanDOMString("xsl:key, unrecognized keyword '") +
+ Constants::ATTRNAME_NAME +
+ XalanDOMString("'!"));
+ }
}
+
if(0 == nameAttr)
- constructionContext.error(DOMString("xsl:key requires a ")+Constants::ATTRNAME_NAME+" attribute!");
+ constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_NAME+" attribute!");
if(0 == matchAttr)
- constructionContext.error(DOMString("xsl:key requires a ")+Constants::ATTRNAME_MATCH+DOMString(" attribute!"));
+ constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_MATCH+XalanDOMString(" attribute!"));
if(0 == useAttr)
- constructionContext.error(DOMString("xsl:key requires a ")+Constants::ATTRNAME_USE+DOMString(" attribute!"));
+ constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_USE+XalanDOMString(" attribute!"));
m_keyDeclarations.push_back(KeyDeclaration(nameAttr, *matchAttr, *useAttr));
+
m_needToBuildKeysTable = true;
}
-
-/**
- * Push the namespace declarations from the current attribute
- * list onto the namespace stack.
- */
-void Stylesheet::pushNamespaces(const AttributeList& atts)
+
+
+
+void
+Stylesheet::pushNamespaces(const AttributeList& atts)
{
- int nAttrs = atts.getLength();
- NamespaceVectorType namespaces;
- for(int i = 0; i < nAttrs; i++)
- {
- const DOMString aname = atts.getName(i);
- const DOMString value = atts.getValue(i);
- bool isPrefix = startsWith(aname, "xmlns:");
- if (equals(aname, "xmlns") || isPrefix)
- {
- DOMString p = isPrefix ? substring(aname,6) : DOMString();
- NameSpace ns(p, value);
- namespaces.push_back(ns);
+ const unsigned int nAttrs = atts.getLength();
+
+ NamespaceVectorType namespaces;
+
+ for(unsigned int i = 0; i < nAttrs; i++)
+ {
+ const XalanDOMChar* const aname = atts.getName(i);
+ const XalanDOMChar* const value = atts.getValue(i);
+
+ bool isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix)
+ {
+ XalanDOMString p = isPrefix ? substring(aname,6) : XalanDOMString();
+
+ namespaces.push_back(NameSpace(p, value));
}
}
+
m_namespaces.push_back(namespaces);
}
+
-void Stylesheet::popNamespaces()
+
+void
+Stylesheet::popNamespaces()
{
assert(m_namespaces.size());
m_namespaces.pop_back();
}
-/**
- * See if this is a xmlns attribute or in a non-XSLT.
- *
- * @param attrName Qualified name of attribute.
- * @param atts The attribute list where the element comes from (not used at
- * this time).
- * @param which The index into the attribute list (not used at this time).
- * @return True if this attribute should not be flagged as an error.
- */
-bool Stylesheet::isAttrOK(
- const DOMString& attrName,
+
+
+bool
+Stylesheet::isAttrOK(
+ const XalanDOMChar* attrName,
const AttributeList& /* atts */,
- int /* which */,
+ int /* which */,
StylesheetConstructionContext& constructionContext) const
{
- bool attrOK = equals(attrName, "xmlns") || startsWith(attrName, "xmlns:");
+ bool attrOK = equals(attrName, XALAN_STATIC_UCODE_STRING("xmlns")) ||
+ startsWith(attrName, XALAN_STATIC_UCODE_STRING("xmlns:"));
if(!attrOK)
{
- const int indexOfNSSep = indexOf(attrName, ':');
+ const unsigned int indexOfNSSep = indexOf(attrName, ':');
- if(indexOfNSSep >= 0)
+ if(indexOfNSSep < length(attrName))
{
- const DOMString prefix = substring(attrName, 0, indexOfNSSep);
- const DOMString ns = getNamespaceForPrefixFromStack(prefix);
+ const XalanDOMString prefix = substring(attrName, 0, indexOfNSSep);
+ const XalanDOMString ns = getNamespaceForPrefixFromStack(prefix);
- attrOK = indexOf(ns, constructionContext.getXSLNameSpaceURLPre()) >= 0;
+ attrOK = indexOf(ns, constructionContext.getXSLNameSpaceURLPre()) < length(ns);
}
else
attrOK = true;
@@ -305,69 +340,92 @@
-/**
- * Get the namespace from a qualified name.
- */
-DOMString Stylesheet::getNamespaceFromStack(const DOMString& nodeName) const
+XalanDOMString
+Stylesheet::getNamespaceFromStack(const XalanDOMString& nodeName) const
{
- int indexOfNSSep = indexOf(nodeName, ':');
- DOMString prefix = (indexOfNSSep >= 0) ?
- substring(nodeName, 0, indexOfNSSep) : DOMString();
+ const unsigned int indexOfNSSep = indexOf(nodeName, ':');
+
+ const XalanDOMString prefix =
+ indexOfNSSep < length(nodeName) ?
+ substring(nodeName, 0, indexOfNSSep) :
+ XalanDOMString();
+
return getNamespaceForPrefixFromStack(prefix);
}
+
+
-/**
- * Get the namespace from a prefix.
- */
-DOMString Stylesheet::getNamespaceForPrefix(const DOMString& prefix) const
+XalanDOMString
+Stylesheet::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
return QName::getNamespaceForPrefix(m_namespaceDecls, prefix);
}
-
-/**
- * Get the namespace from a prefix.
- */
-DOMString Stylesheet::getNamespaceForPrefixFromStack(const DOMString& prefix) const
+
+
+
+XalanDOMString
+Stylesheet::getNamespaceForPrefixFromStack(const XalanDOMString& prefix) const
{
return QName::getNamespaceForPrefix(m_namespaces, prefix);
}
-
-bool Stylesheet::getYesOrNo(
- const DOMString& aname,
- const DOMString& val,
+
+
+
+bool
+Stylesheet::getYesOrNo(
+ const XalanDOMChar* aname,
+ const XalanDOMChar* val,
StylesheetConstructionContext& constructionContext) const
{
- if(val.equals(Constants::ATTRVAL_YES))
+ if(equals(val, Constants::ATTRVAL_YES))
+ {
return true;
- else if(val.equals(Constants::ATTRVAL_NO))
+ }
+ else if(equals(val, Constants::ATTRVAL_NO))
+ {
return false;
+ }
else
- constructionContext.error(val+" is unknown value for "+aname);
- return false;
+ {
+ constructionContext.error(XalanDOMString(val) +
+ XalanDOMString(" is unknown value for ") +
+ aname);
+
+ return false;
+ }
}
+
+
/**
* Add a template to the template list.
*/
-void Stylesheet::addTemplate(ElemTemplate *tmpl)
+void
+Stylesheet::addTemplate(ElemTemplate *tmpl)
{
- int pos = 0;
+ unsigned int pos = 0;
+
if(0 == m_firstTemplate)
+ {
m_firstTemplate = tmpl;
+ }
else
{
ElemTemplateElement* next = m_firstTemplate;
+
while(0 != next)
{
- if(0 == next->getNextSibling())
+ if(0 == next->getNextSiblingElem())
{
- next->setNextSibling(tmpl);
- tmpl->setNextSibling(0); // just to play it safe.
+ next->setNextSiblingElem(tmpl);
+ tmpl->setNextSiblingElem(0); // just to play it safe.
+ tmpl->setPreviousSiblingElem(next);
break;
}
+
pos++;
- next = const_cast<const ElemTemplateElement*>(next)->getNextSibling();
+ next = next->getNextSiblingElem();
}
}
@@ -380,55 +438,42 @@
if(0 != xp)
{
- std::vector<DOMString> strings;
+ using XPath::TargetElementStringsVectorType;
+
+ TargetElementStringsVectorType strings;
+
xp->getTargetElementStrings(strings);
- /* Each string has a list of pattern tables associated with it; if the
- * string is not in the map, then create a list of pattern tables with one
- * entry for the string, otherwise add to the existing pattern table list
- * for that string
- * NOTE: C++ version uses a map keyed on string to a vector of match patterns
- * while the java version uses a map to a linked list
- */
+
+ /* Each string has a list of pattern tables associated with it; if the
+ * string is not in the map, then create a list of pattern tables with one
+ * entry for the string, otherwise add to the existing pattern table list
+ * for that string
+ * NOTE: C++ version uses a map keyed on string to a vector of match patterns
+ * while the java version uses a map to a linked list
+ */
if(0 != strings.size())
{
- int nTargets = strings.size();
- for(int stringIndex = 0; stringIndex < nTargets; stringIndex++)
+ TargetElementStringsVectorType::size_type nTargets =
+ strings.size();
+
+ for(TargetElementStringsVectorType::size_type stringIndex = 0;
+ stringIndex < nTargets; stringIndex++)
{
- DOMString& target = strings[stringIndex];
+ const XalanDOMString& target = strings[stringIndex];
+
MatchPattern2* newMatchPat =
new MatchPattern2(xp->getExpression().getCurrentPattern(),
- *xp, *tmpl, pos, target, *this);
-
- // See if there's already one there
- PatternTableMapType::iterator it =
- m_patternTable.find(target);
- // New one
- if(it == m_patternTable.end())
- {
- PatternTableListType patternlist;
- patternlist.push_back(newMatchPat);
- m_patternTable.insert(PatternTableMapType::value_type(target, patternlist));
- }
- else
- {
- // Add it to the end of the list
- PatternTableListType& patternlist = (*it).second;
- patternlist.push_back(newMatchPat);
- }
+ xp, tmpl, pos, target, this);
+
+ // Put it in the map...
+ m_patternTable[target].push_back(newMatchPat);
}
}
}
}
-
-
+
-// JMD: removed buildStylesheetTables
-// JMD: removed initIncludes
-
-// JMD: removed initImports
-
-
/**
* Locate a macro via the "name" attribute.
* @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
@@ -436,16 +481,15 @@
*/
ElemTemplateElement*
Stylesheet::findNamedTemplate(
- const DOMString& name,
- StylesheetExecutionContext& executionContext) const
+ const XalanDOMString& name,
+ StylesheetExecutionContext& executionContext) const
//throws XSLProcessorException
{
- QName qname(name, m_namespaces);
-
- return findNamedTemplate(qname, executionContext);
+ return findNamedTemplate(QName(name, m_namespaces), executionContext);
}
+
/**
* Locate a macro via the "name" attribute.
* @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
@@ -454,16 +498,17 @@
ElemTemplateElement*
Stylesheet::findNamedTemplate(
const QName& qname,
- StylesheetExecutionContext& executionContext) const
-//throws XSLProcessorException
+ StylesheetExecutionContext& executionContext) const
{
ElemTemplateElement *namedTemplate = 0;
ElemTemplateElementMapType::const_iterator it = m_namedTemplates.find(qname);
+
// Look for the template in the imports
if(it == m_namedTemplates.end())
{
const int nImports = m_imports.size();
+
for(int i = 0; i < nImports; i++)
{
const Stylesheet* const stylesheet = m_imports[i];
@@ -473,11 +518,15 @@
}
}
else
+ {
namedTemplate = (*it).second;
+ }
if(0 == namedTemplate)
- executionContext.warn(DOMString("Could not find macro def named: ") +
- qname.getLocalPart());
+ {
+ executionContext.warn(XalanDOMString("Could not find macro def named: ") +
+ qname.getLocalPart());
+ }
return namedTemplate;
}
@@ -486,8 +535,8 @@
XObject*
Stylesheet::getTopLevelVariable(
- const DOMString& name,
- StylesheetExecutionContext& executionContext) const
+ const XalanDOMString& name,
+ StylesheetExecutionContext& executionContext) const
{
XObject* theResult = executionContext.getTopLevelVariable(name);
@@ -511,17 +560,18 @@
if(0 == theResult)
{
- executionContext.warn(DOMString("Could not find variable def for: ") + name);
+ executionContext.warn(XalanDOMString("Could not find variable def for: ") + name);
}
return theResult;
}
-ElemTemplateElement* Stylesheet::findTemplate(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& targetNode) const
+ElemTemplate*
+Stylesheet::findTemplate(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* targetNode) const
{
const Stylesheet* theDummy;
@@ -530,261 +580,284 @@
-ElemTemplateElement*
+ElemTemplate*
Stylesheet::findTemplate(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& targetNode,
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* targetNode,
const QName& mode,
bool useImports,
const Stylesheet*& foundStylesheet) const
{
- bool usedWildcard = false;
- if(m_isWrapperless) return m_wrapperlessTemplate;
+ assert(sourceTree != 0);
+ assert(targetNode != 0);
- const ElemTemplateElement* bestMatchedRule = 0;
- const MatchPattern2* bestMatchedPattern = 0; // Syncs with bestMatchedRule
+ ElemTemplate* theResult = 0;
- PatternTableVectorType conflicts;
-
- if(useImports == false)
+ if(m_isWrapperless)
+ {
+ theResult = m_wrapperlessTemplate;
+ }
+ else
{
- //odd that this variable is only set, never read
- double highScore = XPath::s_MatchScoreNone;
+ bool usedWildcard = false;
- // Points to the current list of match patterns. Note
- // that this may point to more than one table.
- const PatternTableListType* matchPatternList = 0;
- int targetNodeType = targetNode.getNodeType();
+ ElemTemplate* bestMatchedRule = 0;
+ const MatchPattern2* bestMatchedPattern = 0; // Syncs with bestMatchedRule
- switch(targetNodeType)
+ PatternTableVectorType conflicts;
+
+ if(useImports == false)
{
- case DOM_Node::ELEMENT_NODE:
+ //odd that this variable is only set, never read
+ double highScore = XPath::s_MatchScoreNone;
+
+ // Points to the current list of match patterns. Note
+ // that this may point to more than one table.
+ const PatternTableListType* matchPatternList = 0;
+ int targetNodeType = targetNode->getNodeType();
+
+ switch(targetNodeType)
{
- //java: DOMString targetName = m_processor->getParserLiaison().getLocalNameOfNode(targetNode);
- DOMString targetName = DOMServices::getLocalNameOfNode(targetNode);
- matchPatternList = locateMatchPatternList2(targetName, true);
- }
- break;
-
- case DOM_Node::PROCESSING_INSTRUCTION_NODE:
- case DOM_Node::ATTRIBUTE_NODE:
- matchPatternList = locateMatchPatternList2(targetNode.getNodeName(), true);
- break;
+ case XalanNode::ELEMENT_NODE:
+ {
+ //java: XalanDOMString targetName = m_processor->getParserLiaison().getLocalNameOfNode(targetNode);
+ const XalanDOMString targetName = DOMServices::getLocalNameOfNode(*targetNode);
+ matchPatternList = locateMatchPatternList2(targetName, true);
+ }
+ break;
+
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
+ case XalanNode::ATTRIBUTE_NODE:
+ matchPatternList = locateMatchPatternList2(targetNode->getNodeName(), true);
+ break;
- case DOM_Node::CDATA_SECTION_NODE:
- case DOM_Node::TEXT_NODE:
- matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_TEXT, false);
- break;
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
+ matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_TEXT, false);
+ break;
- case DOM_Node::COMMENT_NODE:
- matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_COMMENT, false);
- break;
+ case XalanNode::COMMENT_NODE:
+ matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_COMMENT, false);
+ break;
- case DOM_Node::DOCUMENT_NODE:
- matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_ROOT, false);
- break;
+ case XalanNode::DOCUMENT_NODE:
+ matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_ROOT, false);
+ break;
- case DOM_Node::DOCUMENT_FRAGMENT_NODE:
- matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_ANY, false);
- break;
-
- default:
- {
- matchPatternList = locateMatchPatternList2(targetNode.getNodeName(), false);
+ case XalanNode::DOCUMENT_FRAGMENT_NODE:
+ matchPatternList = locateMatchPatternList2(XPath::PSEUDONAME_ANY, false);
+ break;
+
+ default:
+ {
+ matchPatternList = locateMatchPatternList2(targetNode->getNodeName(), false);
+ }
}
- }
-
- if (matchPatternList != 0)
- {
- DOMString prevPat;
- // These are iterators into the current table.
- // Note that we may re-seat these iterators to
- // point into a different table, if we have
- // to match wildcards.
- PatternTableListType::const_iterator theCurrentEntry =
- matchPatternList->begin();
+ if (matchPatternList != 0)
+ {
+ XalanDOMString prevPat;
- PatternTableListType::const_iterator theTableEnd =
- matchPatternList->end();
+ // These are iterators into the current table.
+ // Note that we may re-seat these iterators to
+ // point into a different table, if we have
+ // to match wildcards.
+ PatternTableListType::const_iterator theCurrentEntry =
+ matchPatternList->begin();
- while(theCurrentEntry != theTableEnd)
- {
- const MatchPattern2* matchPat = *theCurrentEntry;
+ PatternTableListType::const_iterator theTableEnd =
+ matchPatternList->end();
- const ElemTemplate* rule = &matchPat->getTemplate();
+ while(theCurrentEntry != theTableEnd)
+ {
+ const MatchPattern2* matchPat = *theCurrentEntry;
- // We'll be needing to match rules according to what
- // mode we're in.
- const QName& ruleMode = rule->getMode();
+ ElemTemplate* rule = matchPat->getTemplate();
- // The logic here should be that if we are not in a mode AND
- // the rule does not have a node, then go ahead.
- // OR if we are in a mode, AND the rule has a node,
- // AND the rules match, then go ahead.
+ // We'll be needing to match rules according to what
+ // mode we're in.
+ const QName& ruleMode =
+ rule->getMode();
- bool haveMode = !mode.isEmpty();
- bool haveRuleMode = !ruleMode.isEmpty();
+ // The logic here should be that if we are not in a mode AND
+ // the rule does not have a node, then go ahead.
+ // OR if we are in a mode, AND the rule has a node,
+ // AND the rules match, then go ahead.
- if ( (!haveMode && !haveRuleMode) || (haveMode && haveRuleMode && ruleMode.equals(mode)))
- {
- const DOMString patterns = matchPat->getPattern();
+ bool haveMode = !mode.isEmpty();
+ bool haveRuleMode = !ruleMode.isEmpty();
- if((!isEmpty(patterns)) &&
- !(!isEmpty(prevPat) && equals(prevPat, patterns)))
+ if ( (!haveMode && !haveRuleMode) || (haveMode && haveRuleMode && ruleMode.equals(mode)))
{
- prevPat = patterns;
+ const XalanDOMString patterns = matchPat->getPattern();
- const XPath& xpath = matchPat->getExpression();
+ if((!isEmpty(patterns)) &&
+ !(!isEmpty(prevPat) && equals(prevPat, patterns)))
+ {
+ prevPat = patterns;
- double score =
- xpath.getMatchScore(targetNode, executionContext.getXPathExecutionContext());
+ const XPath* const xpath = matchPat->getExpression();
- if(XPath::s_MatchScoreNone != score)
- {
- const double priorityVal = rule->getPriority();
- const double priorityOfRule
- = (XPath::s_MatchScoreNone != priorityVal)
- ? priorityVal : score;
-
- matchPat->setPriority(priorityOfRule);
- const double priorityOfBestMatched =
- (0 != bestMatchedPattern) ?
- bestMatchedPattern->getPriority() :
- XPath::s_MatchScoreNone;
+ double score =
+ xpath->getMatchScore(targetNode, *this, executionContext.getXPathExecutionContext());
- if(priorityOfRule > priorityOfBestMatched)
- {
- conflicts.clear();
- highScore = score;
- bestMatchedRule = rule;
- bestMatchedPattern = matchPat;
- }
- else if(priorityOfRule == priorityOfBestMatched)
+ if(XPath::s_MatchScoreNone != score)
{
- addObjectIfNotFound(bestMatchedPattern, conflicts);
- conflicts.push_back(matchPat);
- highScore = score;
- bestMatchedRule = rule;
- bestMatchedPattern = matchPat;
+ const double priorityVal = rule->getPriority();
+ const double priorityOfRule
+ = (XPath::s_MatchScoreNone != priorityVal)
+ ? priorityVal : score;
+
+ matchPat->setPriority(priorityOfRule);
+ const double priorityOfBestMatched =
+ (0 != bestMatchedPattern) ?
+ bestMatchedPattern->getPriority() :
+ XPath::s_MatchScoreNone;
+
+ if(priorityOfRule > priorityOfBestMatched)
+ {
+ conflicts.clear();
+ highScore = score;
+ bestMatchedRule = rule;
+ bestMatchedPattern = matchPat;
+ }
+ else if(priorityOfRule == priorityOfBestMatched)
+ {
+ addObjectIfNotFound(bestMatchedPattern, conflicts);
+ conflicts.push_back(matchPat);
+ highScore = score;
+ bestMatchedRule = rule;
+ bestMatchedPattern = matchPat;
+ }
}
}
- } // end if(0 != length(patterns))
- } // end if if(targetModeString.equals(mode))
+ }
- theCurrentEntry++;
+ theCurrentEntry++;
- // We also have to consider wildcard matches.
- if(theCurrentEntry == theTableEnd &&
- equals(matchPat->getTargetString(), "*") == false
- && (DOM_Node::ELEMENT_NODE == targetNodeType ||
- DOM_Node::ATTRIBUTE_NODE == targetNodeType ||
- DOM_Node::PROCESSING_INSTRUCTION_NODE == targetNodeType)
- )
- {
+ // We also have to consider wildcard matches.
+ if(theCurrentEntry == theTableEnd &&
+ equals(matchPat->getTargetString(),
+ XALAN_STATIC_UCODE_STRING("*")) == false
+ && (XalanNode::ELEMENT_NODE == targetNodeType ||
+ XalanNode::ATTRIBUTE_NODE == targetNodeType ||
+ XalanNode::PROCESSING_INSTRUCTION_NODE == targetNodeType)
+ )
{
- assert(usedWildcard==false); // Should only be here once ??
- usedWildcard = true;
- PatternTableMapType::const_iterator theTableIterator =
- m_patternTable.find("*");
-
- assert(m_patternTable.size());
- if (theTableIterator != m_patternTable.end())
{
- // Re-seat the iterators...
- theCurrentEntry = (*theTableIterator).second.begin();
- theTableEnd = (*theTableIterator).second.end();
+ assert(usedWildcard==false); // Should only be here once ??
+ usedWildcard = true;
+ PatternTableMapType::const_iterator theTableIterator =
+ m_patternTable.find(XALAN_STATIC_UCODE_STRING("*"));
+
+ assert(m_patternTable.size());
+ if (theTableIterator != m_patternTable.end())
+ {
+ // Re-seat the iterators...
+ theCurrentEntry = (*theTableIterator).second.begin();
+ theTableEnd = (*theTableIterator).second.end();
+ }
}
}
- }
- } // end while
- } // end if (matchPatternList != 0)
- } // end if(useImports == false)
-
- // @@ JMD: Here we are using the imports anyway if bestMatchedRule is zero,
- // instead of just doing if (useImports) {...} else. Is this right ??
- // Does this assume that bestMatchedRule will always be non-zero exit the
- // if clause, and, if so, is it an error if it's not ?
- // else
- if(0 == bestMatchedRule)
- {
- const int nImports = m_imports.size();
-
- for(int i = 0; i < nImports; i++)
+ } // end while
+ } // end if (matchPatternList != 0)
+ } // end if(useImports == false)
+
+ // @@ JMD: Here we are using the imports anyway if bestMatchedRule is zero,
+ // instead of just doing if (useImports) {...} else. Is this right ??
+ // Does this assume that bestMatchedRule will always be non-zero exit the
+ // if clause, and, if so, is it an error if it's not ?
+ // else
+ if(0 == bestMatchedRule)
{
- const Stylesheet* const stylesheet =
- m_imports[i];
+ const int nImports = m_imports.size();
- bestMatchedRule = stylesheet->findTemplate(executionContext,
- sourceTree,
- targetNode,
- mode,
- false,
- foundStylesheet);
- if(0 != bestMatchedRule)
- break;
+ for(int i = 0; i < nImports; i++)
+ {
+ const Stylesheet* const stylesheet =
+ m_imports[i];
+
+ bestMatchedRule = stylesheet->findTemplate(executionContext,
+ sourceTree,
+ targetNode,
+ mode,
+ false,
+ foundStylesheet);
+ if(0 != bestMatchedRule)
+ break;
+ }
}
- }
-
- const int nConflicts = conflicts.size();
- if(nConflicts > 0)
- {
- const bool quietConflictWarnings = executionContext.getQuietConflictWarnings();
- DOMString conflictsString = (quietConflictWarnings == false)
- ? "Specificity conflicts found: " : DOMString();
- for(int i = 0; i < nConflicts; i++)
- {
- const MatchPattern2* const conflictPat = conflicts[i];
- if(0 != i)
+
+ const int nConflicts = conflicts.size();
+ if(nConflicts > 0)
+ {
+ const bool quietConflictWarnings = executionContext.getQuietConflictWarnings();
+ XalanDOMString conflictsString = (quietConflictWarnings == false)
+ ? XALAN_STATIC_UCODE_STRING("Specificity conflicts found: ") : XalanDOMString();
+ for(int i = 0; i < nConflicts; i++)
{
- if(quietConflictWarnings == false)
+ const MatchPattern2* const conflictPat = conflicts[i];
+ if(0 != i)
{
- conflictsString += ", ";
+ if(quietConflictWarnings == false)
+ {
+ conflictsString += XALAN_STATIC_UCODE_STRING(", ");
+ }
+ // Find the furthest one towards the bottom of the document.
+ if(conflictPat->getPositionInStylesheet() >
+ bestMatchedPattern->getPositionInStylesheet())
+ {
+ bestMatchedPattern = conflictPat;
+ }
}
- // Find the furthest one towards the bottom of the document.
- if(conflictPat->getPositionInStylesheet() >
- bestMatchedPattern->getPositionInStylesheet())
+ else
{
bestMatchedPattern = conflictPat;
}
- }
- else
- {
- bestMatchedPattern = conflictPat;
+
+ if(quietConflictWarnings == false)
+ {
+ conflictsString += XalanDOMString(XALAN_STATIC_UCODE_STRING("\"")) +
+ conflictPat->getPattern() +
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("\""));
+ }
}
+ bestMatchedRule = bestMatchedPattern->getTemplate();
+
if(quietConflictWarnings == false)
{
- conflictsString += DOMString("\"") + conflictPat->getPattern() + DOMString("\"");
+ conflictsString += XALAN_STATIC_UCODE_STRING(" ");
+ conflictsString += XALAN_STATIC_UCODE_STRING("Last found in stylesheet will be used.");
+ executionContext.warn(conflictsString);
}
}
- bestMatchedRule = &bestMatchedPattern->getTemplate();
-
- if(quietConflictWarnings == false)
+ if((0 != bestMatchedPattern) && (0 != foundStylesheet))
{
- conflictsString += " ";
- conflictsString += "Last found in stylesheet will be used.";
- executionContext.warn(conflictsString);
+ foundStylesheet = bestMatchedPattern->getStylesheet();
}
- }
- if((0 != bestMatchedPattern) && (0 != foundStylesheet))
- {
- foundStylesheet = &bestMatchedPattern->getStylesheet();
+ theResult = bestMatchedRule;
}
- return const_cast<ElemTemplateElement *>(bestMatchedRule);
+ return theResult;
}
+
+
-void Stylesheet::addObjectIfNotFound(
- const MatchPattern2* thePattern,
- PatternTableVectorType& theVector)
+void
+Stylesheet::addObjectIfNotFound(
+ const MatchPattern2* thePattern,
+ PatternTableVectorType& theVector)
{
- const int n = theVector.size();
+ const PatternTableVectorType::size_type n =
+ theVector.size();
+
bool addIt = true;
- for(int i = 0; i < n; i++)
+
+ for(PatternTableVectorType::size_type i = 0; i < n; i++)
{
if(theVector[i] == thePattern)
{
@@ -792,6 +865,7 @@
break;
}
}
+
if(addIt == true)
{
theVector.push_back(thePattern);
@@ -799,44 +873,45 @@
}
+
const Stylesheet::PatternTableListType*
-Stylesheet::locateMatchPatternList2(DOM_Node sourceNode) const
+Stylesheet::locateMatchPatternList2(XalanNode* sourceNode) const
{
assert(sourceNode != 0);
const PatternTableListType* matchPatternList = 0;
- switch(sourceNode.getNodeType())
+ switch(sourceNode->getNodeType())
{
- case DOM_Node::ELEMENT_NODE:
+ case XalanNode::ELEMENT_NODE:
{
// String targetName = m_parserLiaison.getExpandedElementName((Element)targetNode);
- const DOMString targetName =
- DOMServices::getLocalNameOfNode(sourceNode);
+ const XalanDOMString targetName =
+ DOMServices::getLocalNameOfNode(*sourceNode);
matchPatternList = locateMatchPatternList2(targetName, true);
}
break;
- case DOM_Node::PROCESSING_INSTRUCTION_NODE:
- case DOM_Node::ATTRIBUTE_NODE:
- matchPatternList = locateMatchPatternList2(sourceNode.getNodeName(), true);
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
+ case XalanNode::ATTRIBUTE_NODE:
+ matchPatternList = locateMatchPatternList2(sourceNode->getNodeName(), true);
break;
- case DOM_Node::CDATA_SECTION_NODE:
- case DOM_Node::TEXT_NODE:
+ case XalanNode::CDATA_SECTION_NODE:
+ case XalanNode::TEXT_NODE:
matchPatternList = locateMatchPatternList2(Constants::PSEUDONAME_TEXT, false);
break;
- case DOM_Node::COMMENT_NODE:
+ case XalanNode::COMMENT_NODE:
matchPatternList = locateMatchPatternList2(Constants::PSEUDONAME_COMMENT, false);
break;
- case DOM_Node::DOCUMENT_NODE:
+ case XalanNode::DOCUMENT_NODE:
matchPatternList = locateMatchPatternList2(Constants::PSEUDONAME_ROOT, false);
break;
default:
- matchPatternList = locateMatchPatternList2(sourceNode.getNodeName(), false);
+ matchPatternList = locateMatchPatternList2(sourceNode->getNodeName(), false);
break;
}
@@ -849,7 +924,7 @@
*/
const Stylesheet::PatternTableListType*
Stylesheet::locateMatchPatternList2(
- const DOMString& sourceElementType,
+ const XalanDOMString& sourceElementType,
bool tryWildCard) const
{
const PatternTableListType* theMatchList = 0;
@@ -864,7 +939,7 @@
}
else if(tryWildCard == true)
{
- i = m_patternTable.find("*");
+ i = m_patternTable.find(XALAN_STATIC_UCODE_STRING("*"));
if (i != m_patternTable.end())
{
theMatchList = &(*i).second;
@@ -876,58 +951,56 @@
-
-/**
- * Given a valid element key, return the corresponding node list.
- */
const NodeRefListBase*
Stylesheet::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const
+ XalanNode* doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const PrefixResolver& resolver,
+ XPathExecutionContext& executionContext,
+ KeyTablesTableType& theKeysTable) const
{
const NodeRefListBase *nl = 0;
+
if(0 != m_keyDeclarations.size())
{
- bool foundDoc = false;
- const int nKeyTables = m_key_tables.size();
- for(int i = 0; i < nKeyTables; i++)
- {
- const KeyTable* const kt = m_key_tables[i];
- if(doc == kt->getDocKey())
+ bool foundDoc = false;
+
+ const KeyTablesTableType::const_iterator i =
+ theKeysTable.find(doc);
+
+ if (i != theKeysTable.end())
+ {
+ nl = i->second->getNodeSetByKey(name, ref);
+
+ if (nl->getLength() > 0)
{
- nl = kt->getNodeSetByKey(name, ref);
- if (nl !=0 && nl->getLength() > 0)
- {
- foundDoc = true;
- break;
- }
+ foundDoc = true;
}
}
- if((0 == nl) && !foundDoc && m_needToBuildKeysTable)
+
+ if((0 == nl || nl->getLength() == 0) && !foundDoc && m_needToBuildKeysTable)
{
- KeyTable* const kt =
+ KeyTable* const kt =
new KeyTable(doc,
doc,
resolver,
+ name,
m_keyDeclarations,
executionContext);
+ assert(doc == kt->getDocKey());
- m_key_tables.push_back(kt);
+ theKeysTable[doc] = kt;
- if(doc == kt->getDocKey())
- {
- foundDoc = true;
- nl = kt->getNodeSetByKey(name, ref);
- }
+ foundDoc = true;
+
+ nl = kt->getNodeSetByKey(name, ref);
}
}
// If the nodelist is null at this point, it should
// mean there wasn't an xsl:key declared with the
- // given name. So go up the import hierarchy and
+ // given name. So go up the import hierarchy and
// see if one of the imported stylesheets declared it.
if(0 == nl)
{
@@ -937,7 +1010,7 @@
{
const Stylesheet* const stylesheet = m_imports[i];
- nl = stylesheet->getNodeSetByKey(doc, name, ref, resolver, executionContext);
+ nl = stylesheet->getNodeSetByKey(doc, name, ref, resolver, executionContext, theKeysTable);
if(0 != nl)
break;
@@ -957,12 +1030,12 @@
* patterns (for compatibility with old syntax).
*/
Stylesheet::MatchPattern2::MatchPattern2(
- const DOMString& pat,
- const XPath& exp,
- const ElemTemplate& theTemplate,
- int posInStylesheet,
- const DOMString& targetString,
- const Stylesheet& stylesheet) :
+ const XalanDOMString& pat,
+ const XPath* exp,
+ ElemTemplate* theTemplate,
+ int posInStylesheet,
+ const XalanDOMString& targetString,
+ Stylesheet* stylesheet) :
m_stylesheet(stylesheet),
m_targetString(targetString),
m_expression(exp),
@@ -974,20 +1047,21 @@
}
+
Stylesheet::MatchPattern2::~MatchPattern2()
{
}
-void Stylesheet::addExtensionNamespace (const DOMString& uri, ExtensionNSHandler* nsh)
+void Stylesheet::addExtensionNamespace (const XalanDOMString& uri, ExtensionNSHandler* nsh)
{
- m_extensionNamespaces.insert(std::make_pair(uri, nsh));
+ m_extensionNamespaces.insert(ExtensionNamespacesMapType::value_type(uri, nsh));
}
void Stylesheet::pushTopLevelVariables(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
ParamVectorType& topLevelParams) const
{
// try
@@ -1004,7 +1078,7 @@
for(i = 0; i < nVars; i++)
{
- ElemVariable* const var = m_topLevelVariables[i];
+ ElemVariable* const var = m_topLevelVariables[i];
bool isParam =
Constants::ELEMNAME_PARAMVARIABLE == var->getXSLToken();
@@ -1025,13 +1099,13 @@
XObject *pXO = 0;
- const DOMString& expr = a.getExpression();
+ const XalanDOMString& expr = a.getExpression();
if(length(expr) != 0)
{
pXO = executionContext.executeXPath(expr,
executionContext.getRootDocument(),
- DOM_UnimplementedElement(const_cast<Stylesheet*>(this)));
+ *this);
a.setXObjectPtr(pXO);
a.setExpression(0);
@@ -1039,14 +1113,14 @@
executionContext.pushVariable(a.getName(),
pXO,
- DOM_UnimplementedElement(const_cast<Stylesheet*>(this)));
+ this);
break;
}
}
}
else
{
- const DOM_Document doc = executionContext.getRootDocument();
+ XalanDocument* const doc = executionContext.getRootDocument();
var->execute(executionContext,
doc,
@@ -1064,83 +1138,201 @@
*/
}
-/**
- * Add an attribute set to the list.
- */
-void Stylesheet::addAttributeSet(
- const QName& /*qname */,
- ElemAttributeSet* attrSet)
-{
- m_attributeSets.push_back(attrSet);
-}
-/**
- * Add the attributes from the named attribute sets to the attribute list.
- * TODO: Error handling for: "It is an error if there are two attribute sets
- * with the same expanded-name and with equal import precedence and that both
- * contain the same attribute unless there is a definition of the attribute
- * set with higher import precedence that also contains the attribute."
- */
-void Stylesheet::applyAttrSets(
- const QNameVectorType& attributeSetsNames,
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode) const
+
+void
+Stylesheet::processNSAliasElement(
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ StylesheetConstructionContext& constructionContext)
{
-/*
- java: Difference from Java code is we have map of qnames to attribute sets
- instead of a vector where we look for the matching qname in the vector
- @@ Is this right ??
- */
- const int nNames = attributeSetsNames.size();
+ const unsigned int nAttrs = atts.getLength();
- if(0 != nNames)
+ XalanDOMString stylesheetPrefix;
+ XalanDOMString resultPrefix;
+
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- int i;
- // Process up the import chain...
- const int nImports = m_imports.size();
- for(i = 0; i < nImports; i++)
- {
- const Stylesheet* const stylesheet = m_imports[i];
- stylesheet->applyAttrSets(attributeSetsNames,
- executionContext, sourceTree, sourceNode, mode);
- }
+ const XalanDOMChar* const aname = atts.getName(i);
+
+ XalanDOMString prefix;
- for(i = 0; i < nNames; i++)
+ if(equals(aname, Constants::ATTRNAME_STYLESHEET_PREFIX) == true)
{
- const QName& qname = attributeSetsNames[i];
- const int nSets = m_attributeSets.size();
+ const XalanDOMChar* const value = atts.getValue(i);
- for(int k = 0; k < nSets; k++)
+ if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
{
- const ElemAttributeSet* const attrSet = m_attributeSets[k];
+ stylesheetPrefix = getNamespaceForPrefix(value);
+ }
+ }
+ else if(equals(aname, Constants::ATTRNAME_RESULT_PREFIX))
+ {
+ const XalanDOMChar* const value = atts.getValue(i);
- if(qname.equals(attrSet->getQName()))
- attrSet->execute(executionContext, sourceTree, sourceNode, mode);
+ if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
+ {
+ resultPrefix = getNamespaceForPrefix(value);
}
}
+ else if(!isAttrOK(aname, atts, i, constructionContext))
+ {
+ constructionContext.error(name + " has an illegal attribute: " + aname);
+ }
}
-}
-
-
-const Stylesheet::NamespaceVectorType& Stylesheet::getNamespaceDecls() const
-{
- return m_namespaceDecls;
+ // Build a table of aliases, the key is the stylesheet uri and the
+ // value is the result uri
+ if (length(stylesheetPrefix) != 0 && length(resultPrefix) != 0 )
+ {
+ // $$$ ToDo: Fix this!!!
+ }
+ else
+ {
+ constructionContext.error("Missing namespace URI for specified prefix");
+ }
}
+
+
-void Stylesheet::setNamespaceDecls(const NamespaceVectorType& ns)
+void
+Stylesheet::processDecimalFormatElement(
+ ElemDecimalFormat* elemDecimalFormat,
+ const AttributeList& /* atts */,
+ StylesheetConstructionContext& /* constructionContext */)
{
- m_namespaceDecls = ns;
+ assert(elemDecimalFormat != 0);
+
+ m_elemDecimalFormats.push_back(elemDecimalFormat);
+}
+
+
+
+const DecimalFormatSymbols*
+Stylesheet::getDecimalFormatSymbols(const XalanDOMString& name) const
+{
+ const DecimalFormatSymbols* dfs = 0;
+
+ const ElemDecimalFormatVectorType::size_type theSize =
+ m_elemDecimalFormats.size();
+
+ if(theSize > 0)
+ {
+ // Start from the top of the stack
+ for (int i = theSize - 1; i >= 0; --i)
+ {
+ assert(m_elemDecimalFormats[i] != 0);
+
+ if (equals(m_elemDecimalFormats[i]->getTagName(), name) == true)
+ {
+ dfs = &m_elemDecimalFormats[i]->getDecimalFormatSymbols();
+
+ break;
+ }
+ }
+ }
+
+ // If dfs is null at this point, it should
+ // mean there wasn't an xsl:decimal-format declared
+ // with the given name. So go up the import hierarchy
+ // and see if one of the imported stylesheets declared
+ // it.
+ if(dfs == 0)
+ {
+ const StylesheetVectorType::size_type nImports =
+ m_imports.size();
+
+ for(StylesheetVectorType::size_type i = 0; i < nImports; ++i)
+ {
+ dfs = m_imports[i]->getDecimalFormatSymbols(name);
+
+ if(dfs != 0)
+ {
+ break;
+ }
+ }
+ }
+
+ return dfs;
+}
+
+
+
+/**
+ * Add an attribute set to the list.
+ */
+void
+Stylesheet::addAttributeSet(
+ const QName& /*qname */,
+ ElemAttributeSet* attrSet)
+{
+ m_attributeSets.push_back(attrSet);
+}
+
+
+
+/**
+ * Add the attributes from the named attribute sets to the attribute list.
+ * TODO: Error handling for: "It is an error if there are two attribute sets
+ * with the same expanded-name and with equal import precedence and that both
+ * contain the same attribute unless there is a definition of the attribute
+ * set with higher import precedence that also contains the attribute."
+ */
+void Stylesheet::applyAttrSets(
+ const QNameVectorType& attributeSetsNames,
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const
+{
+ const QNameVectorType::size_type nNames = attributeSetsNames.size();
+
+ if(0 != nNames)
+ {
+ // Process up the import chain...
+ const StylesheetVectorType::size_type nImports =
+ m_imports.size();
+
+ for(StylesheetVectorType::size_type i = 0; i < nImports; i++)
+ {
+ const Stylesheet* const stylesheet = m_imports[i];
+
+ stylesheet->applyAttrSets(attributeSetsNames,
+ executionContext, sourceTree, sourceNode, mode);
+ }
+
+ for(QNameVectorType::size_type j = 0; j < nNames; j++)
+ {
+ const QName& qname = attributeSetsNames[j];
+ const StylesheetVectorType::size_type nSets = m_attributeSets.size();
+
+ for(StylesheetVectorType::size_type k = 0; k < nSets; k++)
+ {
+ const ElemAttributeSet* const attrSet = m_attributeSets[k];
+ assert(attrSet != 0);
+
+ if(qname.equals(attrSet->getQName()))
+ attrSet->execute(executionContext, sourceTree, sourceNode, mode);
+ }
+ }
+ }
+}
+
+
+
+const
+Stylesheet::NamespaceVectorType& Stylesheet::getNamespaceDecls() const
+{
+ return m_namespaceDecls;
}
+
-short
-Stylesheet::getNodeType()
+void
+Stylesheet::setNamespaceDecls(const NamespaceVectorType& ns)
{
- return DOM_Node::DOCUMENT_NODE;
+ m_namespaceDecls = ns;
}
@@ -1149,48 +1341,427 @@
Stylesheet::getCurrentNamespace() const
{
if (m_namespaces.size() > 0)
+ {
return m_namespaces.back();
+ }
else
+ {
return s_emptyNamespace;
+ }
}
-////////////////////////////////////////////////////////////////////
-// JAVA Code not implemented
-////////////////////////////////////////////////////////////////////
-
-#ifdef JAVANOTIMPLEMENTED
-
- /**
- * Extension to be used when serializing to disk.
- */
- const std::string STYLESHEET_EXT(".lxc");
-
- /**
- * Read the stylesheet from a serialization stream.
- */
- private void readObject(ObjectInputStream stream)
- throws IOException
- {
- try
- {
- stream.defaultReadObject();
- }
- catch(ClassNotFoundException cnfe)
- {
- throw new XSLProcessorException(cnfe);
- }
- m_includeStack.clear();
- }
-
- private void writeObject(ObjectOutputStream stream)
- throws IOException
- {
- stream.defaultWriteObject();
- }
-#endif // JAVANOTIMPLEMENTED
+XalanDOMString
+Stylesheet::getNodeName() const
+{
+ return XalanDOMString();
+}
-/*
- * $ Log: $
- */
+
+
+XalanDOMString
+Stylesheet::getNodeValue() const
+{
+ return XalanDOMString();
+}
+
+
+
+Stylesheet::NodeType
+Stylesheet::getNodeType() const
+{
+ return XalanNode::DOCUMENT_NODE;
+}
+
+
+
+XalanNode*
+Stylesheet::getParentNode() const
+{
+ return 0;
+}
+
+
+
+const XalanNodeList*
+Stylesheet::getChildNodes() const
+{
+ return &m_surrogateChildren;
+}
+
+
+
+XalanNode*
+Stylesheet::getFirstChild() const
+{
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::getLastChild() const
+{
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::getPreviousSibling() const
+{
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::getNextSibling() const
+{
+ return 0;
+}
+
+
+
+const XalanNamedNodeMap*
+Stylesheet::getAttributes() const
+{
+ return 0;
+}
+
+
+
+XalanDocument*
+Stylesheet::getOwnerDocument() const
+{
+ return 0;
+}
+
+
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XalanNode*
+#else
+Stylesheet*
+#endif
+Stylesheet::cloneNode(bool /* deep */) const
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::insertBefore(
+ XalanNode* /* newChild */,
+ XalanNode* /* refChild */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::replaceChild(
+ XalanNode* /* newChild */,
+ XalanNode* /* oldChild */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::removeChild(XalanNode* /* oldChild */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::appendChild(XalanNode* /* oldChild */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+bool
+Stylesheet::hasChildNodes() const
+{
+ // $$$ ToDo: Is this always true?
+ return true;
+}
+
+
+
+void
+Stylesheet::setNodeValue(const XalanDOMString& /* nodeValue */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+void
+Stylesheet::normalize()
+{
+}
+
+
+
+bool
+Stylesheet::supports(
+ const XalanDOMString& /* feature */,
+ const XalanDOMString& /* version */) const
+{
+ return false;
+}
+
+
+
+XalanDOMString
+Stylesheet::getNamespaceURI() const
+{
+ // $$ ToDo: Is this the same value as PrefixResolver::getURI()?
+ return XalanDOMString();
+}
+
+
+
+XalanDOMString
+Stylesheet::getPrefix() const
+{
+ return XalanDOMString();
+}
+
+
+
+XalanDOMString
+Stylesheet::getLocalName() const
+{
+ return XalanDOMString();
+}
+
+
+
+void
+Stylesheet::setPrefix(const XalanDOMString& /* prefix */)
+{
+ throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
+}
+
+
+
+XalanElement*
+Stylesheet::createElement(const XalanDOMString& /* tagName */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanDocumentFragment*
+Stylesheet::createDocumentFragment()
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanText*
+Stylesheet::createTextNode(const XalanDOMString& /* data */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanComment*
+Stylesheet::createComment(const XalanDOMString& /* data */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanCDATASection*
+Stylesheet::createCDATASection(const XalanDOMString& /* data */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanProcessingInstruction*
+Stylesheet::createProcessingInstruction(
+ const XalanDOMString& /* target */,
+ const XalanDOMString& /* data */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanAttr*
+Stylesheet::createAttribute(const XalanDOMString& /* name */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanEntityReference*
+Stylesheet::createEntityReference(const XalanDOMString& /* name */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanDocumentType*
+Stylesheet::getDoctype() const
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanDOMImplementation*
+Stylesheet::getImplementation() const
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanElement*
+Stylesheet::getDocumentElement() const
+{
+ // $$$ ToDo: Is this correct?
+
+ return m_wrapperlessTemplate != 0 ? m_wrapperlessTemplate : m_firstTemplate;
+}
+
+
+
+XalanNodeList*
+Stylesheet::getElementsByTagName(const XalanDOMString& /* name */) const
+{
+ return 0;
+}
+
+
+
+XalanNodeList*
+Stylesheet::getElementsByTagNameNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
+{
+ return 0;
+}
+
+
+
+XalanNode*
+Stylesheet::importNode(
+ XalanNode* /* importedNode */,
+ bool /* deep */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanElement*
+Stylesheet::createElementNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* qualifiedName */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanAttr*
+Stylesheet::createAttributeNS(
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* qualifiedName */)
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanElement*
+Stylesheet::getElementById(const XalanDOMString& /* elementId */) const
+{
+ //should not be called
+ assert(false);
+
+ return 0;
+}
+
+
+
+XalanDOMString
+Stylesheet::getURI() const
+{
+ return m_baseIdent;
+}
1.8 +510 -322 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Stylesheet.hpp 2000/03/01 20:43:42 1.7
+++ Stylesheet.hpp 2000/04/11 15:09:29 1.8
@@ -10,33 +10,33 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
@@ -61,22 +61,25 @@
#if !defined(XALAN_STYLESHEET_HEADER_GUARD)
#define XALAN_STYLESHEET_HEADER_GUARD
+
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
#include <list>
#include <map>
#include <vector>
+
-#include <dom/DOM_Node.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanNodeListSurrogate.hpp>
-#include <DOMSupport/UnimplementedDocument.hpp>
-#include <DOMSupport/UnimplementedElement.hpp>
+#include <XPath/PrefixResolver.hpp>
#include <XPath/NameSpace.hpp>
#include <XPath/QName.hpp>
@@ -89,13 +92,16 @@
class AttributeList;
class ExtensionNSHandler;
-class PrefixResolver;
+class DecimalFormatSymbols;
class ElemAttributeSet;
+class ElemDecimalFormat;
class ElemTemplate;
class ElemTemplateElement;
class ElemVariable;
class KeyTable;
+class MatchPattern2;
class NodeRefListBase;
+class PrefixResolver;
class StylesheetConstructionContext;
class StylesheetExecutionContext;
class StylesheetRoot;
@@ -103,7 +109,6 @@
class XObject;
class XPath;
class XPathExecutionContext;
-class MatchPattern2;
@@ -111,8 +116,8 @@
* This class represents the base stylesheet or an "import" stylesheet.
* "include" stylesheets are combined with the including stylesheet.
*/
-class XALAN_XSLT_EXPORT Stylesheet : public UnimplementedDocument, public UnimplementedElement
-{
+class XALAN_XSLT_EXPORT Stylesheet : public XalanDocument, private PrefixResolver
+{
public:
@@ -122,33 +127,36 @@
# define XALAN_STD std::
#endif
-typedef XALAN_STD map<DOMString, ExtensionNSHandler*> ExtensionNamespacesMapType;
-typedef XALAN_STD map<QName, ElemTemplateElement*> ElemTemplateElementMapType;
-typedef XALAN_STD vector<Arg> ParamVectorType;
-typedef XALAN_STD vector<ElemAttributeSet*> AttributeSetMapType;
-typedef XALAN_STD vector<ElemVariable*> ElemVariableVectorType;
-typedef XALAN_STD vector<KeyDeclaration> KeyDeclarationVectorType;
-typedef XALAN_STD vector<KeyTable*> KeyTableVectorType;
-typedef XALAN_STD vector<NameSpace> NamespaceVectorType;
-typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
-typedef XALAN_STD vector<QName> QNameVectorType;
-typedef XALAN_STD vector<Stylesheet*> StylesheetVectorType;
-typedef XALAN_STD vector<const XMLURL*> URLStackType;
-typedef XALAN_STD vector<const XPath*> XPathVectorType;
+typedef XALAN_STD map<XalanDOMString, ExtensionNSHandler*> ExtensionNamespacesMapType;
+typedef XALAN_STD map<QName, ElemTemplateElement*> ElemTemplateElementMapType;
+typedef XALAN_STD vector<Arg> ParamVectorType;
+typedef XALAN_STD vector<ElemAttributeSet*> AttributeSetMapType;
+typedef XALAN_STD vector<ElemVariable*> ElemVariableVectorType;
+typedef XALAN_STD vector<KeyDeclaration> KeyDeclarationVectorType;
+typedef XALAN_STD vector<KeyTable*> KeyTableVectorType;
+typedef XALAN_STD map<const XalanNode*, KeyTable*> KeyTablesTableType;
+typedef XALAN_STD vector<NameSpace> NamespaceVectorType;
+typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
+typedef XALAN_STD vector<QName> QNameVectorType;
+typedef XALAN_STD vector<Stylesheet*> StylesheetVectorType;
+typedef XALAN_STD vector<const XMLURL*> URLStackType;
+typedef XALAN_STD vector<const XPath*> XPathVectorType;
+typedef XALAN_STD vector<ElemDecimalFormat*> ElemDecimalFormatVectorType;
#undef XALAN_STD
- virtual NodeImpl* cloneNode(bool /*deep*/) { return 0; }
+ /**
+ * Constructor for a Stylesheet needs a Document.
+ * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
+ * the error condition is severe enough to halt processing.
+ */
+ Stylesheet(
+ StylesheetRoot& root,
+ const XalanDOMString& baseIdentifier,
+ StylesheetConstructionContext& constructionContext);
- /**
- * A lookup table of all space preserving elements.
- */
- XPathVectorType m_whitespacePreservingElements;
-
- /**
- * A lookup table of all space stripping elements.
- */
- XPathVectorType m_whitespaceStrippingElements;
+ virtual
+ ~Stylesheet();
/**
* Retrieve XSLT version number
@@ -173,19 +181,6 @@
}
/**
- * Constructor for a Stylesheet needs a Document.
- * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
- * the error condition is severe enough to halt processing.
- */
- Stylesheet(
- StylesheetRoot& root,
- const DOMString& baseIdentifier,
- StylesheetConstructionContext& constructionContext);
-
- virtual
- ~Stylesheet();
-
- /**
* Retrieve the root stylesheet object
*
* @return const reference to the stylesheet object
@@ -213,7 +208,7 @@
* @return pointer to default XPath
*/
const XPath*
- getDefaultATXpath () const
+ getDefaultATXpath() const
{
return m_defaultATXpath;
}
@@ -224,7 +219,7 @@
* @param defaultATXpath pointer to new default XPath
*/
void
- setDefaultATXpath (XPath* defaultATXpath)
+ setDefaultATXpath(XPath* defaultATXpath)
{
m_defaultATXpath = defaultATXpath;
}
@@ -235,7 +230,8 @@
*
* @return vector of namespace vectors
*/
- const NamespacesStackType& getNamespaces() const
+ const NamespacesStackType&
+ getNamespaces() const
{
return m_namespaces;
}
@@ -245,14 +241,16 @@
*
* @return vector of namespace vectors
*/
- const NamespaceVectorType& getNamespaceDecls() const;
+ const NamespaceVectorType&
+ getNamespaceDecls() const;
/**
* Set the list of namespace declarations currently in effect
*
* @param ns vector of namespace vectors
*/
- void setNamespaceDecls(const NamespaceVectorType& ns);
+ void
+ setNamespaceDecls(const NamespaceVectorType& ns);
/*
* Get the top entry on the namespace stack, or 0, if
@@ -267,27 +265,29 @@
*
* @param atts attribute list constaining namespaces
*/
- void pushNamespaces(const AttributeList& atts);
+ void
+ pushNamespaces(const AttributeList& atts);
- /**
- * Pop a namespace declaration from the namespace stack.
- */
- void popNamespaces();
+ /**
+ * Pop a namespace declaration from the namespace stack.
+ */
+ void
+ popNamespaces();
- /**
- * See if this is a xmlns attribute, and, if so, process it.
- *
- * @param attrName qualified name of attribute
- * @param atts attribute list where the element comes from (not used at
- * this time)
- * @param which index into the attribute list (not used at this time)
- * @return true if this is a namespace name
- */
+ /**
+ * See if this is a xmlns attribute, and, if so, process it.
+ *
+ * @param attrName qualified name of attribute
+ * @param atts attribute list where the element comes from (not used at
+ * this time)
+ * @param which index into the attribute list (not used at this time)
+ * @return true if this is a namespace name
+ */
bool
isAttrOK(
- const DOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
- int which,
+ int which,
StylesheetConstructionContext& constructionContext) const;
/**
@@ -295,16 +295,9 @@
*
* @param nodeName name of node
* @return namespace string for node
- */
- DOMString getNamespaceFromStack(const DOMString& nodeName) const;
-
- /**
- * Get the namespace from a prefix by searching the current namespace list.
- *
- * @param prefix prefix to search
- * @return namespace corresponding to prefix
*/
- DOMString getNamespaceForPrefix(const DOMString& prefix) const;
+ XalanDOMString
+ getNamespaceFromStack(const XalanDOMString& nodeName) const;
/**
* Get the namespace from a prefix by searching the stack of namespace
@@ -313,14 +306,16 @@
* @param prefix prefix to search
* @return namespace corresponding to prefix
*/
- DOMString getNamespaceForPrefixFromStack(const DOMString& prefix) const;
+ XalanDOMString
+ getNamespaceForPrefixFromStack(const XalanDOMString& prefix) const;
/**
* Add a template to the list of names templates
*
* @param tmpl template to add
*/
- void addTemplate(ElemTemplate *tmpl);
+ void
+ addTemplate(ElemTemplate *tmpl);
/**
* Process an attribute that has the value of 'yes' or 'no'.
@@ -332,8 +327,8 @@
*/
virtual bool
getYesOrNo(
- const DOMString& aname,
- const DOMString& val,
+ const XalanDOMChar* aname,
+ const XalanDOMChar* val,
StylesheetConstructionContext& constructionContext) const;
/**
@@ -352,7 +347,7 @@
*
* @return string for base identifier
*/
- const DOMString
+ const XalanDOMString
getBaseIdentifier() const
{
return m_baseIdent;
@@ -364,18 +359,55 @@
* @param str string for base identifier
*/
void
- setBaseIdentifier(const DOMString& str)
+ setBaseIdentifier(const XalanDOMString& str)
{
m_baseIdent = str;
}
/**
+ * Process an xsl:namespace-alias element.
+ *
+ * @param name the element name.
+ * @param attrs the current attribute list
+ * @param constructionContext the active construction context
+ */
+ void
+ processNSAliasElement(
+ const XalanDOMString& name,
+ const AttributeList& atts,
+ StylesheetConstructionContext& constructionContext);
+
+ /**
+ * Process an xsl:decimal-format element.
+ *
+ * @param elemDecimalFormat the element
+ * @param attrs the current attribute list
+ * @param constructionContext the active construction context
+ */
+ void
+ processDecimalFormatElement(
+ ElemDecimalFormat* elemDecimalFormat,
+ const AttributeList& atts,
+ StylesheetConstructionContext& constructionContext);
+
+ /**
+ * Retrieve the DecimalFormatSymbols instance associated with
+ * the name.
+ *
+ * @param name the name for the lookup
+ * @return a pointer to the matching instance, or 0 if none was found
+ */
+ const DecimalFormatSymbols*
+ getDecimalFormatSymbols(const XalanDOMString& name) const;
+
+ /**
* Add an attribute set to the list.
*
* @param qname qualified name of attribute set
* @param attrSet pointer to attribute set to add
*/
- void addAttributeSet(
+ void
+ addAttributeSet(
const QName& qname,
ElemAttributeSet* attrSet);
@@ -384,25 +416,26 @@
* given mode
*
* @param attributeSetsNames list of attribute set names
- * @param executionContext current execution context
- * @param sourceTree node for source tree
- * @param sourceNode source node
- * @param mode execution mode
+ * @param executionContext current execution context
+ * @param sourceTree node for source tree
+ * @param sourceNode source node
+ * @param mode execution mode
*/
void
applyAttrSets(
const QNameVectorType& attributeSetsNames,
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode) const;
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) const;
/**
* Determine whether default whitespace processing is in effect
*
- * @return number of immediate children of this node
+ * @return true if default whitespace processing is in effect
*/
- bool isDefaultSpaceProcessing() const
+ bool
+ isDefaultSpaceProcessing() const
{
return m_defaultSpace;
}
@@ -412,7 +445,8 @@
*
* @param bEnabled true if default processing should be enabled
*/
- void setDefaultSpaceProcessing(bool bEnabled)
+ void
+ setDefaultSpaceProcessing(bool bEnabled)
{
m_defaultSpace = bEnabled;
}
@@ -422,7 +456,8 @@
*
* @return vector of imported stylesheets
*/
- StylesheetVectorType& getImports()
+ StylesheetVectorType&
+ getImports()
{
return m_imports;
}
@@ -454,7 +489,8 @@
*
* @return true is there is a wrapper
*/
- bool isWrapperless() const
+ bool
+ isWrapperless() const
{
return m_isWrapperless;
}
@@ -464,7 +500,8 @@
*
* @param b true is there is a wrapper
*/
- void setWrapperless(bool b)
+ void
+ setWrapperless(bool b)
{
m_isWrapperless = b;
}
@@ -474,7 +511,8 @@
*
* @return stack of includes
*/
- URLStackType& getIncludeStack()
+ URLStackType&
+ getIncludeStack()
{
return m_includeStack;
}
@@ -482,8 +520,8 @@
/**
* Process the xsl:key element.
*
- * @param nsContext element providing context for namespaces
- * @param atts attribute list for element
+ * @param nsContext element providing context for namespaces
+ * @param atts attribute list for element
* @param constructionContext context for evaluation
*/
/*
@@ -494,7 +532,7 @@
* document tree, and build a hash table:
* a) keyed by name,
* b) each with a value of a hashtable, keyed by the value returned by
- * the use attribute,
+ * the use attribute,
* c) each with a value that is a nodelist.
* Thus, for a given key or keyref, look up hashtable by name,
* look up the nodelist by the given reference.
@@ -508,75 +546,74 @@
/**
* Locate a template via the "name" attribute.
*
- * @param name name of template
- * @param executionContext current execution context
+ * @param name name of template
+ * @param executionContext current execution context
* @return pointer to template found or 0 if none found
*/
virtual ElemTemplateElement*
findNamedTemplate(
- const DOMString& name,
- StylesheetExecutionContext& executionContext) const;
+ const XalanDOMString& name,
+ StylesheetExecutionContext& executionContext) const;
/**
* Locate a template via the "name" attribute.
*
- * @param name qualified name of template
- * @param executionContext current execution context
+ * @param name qualified name of template
+ * @param executionContext current execution context
* @return pointer to template found or 0 if none found
*/
virtual ElemTemplateElement*
findNamedTemplate(
const QName& qname,
- StylesheetExecutionContext& executionContext) const;
+ StylesheetExecutionContext& executionContext) const;
/**
* Given the name of a variable, return its corresponding XObject
*
- * @param name name of variable
- * @param executionContext current execution context
+ * @param name name of variable
+ * @param executionContext current execution context
* @return pointer to object
*/
- virtual XObject*
+ virtual XObject*
getTopLevelVariable(
- const DOMString& name,
- StylesheetExecutionContext& executionContext) const;
+ const XalanDOMString& name,
+ StylesheetExecutionContext& executionContext) const;
/**
* Given a target element, find the template that best matches in the given
* XSL document, according to the rules specified in the xsl draft.
*
* @param executionContext current execution context
- * @param sourceTree where the targetElem is to be found
- * @param targetNode element that needs a rule
- * @return pointer to rule that best matches targetNode
+ * @param sourceTree where the targetElem is to be found
+ * @param targetNode element that needs a rule
+ * @return pointer to rule that best matches targetNode
*/
virtual
- ElemTemplateElement*
+ ElemTemplate*
findTemplate(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& targetNode) const;
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* targetNode) const;
-
/**
* Given a target element, find the template that best matches in the given
* XSL document, according to the rules specified in the xsl draft.
*
* @param executionContext current execution context
- * @param sourceTree where the targetElem is to be found
- * @param targetElem element that needs a rule
- * @param mode string indicating the display mode
- * @param useImports means that this is an xsl:apply-imports commend
- * @param foundStylesheet if non-null, the Stylesheet that the found
- * template belongs to will be returned in the
- * foundStylesheet[0]
+ * @param sourceTree where the targetElem is to be found
+ * @param targetElem element that needs a rule
+ * @param mode string indicating the display mode
+ * @param useImports means that this is an xsl:apply-imports commend
+ * @param foundStylesheet if non-null, the Stylesheet that the found
+ * template belongs to will be returned in the
+ * foundStylesheet[0]
* @return pointer to rule that best matches targetElem
*/
virtual
- ElemTemplateElement*
+ ElemTemplate*
findTemplate(
- StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& targetNode,
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* targetNode,
const QName& mode,
bool useImports,
const Stylesheet*& foundStylesheet) const;
@@ -600,12 +637,12 @@
* @param stylesheet stylesheet for pattern
*/
MatchPattern2(
- const DOMString& pat,
- const XPath& exp,
- const ElemTemplate& theTemplate,
- int posInStylesheet,
- const DOMString& targetString,
- const Stylesheet& stylesheet);
+ const XalanDOMString& pat,
+ const XPath* exp,
+ ElemTemplate* theTemplate,
+ int posInStylesheet,
+ const XalanDOMString& targetString,
+ Stylesheet* stylesheet);
~MatchPattern2();
@@ -614,7 +651,8 @@
*
* @return stylesheet for pattern
*/
- const Stylesheet& getStylesheet() const
+ Stylesheet*
+ getStylesheet() const
{
return m_stylesheet;
}
@@ -624,7 +662,8 @@
*
* @return target string
*/
- const DOMString& getTargetString() const
+ const XalanDOMString&
+ getTargetString() const
{
return m_targetString;
}
@@ -634,7 +673,8 @@
*
* @return XPath expression for pattern
*/
- const XPath& getExpression() const
+ const XPath*
+ getExpression() const
{
return m_expression;
}
@@ -644,7 +684,8 @@
*
* @return position in stylesheet
*/
- int getPositionInStylesheet() const
+ int
+ getPositionInStylesheet() const
{
return m_posInStylesheet;
}
@@ -654,7 +695,8 @@
*
* @return string that contains element pattern
*/
- const DOMString& getPattern() const
+ const XalanDOMString&
+ getPattern() const
{
return m_pattern;
}
@@ -664,7 +706,8 @@
*
* @return template node
*/
- const ElemTemplate& getTemplate() const
+ ElemTemplate*
+ getTemplate() const
{
return m_template;
}
@@ -674,7 +717,8 @@
*
* @return priority of pattern
*/
- double getPriority() const
+ double
+ getPriority() const
{
return m_priority;
}
@@ -686,23 +730,25 @@
*/
// This is const because m_priority is mutable, which is an artifact of
// the design and our Java heritage.
- void setPriority(double thePriority) const
+ void
+ setPriority(double thePriority) const
{
m_priority = thePriority;
}
private:
- const Stylesheet& m_stylesheet;
- const DOMString m_targetString;
- const XPath& m_expression;
+
+ Stylesheet* m_stylesheet;
+ const XalanDOMString m_targetString;
+ const XPath* m_expression;
const int m_posInStylesheet;
- const DOMString m_pattern;
- const ElemTemplate& m_template; // ref to the corresponding template
+ const XalanDOMString m_pattern;
+ ElemTemplate* m_template; // ref to the corresponding template
/**
* Transient... only used to track priority while processing.
*/
- mutable double m_priority;
+ mutable double m_priority;
// Not implemented...
MatchPattern2();
@@ -710,13 +756,13 @@
};
#if defined(XALAN_NO_NAMESPACES)
- typedef list<MatchPattern2*> PatternTableListType;
- typedef vector<const MatchPattern2*> PatternTableVectorType;
- typedef map<DOMString, PatternTableListType> PatternTableMapType;
+ typedef list<MatchPattern2*> PatternTableListType;
+ typedef vector<const MatchPattern2*> PatternTableVectorType;
+ typedef map<XalanDOMString, PatternTableListType> PatternTableMapType;
#else
- typedef std::list<MatchPattern2*> PatternTableListType;
- typedef std::vector<const MatchPattern2*> PatternTableVectorType;
- typedef std::map<DOMString, PatternTableListType> PatternTableMapType;
+ typedef std::list<MatchPattern2*> PatternTableListType;
+ typedef std::vector<const MatchPattern2*> PatternTableVectorType;
+ typedef std::map<XalanDOMString, PatternTableListType> PatternTableMapType;
#endif
/**
@@ -727,8 +773,8 @@
*/
static void
addObjectIfNotFound(
- const MatchPattern2* thePattern,
- PatternTableVectorType& theVector);
+ const MatchPattern2* thePattern,
+ PatternTableVectorType& theVector);
/**
* Given a source node, locate the start of a list of possible template
@@ -737,29 +783,29 @@
* @param sourceNode source node for search of match patterns
*/
const PatternTableListType*
- locateMatchPatternList2(DOM_Node sourceNode) const;
+ locateMatchPatternList2(XalanNode* sourceNode) const;
/**
* Given an element type, locate the start of a list of
* possible template matches, possibly trying wild card matches.
*
* @param sourceElementType type of element to search
- * @param tryWildCard if true, use wild card matching
+ * @param tryWildCard if true, use wild card matching
*/
const PatternTableListType*
locateMatchPatternList2(
- const DOMString& sourceElementType,
- bool tryWildCard = false) const;
+ const XalanDOMString& sourceElementType,
+ bool tryWildCard = false) const;
/**
* Given a valid element key, return the corresponding node list.
*
- * @param doc source document
- * @param name name of the key, which must match the 'name'
- * attribute on xsl:key
- * @param ref value that must match the value found by the
- * 'match' attribute on xsl:key
- * @param resolver resolver for namespace resolution
+ * @param doc source document
+ * @param name name of the key, which must match the 'name'
+ * attribute on xsl:key
+ * @param ref value that must match the value found by the
+ * 'match' attribute on xsl:key
+ * @param resolver resolver for namespace resolution
* @param executionContext current execution context
* @return if the name was not declared with xsl:key, this will return
* null, if the identifier is not found, it will return an empty node set,
@@ -767,11 +813,12 @@
*/
const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ XalanNode* doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const;
+ XPathExecutionContext& executionContext,
+ KeyTablesTableType& theKeysTable) const;
/**
* Add an extension namespace handler. This provides methods for calling
@@ -781,7 +828,10 @@
* @param uri the URI of the extension namespace
* @param nsh handler
*/
- void addExtensionNamespace (const DOMString& uri, ExtensionNSHandler* nsh);
+ void
+ addExtensionNamespace(
+ const XalanDOMString& uri,
+ ExtensionNSHandler* nsh);
/**
* Return the handler for a given extension namespace.
@@ -789,7 +839,8 @@
* @param uri the URI of the extension namespace.
* @return pointer to extension handler
*/
- ExtensionNSHandler* lookupExtensionNSHandler (const DOMString& uri) const
+ ExtensionNSHandler*
+ lookupExtensionNSHandler(const XalanDOMString& uri) const
{
const ExtensionNamespacesMapType::const_iterator it =
m_extensionNamespaces.find(uri);
@@ -798,66 +849,14 @@
}
/**
- * Get the type of the node.
+ * Set a top level variable, to be serialized with the rest of the
+ * stylesheet.
*
- * @return number corresponding to node type
+ * @param var top-level variable declared with "xsl:variable" or
+ * xsl:param-variable.
*/
- virtual short
- getNodeType();
-
- /* Unimplemented. */
-
-/*
- DOM_DocumentType* getDoctype()
- { error("getDoctype not supported!"); return 0; }
-
- DOM_DOMImplementation* getImplementation()
- { error("getImplementation not supported!"); return 0; }
-
- DOM_Element* getDocumentElement()
- { error("getDocumentElement not supported!"); return 0; }
-
- DOM_Element* createElement(DOMString tagName)
- // throws DOMException
- { error("createElement not supported!"); return 0; }
-
- DOM_DocumentFragment* createDocumentFragment()
- { error("createDocumentFragment not supported!"); return 0; }
-
- DOM_Text* createTextNode(DOMString data)
- { error("createTextNode not supported!"); return 0; }
-
- DOM_Comment* createComment(DOMString data)
- { error("createComment not supported!"); return 0; }
-
- DOM_CDATASection* createCDATASection(DOMString data)
- //throws DOMException
- { error("createCDATASection not supported!"); return 0; }
-
- DOM_ProcessingInstruction* createProcessingInstruction(DOMString& target,
- DOMString& data)
- //throws DOMException
- { error("createProcessingInstruction not supported!"); return 0; }
-
- DOM_Attr* createAttribute(DOMString& name) // throws DOMException
- { error("createAttribute not supported!"); return 0; }
-
- DOM_EntityReference* createEntityReference(DOMString& name) // throws DOMException
- { error("createEntityReference not suppo->ted!"); return 0; }
-
- DOM_NodeList* getElementsByTagName(DOMString& tagname)
- { error("getElementsByTagName not supported!"); return 0; }
-*/
-
- /**
- * Set a top level variable, to be serialized with the rest of the
- * stylesheet.
- *
- * @param var top-level variable declared with "xsl:variable" or
- * xsl:param-variable.
- */
void
- setTopLevelVariable(ElemVariable* var)
+ setTopLevelVariable(ElemVariable* var)
{
m_topLevelVariables.push_back(var);
}
@@ -871,137 +870,325 @@
*/
void
pushTopLevelVariables(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
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 XalanDOMString
+ getNodeName() const;
+
+ virtual XalanDOMString
+ getNodeValue() const;
+
+ virtual NodeType
+ getNodeType() const;
+
+ virtual XalanNode*
+ getParentNode() const;
+
+ virtual const XalanNodeList*
+ getChildNodes() const;
+
+ virtual XalanNode*
+ getFirstChild() const;
+
+ virtual XalanNode*
+ getLastChild() const;
+
+ virtual XalanNode*
+ getPreviousSibling() const;
+
+ virtual XalanNode*
+ getNextSibling() const;
+
+ virtual const XalanNamedNodeMap*
+ getAttributes() const;
+
+ virtual XalanDocument*
+ getOwnerDocument() const;
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XalanNode*
+#else
+ virtual Stylehseet*
+#endif
+ cloneNode(bool deep) const;
+
+ virtual XalanNode*
+ insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild);
+
+ virtual XalanNode*
+ replaceChild(
+ XalanNode* newChild,
+ XalanNode* oldChild);
+
+ virtual XalanNode*
+ removeChild(XalanNode* oldChild);
+
+ virtual XalanNode*
+ appendChild(XalanNode* newChild);
+
+ virtual bool
+ hasChildNodes() const;
+
+ virtual void
+ setNodeValue(const XalanDOMString& nodeValue);
+
+ virtual void
+ normalize();
+
+ virtual bool
+ supports(
+ const XalanDOMString& feature,
+ const XalanDOMString& version) const;
+
+ virtual XalanDOMString
+ getNamespaceURI() const;
+
+ virtual XalanDOMString
+ getPrefix() const;
+
+ virtual XalanDOMString
+ getLocalName() const;
+
+ virtual void
+ setPrefix(const XalanDOMString& prefix);
+
+ virtual XalanElement*
+ createElement(const XalanDOMString& tagName);
+
+ virtual XalanDocumentFragment*
+ createDocumentFragment();
+
+ virtual XalanText*
+ createTextNode(const XalanDOMString& data);
+
+ virtual XalanComment*
+ createComment(const XalanDOMString& data);
+
+ virtual XalanCDATASection*
+ createCDATASection(const XalanDOMString& data);
+
+ virtual XalanProcessingInstruction*
+ createProcessingInstruction(
+ const XalanDOMString& target,
+ const XalanDOMString& data);
+
+ virtual XalanAttr*
+ createAttribute(const XalanDOMString& name);
+
+ virtual XalanEntityReference*
+ createEntityReference(const XalanDOMString &name);
+
+ virtual XalanDocumentType*
+ getDoctype() const;
+
+ virtual XalanDOMImplementation*
+ getImplementation() const;
+
+ virtual XalanElement*
+ getDocumentElement() const;
+
+ virtual XalanNodeList*
+ getElementsByTagName(const XalanDOMString& tagname) const;
+
+ virtual XalanNode*
+ importNode(
+ XalanNode* importedNode,
+ bool deep);
+
+ virtual XalanElement*
+ createElementNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& qualifiedName);
+
+ virtual XalanAttr*
+ createAttributeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& qualifiedName);
+
+ virtual XalanNodeList*
+ getElementsByTagNameNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName) const;
+
+ virtual XalanElement*
+ getElementById(const XalanDOMString& elementId) const;
+
+ // These interfaces are inherited from PrefixResolver...
+
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
+
+ virtual XalanDOMString
+ getURI() const;
+
protected:
/**
* The root of the stylesheet, where all the tables common to all
* stylesheets are kept.
*/
- StylesheetRoot& m_stylesheetRoot;
+ StylesheetRoot& m_stylesheetRoot;
/**
* Reference back to the owning XSLTProcessor object.
* JMD: This has to be a pointer,not a reference because of setXSLProcessor
*/
-// XSLTEngineImpl* m_processor;
+// XSLTEngineImpl* m_processor;
/**
* The base URL of the XSL document.
*/
- DOMString m_baseIdent;
+ XalanDOMString m_baseIdent;
private:
+
+ /**
+ * A lookup table of all space preserving elements.
+ */
+ XPathVectorType m_whitespacePreservingElements;
+
/**
+ * A lookup table of all space stripping elements.
+ */
+ XPathVectorType m_whitespaceStrippingElements;
+
+ /**
* The root XSL stylesheet.
*/
- DOM_Document m_document;
-
+ XalanDocument* m_document;
+
/**
* Table of tables of element keys. See KeyTable.
*/
- mutable KeyTableVectorType m_key_tables;
+ mutable KeyTableVectorType m_key_tables;
/**
* Table of KeyDeclaration objects, which are set by the
* xsl:key element.
*/
- KeyDeclarationVectorType m_keyDeclarations;
+ KeyDeclarationVectorType m_keyDeclarations;
- /**
- * This is set to true if an xsl:key directive is found.
- * Mainly for use by the XMLParserLiaison classes for
- * optimized processing of ids.
- * @serial
- */
- bool m_needToBuildKeysTable;
+ /**
+ * This is set to true if an xsl:key directive is found.
+ * Mainly for use by the XMLParserLiaison classes for
+ * optimized processing of ids.
+ * @serial
+ */
+ bool m_needToBuildKeysTable;
/**
* A vector of the -imported- XSL Stylesheets.
*/
- StylesheetVectorType m_imports;
+ StylesheetVectorType m_imports;
- /**
- * The default template to use for xsl:apply-templates when
- * a select attribute is not found.
- */
- const XPath* m_defaultATXpath;
+ /**
+ * The default template to use for xsl:apply-templates when
+ * a select attribute is not found.
+ */
+ const XPath* m_defaultATXpath;
/**
* A stack to keep track of the result tree namespaces.
*/
- NamespacesStackType m_namespaces;
+ NamespacesStackType m_namespaces;
- /**
- * A list of namespace declarations,
- * for mapping from prefix to namespace URI.
- */
- NamespaceVectorType m_namespaceDecls;
+ /**
+ * A list of namespace declarations,
+ * for mapping from prefix to namespace URI.
+ */
+ NamespaceVectorType m_namespaceDecls;
- /**
- * This is pushed on the m_resultNameSpaces stack 'till a xmlns attribute is
- * found.
- */
+ /**
+ * This is pushed on the m_resultNameSpaces stack 'till a xmlns attribute is
+ * found.
+ */
static const NamespaceVectorType s_emptyNamespace;
/**
* Tells if the stylesheet tables need to be rebuilt.
*/
- bool m_tablesAreInvalid;
+ bool m_tablesAreInvalid;
- /**
- * Tells if the stylesheet is without an xsl:stylesheet and xsl:template
- * wrapper.
- */
+ /**
+ * Tells if the stylesheet is without an xsl:stylesheet and xsl:template
+ * wrapper.
+ */
bool m_isWrapperless;
- /**
- * The manufactured template if there is no wrapper.
- */
+ /**
+ * The manufactured template if there is no wrapper.
+ */
ElemTemplate* m_wrapperlessTemplate;
- /**
- * The table of extension namespaces.
- */
+ /**
+ * The table of extension namespaces.
+ */
ExtensionNamespacesMapType m_extensionNamespaces;
- /**
- * The first template of the template children.
- */
+ /**
+ * The first template of the template children.
+ */
ElemTemplateElement* m_firstTemplate;
- /**
- * A stack of who's including who is needed in order to support "It is an
- * error if a stylesheet directly or indirectly includes itself."
- */
+ /**
+ * A stack of who's including who is needed in order to support "It is an
+ * error if a stylesheet directly or indirectly includes itself."
+ */
URLStackType m_includeStack;
-
- /**
- * Tell if this stylesheet has the default space handling
- * turned off or on according to the xml:space attribute.
- * @serial
- */
+
+ /**
+ * Tell if this stylesheet has the default space handling
+ * turned off or on according to the xml:space attribute.
+ * @serial
+ */
bool m_defaultSpace;
- /**
- * Keyed on string macro names, and holding values that are macro elements
- * in the XSL DOM tree. Initialized in initMacroLookupTable, and used in
- * findNamedTemplate.
- */
+ /**
+ * Keyed on string macro names, and holding values that are macro elements
+ * in the XSL DOM tree. Initialized in initMacroLookupTable, and used in
+ * findNamedTemplate.
+ */
ElemTemplateElementMapType m_namedTemplates;
- /**
- * Table for defined constants, keyed on the names.
- */
+ /**
+ * Table for defined constants, keyed on the names.
+ */
ElemVariableVectorType m_topLevelVariables;
- /**
- * The version of XSL that was declared.
- */
+ /**
+ * The version of XSL that was declared.
+ */
double m_XSLTVerDeclared;
const bool m_isRoot;
@@ -1013,21 +1200,22 @@
* to some degree of specifity.
*/
- /**
- * This table is keyed on the target elements of patterns, and contains linked
- * lists of the actual patterns that match the target element to some degree
- * of specifity.
- */
- PatternTableMapType m_patternTable;
+ /**
+ * This table is keyed on the target elements of patterns, and contains linked
+ * lists of the actual patterns that match the target element to some degree
+ * of specifity.
+ */
+ PatternTableMapType m_patternTable;
/**
* Table of attribute sets, keyed by set name.
*/
- // This can't be a map, since you can have multiple attribute sets of the
- // same name, could be a multimap but why bother
- AttributeSetMapType m_attributeSets;
+ AttributeSetMapType m_attributeSets;
+
+ XalanNodeListSurrogate m_surrogateChildren;
-}; // end Stylesheet class definition
+ ElemDecimalFormatVectorType m_elemDecimalFormats;
+};
1.3 +18 -19 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetConstructionContext.hpp 2000/02/29 20:54:24 1.2
+++ StylesheetConstructionContext.hpp 2000/04/11 15:09:29 1.3
@@ -69,11 +69,10 @@
-#include <dom/DOM_Node.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
-class DOMString;
class PrefixResolver;
class XPath;
class XMLURL;
@@ -103,7 +102,7 @@
* -2 if not in known namespace
*/
virtual int
- getAttrTok(const DOMString& name) const = 0;
+ getAttrTok(const XalanDOMString& name) const = 0;
/**
* Determine the fully qualified URI for a string.
@@ -112,7 +111,7 @@
* @return pointer to fully qualified URI
*/
virtual XMLURL*
- getURLFromString(const DOMString& urlString) = 0;
+ getURLFromString(const XalanDOMString& urlString) = 0;
/**
* Determine the fully qualified URI for a string.
@@ -123,8 +122,8 @@
*/
virtual XMLURL*
getURLFromString(
- const DOMString& urlString,
- const DOMString& base) = 0;
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) = 0;
/**
* Retrieve the prefix for XSL namespace URI's, for example,
@@ -132,7 +131,7 @@
*
* @return prefix string
*/
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURLPre() const = 0;
/**
@@ -141,7 +140,7 @@
*
* @return URI string
*/
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURL() const = 0;
/**
@@ -155,7 +154,7 @@
*/
virtual XPath*
createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver) = 0;
/**
@@ -169,28 +168,28 @@
*/
virtual XPath*
createXPath(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver) = 0;
// These interfaces are inherited from ExecutionContext...
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.2 +20 -20 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetConstructionContextDefault.cpp 2000/01/26 14:29:44 1.1
+++ StylesheetConstructionContextDefault.cpp 2000/04/11 15:09:29 1.2
@@ -94,39 +94,39 @@
void
StylesheetConstructionContextDefault::error(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
- m_processor.error(styleNode, sourceNode, msg);
+ m_processor.error(msg, styleNode, sourceNode);
}
void
StylesheetConstructionContextDefault::warn(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
- m_processor.warn(styleNode, sourceNode, msg);
+ m_processor.warn(msg, styleNode, sourceNode);
}
void
StylesheetConstructionContextDefault::message(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
- m_processor.message(styleNode, sourceNode, msg);
+ m_processor.message(msg, styleNode, sourceNode);
}
int
-StylesheetConstructionContextDefault::getAttrTok(const DOMString& name) const
+StylesheetConstructionContextDefault::getAttrTok(const XalanDOMString& name) const
{
return m_processor.getAttrTok(name);
}
@@ -134,7 +134,7 @@
XMLURL*
-StylesheetConstructionContextDefault::getURLFromString(const DOMString& urlString)
+StylesheetConstructionContextDefault::getURLFromString(const XalanDOMString& urlString)
{
return m_processor.getURLFromString(urlString);
}
@@ -143,15 +143,15 @@
XMLURL*
StylesheetConstructionContextDefault::getURLFromString(
- const DOMString& urlString,
- const DOMString& base)
+ const XalanDOMString& urlString,
+ const XalanDOMString& base)
{
return m_processor.getURLFromString(urlString, base);
}
-const DOMString&
+const XalanDOMString&
StylesheetConstructionContextDefault::getXSLNameSpaceURLPre() const
{
return m_processor.getXSLNameSpaceURLPre();
@@ -159,7 +159,7 @@
-const DOMString&
+const XalanDOMString&
StylesheetConstructionContextDefault::getXSLNameSpaceURL() const
{
return m_processor.getXSLNameSpaceURL();
@@ -169,7 +169,7 @@
XPath*
StylesheetConstructionContextDefault::createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
XPath* const xpath = m_xpathFactory.create();
@@ -187,7 +187,7 @@
XPath*
StylesheetConstructionContextDefault::createXPath(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
XPath* const xpath = m_xpathFactory.create();
1.3 +23 -17 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetConstructionContextDefault.hpp 2000/02/29 20:54:24 1.2
+++ StylesheetConstructionContextDefault.hpp 2000/04/11 15:09:29 1.3
@@ -72,6 +72,7 @@
#include <memory>
+
class XObjectFactory;
class XPathEnvSupport;
class XPathFactory;
@@ -103,49 +104,49 @@
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
// These interfaces are inherited from StylesheetConstructionContext...
virtual int
- getAttrTok(const DOMString& name) const;
+ getAttrTok(const XalanDOMString& name) const;
virtual XMLURL*
- getURLFromString(const DOMString& urlString);
+ getURLFromString(const XalanDOMString& urlString);
virtual XMLURL*
getURLFromString(
- const DOMString& urlString,
- const DOMString& base);
+ const XalanDOMString& urlString,
+ const XalanDOMString& base);
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURLPre() const;
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURL() const;
virtual XPath*
createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver);
virtual XPath*
createXPath(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver);
private:
@@ -155,7 +156,12 @@
XObjectFactory& m_xobjectFactory;
XPathFactory& m_xpathFactory;
+#if defined(XALAN_NO_NAMESPACES)
+ auto_ptr<XPathProcessor> m_xpathProcessor;
+#else
std::auto_ptr<XPathProcessor> m_xpathProcessor;
+#endif
+
};
1.5 +80 -89 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StylesheetExecutionContext.hpp 2000/03/06 17:17:54 1.4
+++ StylesheetExecutionContext.hpp 2000/04/11 15:09:29 1.5
@@ -64,9 +64,7 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -76,8 +74,6 @@
class AttributeList;
-class DOM_Element;
-class DOMString;
class ElemTemplateElement;
class FormatterListener;
class PrefixResolver;
@@ -85,6 +81,9 @@
class QName;
class Stylesheet;
class StylesheetRoot;
+class XalanElement;
+class XalanNode;
+class XalanDocument;
class XPath;
class XPathExecutionContext;
class XObject;
@@ -112,8 +111,8 @@
* @param theNode child node
* @return parent node of 'theNode'
*/
- virtual const DOM_Node
- getParentOfNode(const DOM_Node& theNode) const = 0;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& theNode) const = 0;
/**
* Retrieve execution context
@@ -146,7 +145,7 @@
* @return pointer to XObject for variable
*/
virtual XObject*
- getTopLevelVariable(const DOMString& theName) const = 0;
+ getTopLevelVariable(const XalanDOMString& theName) const = 0;
/**
* Determine whether conflicts should be reported.
@@ -161,7 +160,7 @@
*
* @return root document
*/
- virtual const DOM_Document
+ virtual XalanDocument*
getRootDocument() const = 0;
/**
@@ -170,14 +169,14 @@
* @param theDocument root document
*/
virtual void
- setRootDocument(const DOM_Document& theDocument) = 0;
+ setRootDocument(XalanDocument* theDocument) = 0;
/**
* Create a new empty document.
*
* @return new document
*/
- virtual const DOM_Document
+ virtual XalanDocument*
createDocument() const = 0;
/**
@@ -196,8 +195,8 @@
*/
virtual void
resetCurrentState(
- const DOM_Node& sourceTree,
- const DOM_Node& xmlNode) = 0;
+ XalanNode* sourceTree,
+ XalanNode* xmlNode) = 0;
/**
* Whether diagnostic output is to be generated
@@ -213,7 +212,7 @@
* @param theString string to print
*/
virtual void
- diag(const DOMString& theString) = 0;
+ diag(const XalanDOMString& theString) = 0;
/**
* Mark the time, so that displayDuration can later display the elapsed
@@ -232,8 +231,8 @@
*/
virtual void
displayDuration(
- const DOMString& theMessage,
- const void* theKey) = 0;
+ const XalanDOMString& theMessage,
+ const void* theKey) = 0;
/**
* Retrieve list of attributes yet to be processed
@@ -248,7 +247,7 @@
*
* @return element name
*/
- virtual DOMString
+ virtual XalanDOMString
getPendingElementName() const = 0;
/**
@@ -269,9 +268,9 @@
*/
virtual void
replacePendingAttribute(
- const XMLCh* theName,
- const XMLCh* theNewType,
- const XMLCh* theNewValue) = 0;
+ const XalanDOMChar* theName,
+ const XalanDOMChar* theNewType,
+ const XalanDOMChar* theNewValue) = 0;
/**
* Changes the currently pending element name.
@@ -279,7 +278,7 @@
* @param elementName new name of element
*/
virtual void
- setPendingElementName(const DOMString& elementName) = 0;
+ setPendingElementName(const XalanDOMString& elementName) = 0;
/**
* Add a result attribute to the list of pending attributes.
@@ -289,8 +288,8 @@
*/
virtual void
addResultAttribute(
- const DOMString& aname,
- const DOMString& value) = 0;
+ const XalanDOMString& aname,
+ const XalanDOMString& value) = 0;
/**
* Add namespace attributes for a node to the list of pending attributes.
@@ -301,7 +300,7 @@
*/
virtual void
copyNamespaceAttributes(
- const DOM_Node& src,
+ const XalanNode& src,
bool srcIsStylesheetTree) = 0;
/**
@@ -309,25 +308,23 @@
*
* @param theNamespace namespace for prefix
*/
- virtual DOMString
- getResultPrefixForNamespace(
- const DOMString& theNamespace) const = 0;
+ virtual XalanDOMString
+ getResultPrefixForNamespace(const XalanDOMString& theNamespace) const = 0;
/**
* Retrieve the result namespace corresponding to a prefix.
*
* @param thePrefix prefix for namespace
*/
- virtual DOMString
- getResultNamespaceForPrefix(
- const DOMString& thePrefix) const = 0;
+ virtual XalanDOMString
+ getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const = 0;
/**
* Generate a random namespace prefix guaranteed to be unique.
*
* @return unique namespace prefix
*/
- virtual DOMString
+ virtual XalanDOMString
getUniqueNameSpaceValue() const = 0;
/**
@@ -365,8 +362,8 @@
*/
virtual XObject*
executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
const PrefixResolver& resolver) = 0;
/**
@@ -380,9 +377,9 @@
*/
virtual XObject*
executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
- const DOM_Element& resolver) = 0;
+ const XalanDOMString& str,
+ XalanNode* contextNode,
+ const XalanElement& resolver) = 0;
/**
* Create and initialize an xpath and return it. This is to be used to
@@ -394,7 +391,7 @@
*/
virtual XPath*
createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver) = 0;
/**
@@ -405,11 +402,11 @@
* @param namespaceContext context for namespace resolution
* @param stringedValue value to evaluate
*/
- virtual const DOMString
+ virtual const XalanDOMString
evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue) = 0;
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue) = 0;
/**
* Push a named variable onto the processor variable stack
@@ -422,7 +419,7 @@
pushVariable(
const QName& name,
XObject* var,
- const DOM_Node& element) = 0;
+ const XalanNode* element) = 0;
/**
* Push a context marker onto the stack to let us know when to stop
@@ -433,8 +430,8 @@
*/
virtual void
pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode) = 0;
+ const XalanNode* caller,
+ const XalanNode* sourceNode) = 0;
/**
* Pop the current context from the current context stack.
@@ -467,10 +464,10 @@
virtual void
pushParams(
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate) = 0;
+ const XalanNode* targetTemplate) = 0;
/**
* Given a name, return a string representing the value, but don't look in
@@ -525,8 +522,7 @@
* @exception SAXException
*/
virtual void
- startElement(
- const XMLCh* name) = 0;
+ startElement(const XalanDOMChar* name) = 0;
/**
* Receive notification of the end of an element.
@@ -543,8 +539,7 @@
* @exception SAXException
*/
virtual void
- endElement(
- const XMLCh* name) = 0;
+ endElement(const XalanDOMChar* name) = 0;
/**
* Receive notification of character data.
@@ -570,9 +565,9 @@
*/
virtual void
characters(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length) = 0;
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length) = 0;
/**
* Receive notification of character data. If available, when the
@@ -586,9 +581,9 @@
*/
virtual void
charactersRaw(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length) = 0;
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length) = 0;
/**
* Called when a Comment is to be constructed.
@@ -597,8 +592,7 @@
* @exception SAXException
*/
virtual void
- comment(
- const XMLCh* data) = 0;
+ comment(const XalanDOMChar* data) = 0;
/**
* Receive notification of a processing instruction.
@@ -617,8 +611,8 @@
*/
virtual void
processingInstruction(
- const XMLCh* target,
- const XMLCh* data) = 0;
+ const XalanDOMChar* target,
+ const XalanDOMChar* data) = 0;
/**
* Flush the pending element.
@@ -636,10 +630,10 @@
*/
virtual void
cloneToResultTree(
- const DOM_Node& node,
- bool isLiteral,
- bool overrideStrip,
- bool shouldCloneAttributes) = 0;
+ XalanNode& node,
+ bool isLiteral,
+ bool overrideStrip,
+ bool shouldCloneAttributes) = 0;
/**
* Create an XObject that represents a Result tree fragment.
@@ -651,9 +645,9 @@
*/
virtual XObject*
createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode) = 0;
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) = 0;
/**
* Create an XObject that represents a Result tree fragment.
@@ -666,10 +660,10 @@
*/
virtual XObject*
createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode) = 0;
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode) = 0;
/**
* Given a result tree fragment, walk the tree and
@@ -685,7 +679,7 @@
*
* @return Xalan namespace URI
*/
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURL() const = 0;
/**
@@ -693,7 +687,7 @@
*
* @return Xalan namespace for extensions
*/
- virtual const DOMString&
+ virtual const XalanDOMString&
getXalanXSLNameSpaceURL() const = 0;
/**
@@ -712,7 +706,7 @@
*/
virtual void
traceSelect(
- const DOM_Element& theTemplate,
+ const XalanElement& theTemplate,
const NodeRefListBase& nl) const = 0;
/**
@@ -721,8 +715,7 @@
* @return true if element on stack
*/
virtual bool
- findOnElementRecursionStack(
- const ElemTemplateElement* theElement) const = 0;
+ findOnElementRecursionStack(const ElemTemplateElement* theElement) const = 0;
/**
* Push an element onto the recursion stack.
@@ -730,8 +723,7 @@
* @param theElement pointer to element to push
*/
virtual void
- pushOnElementRecursionStack(
- const ElemTemplateElement* theElement) = 0;
+ pushOnElementRecursionStack(const ElemTemplateElement* theElement) = 0;
/**
* Pop an element off the recursion stack.
@@ -776,22 +768,21 @@
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const = 0;
-
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.4 +86 -82 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StylesheetExecutionContextDefault.cpp 2000/03/01 20:43:43 1.3
+++ StylesheetExecutionContextDefault.cpp 2000/04/11 15:09:30 1.4
@@ -69,8 +69,12 @@
#include <XPath/XPathExecutionContext.hpp>
#include <XPath/QName.hpp>
+
+
#include <XMLSupport/XMLParserLiaison.hpp>
+
+
#include "StylesheetRoot.hpp"
#include "XSLTEngineImpl.hpp"
@@ -96,9 +100,9 @@
void
StylesheetExecutionContextDefault::error(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
m_xpathExecutionContext.error(msg, sourceNode, styleNode);
}
@@ -107,9 +111,9 @@
void
StylesheetExecutionContextDefault::warn(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
m_xpathExecutionContext.warn(msg, sourceNode, styleNode);
}
@@ -118,17 +122,17 @@
void
StylesheetExecutionContextDefault::message(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& styleNode) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
{
m_xpathExecutionContext.message(msg, sourceNode, styleNode);
}
-const DOM_Node
-StylesheetExecutionContextDefault::getParentOfNode(const DOM_Node& theNode) const
+XalanNode*
+StylesheetExecutionContextDefault::getParentOfNode(const XalanNode& theNode) const
{
return m_xpathExecutionContext.getParentOfNode(theNode);
}
@@ -150,6 +154,7 @@
}
+
void
StylesheetExecutionContextDefault::setContextNodeList(const NodeRefListBase& theContextNodeList)
{
@@ -159,7 +164,7 @@
XObject*
-StylesheetExecutionContextDefault::getTopLevelVariable(const DOMString& theName) const
+StylesheetExecutionContextDefault::getTopLevelVariable(const XalanDOMString& theName) const
{
return m_xsltProcessor.getTopLevelVariable(theName);
}
@@ -174,7 +179,7 @@
-const DOM_Document
+XalanDocument*
StylesheetExecutionContextDefault::getRootDocument() const
{
return m_xsltProcessor.getRootDoc();
@@ -183,14 +188,14 @@
void
-StylesheetExecutionContextDefault::setRootDocument(const DOM_Document& theDocument)
+StylesheetExecutionContextDefault::setRootDocument(XalanDocument* theDocument)
{
m_xsltProcessor.setRootDoc(theDocument);
}
-const DOM_Document
+XalanDocument*
StylesheetExecutionContextDefault::createDocument() const
{
return m_xsltProcessor.getXMLParserLiaison().createDocument();
@@ -210,8 +215,8 @@
void
StylesheetExecutionContextDefault::resetCurrentState(
- const DOM_Node& sourceTree,
- const DOM_Node& xmlNode)
+ XalanNode* sourceTree,
+ XalanNode* xmlNode)
{
m_xsltProcessor.resetCurrentState(sourceTree, xmlNode);
}
@@ -226,12 +231,13 @@
void
-StylesheetExecutionContextDefault::diag(const DOMString& theString)
+StylesheetExecutionContextDefault::diag(const XalanDOMString& theString)
{
m_xsltProcessor.diag(theString);
}
+
void
StylesheetExecutionContextDefault::pushTime(const void* theKey)
{
@@ -239,15 +245,17 @@
}
+
void
StylesheetExecutionContextDefault::displayDuration(
- const DOMString& theMessage,
- const void* theKey)
+ const XalanDOMString& theMessage,
+ const void* theKey)
{
m_xsltProcessor.displayDuration(theMessage, theKey);
}
+
const AttributeList&
StylesheetExecutionContextDefault::getPendingAttributes() const
{
@@ -256,7 +264,7 @@
-DOMString
+XalanDOMString
StylesheetExecutionContextDefault::getPendingElementName() const
{
return m_xsltProcessor.getPendingElementName();
@@ -274,9 +282,9 @@
void
StylesheetExecutionContextDefault::replacePendingAttribute(
- const XMLCh* theName,
- const XMLCh* theNewType,
- const XMLCh* theNewValue)
+ const XalanDOMChar* theName,
+ const XalanDOMChar* theNewType,
+ const XalanDOMChar* theNewValue)
{
// Make a copy of the attribute list, and modify it, to be more exception-safe.
AttributeListImpl thePendingAttributes(m_xsltProcessor.getPendingAttributes());
@@ -292,7 +300,7 @@
void
-StylesheetExecutionContextDefault::setPendingElementName(const DOMString& elementName)
+StylesheetExecutionContextDefault::setPendingElementName(const XalanDOMString& elementName)
{
m_xsltProcessor.setPendingElementName(elementName);
}
@@ -301,8 +309,8 @@
void
StylesheetExecutionContextDefault::addResultAttribute(
- const DOMString& aname,
- const DOMString& value)
+ const XalanDOMString& aname,
+ const XalanDOMString& value)
{
m_xsltProcessor.addResultAttribute(aname, value);
}
@@ -311,7 +319,7 @@
void
StylesheetExecutionContextDefault::copyNamespaceAttributes(
- const DOM_Node& src,
+ const XalanNode& src,
bool srcIsStylesheetTree)
{
m_xsltProcessor.copyNamespaceAttributes(src, srcIsStylesheetTree);
@@ -319,25 +327,24 @@
-DOMString
+XalanDOMString
StylesheetExecutionContextDefault::getResultPrefixForNamespace(
- const DOMString& theNamespace) const
+ const XalanDOMString& theNamespace) const
{
return m_xsltProcessor.getResultPrefixForNamespace(theNamespace);
}
-DOMString
-StylesheetExecutionContextDefault::getResultNamespaceForPrefix(
- const DOMString& thePrefix) const
+XalanDOMString
+StylesheetExecutionContextDefault::getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const
{
return m_xsltProcessor.getResultNamespaceForPrefix(thePrefix);
}
-DOMString
+XalanDOMString
StylesheetExecutionContextDefault::getUniqueNameSpaceValue() const
{
return m_xsltProcessor.getUniqueNSValue();
@@ -371,8 +378,8 @@
XObject*
StylesheetExecutionContextDefault::executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
const PrefixResolver& resolver)
{
return m_xsltProcessor.evalXPathStr(str,
@@ -385,9 +392,9 @@
XObject*
StylesheetExecutionContextDefault::executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
- const DOM_Element& resolver)
+ const XalanDOMString& str,
+ XalanNode* contextNode,
+ const XalanElement& resolver)
{
return m_xsltProcessor.evalXPathStr(str,
contextNode,
@@ -399,7 +406,7 @@
XPath*
StylesheetExecutionContextDefault::createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
return m_xsltProcessor.createMatchPattern(str, resolver);
@@ -407,11 +414,11 @@
-const DOMString
+const XalanDOMString
StylesheetExecutionContextDefault::evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue)
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue)
{
return m_xsltProcessor.evaluateAttrVal(contextNode,
namespaceContext,
@@ -425,7 +432,7 @@
StylesheetExecutionContextDefault::pushVariable(
const QName& name,
XObject* var,
- const DOM_Node& element)
+ const XalanNode* element)
{
m_xsltProcessor.pushVariable(name, var, element);
}
@@ -434,8 +441,8 @@
void
StylesheetExecutionContextDefault::pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode)
+ const XalanNode* caller,
+ const XalanNode* sourceNode)
{
m_xsltProcessor.pushContextMarker(caller, sourceNode);
}
@@ -469,10 +476,10 @@
void
StylesheetExecutionContextDefault::pushParams(
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate)
+ const XalanNode* targetTemplate)
{
m_xsltProcessor.pushParams(*this,
xslCallTemplateElement,
@@ -510,9 +517,9 @@
void
StylesheetExecutionContextDefault::characters(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length)
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length)
{
m_xsltProcessor.characters(ch, start, length);
}
@@ -521,9 +528,9 @@
void
StylesheetExecutionContextDefault::charactersRaw(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length)
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length)
{
m_xsltProcessor.charactersRaw(ch, start, length);
}
@@ -531,8 +538,7 @@
void
-StylesheetExecutionContextDefault::comment(
- const XMLCh* data)
+StylesheetExecutionContextDefault::comment(const XalanDOMChar* data)
{
m_xsltProcessor.comment(data);
}
@@ -541,8 +547,8 @@
void
StylesheetExecutionContextDefault::processingInstruction(
- const XMLCh* target,
- const XMLCh* data)
+ const XalanDOMChar* target,
+ const XalanDOMChar* data)
{
m_xsltProcessor.processingInstruction(target, data);
}
@@ -550,8 +556,7 @@
void
-StylesheetExecutionContextDefault::startElement(
- const XMLCh* name)
+StylesheetExecutionContextDefault::startElement(const XalanDOMChar* name)
{
m_xsltProcessor.startElement(name);
}
@@ -559,8 +564,7 @@
void
-StylesheetExecutionContextDefault::endElement(
- const XMLCh* name)
+StylesheetExecutionContextDefault::endElement(const XalanDOMChar* name)
{
m_xsltProcessor.endElement(name);
}
@@ -577,10 +581,10 @@
void
StylesheetExecutionContextDefault::cloneToResultTree(
- const DOM_Node& node,
- bool isLiteral,
- bool overrideStrip,
- bool shouldCloneAttributes)
+ XalanNode& node,
+ bool isLiteral,
+ bool overrideStrip,
+ bool shouldCloneAttributes)
{
m_xsltProcessor.cloneToResultTree(node,
isLiteral,
@@ -592,9 +596,9 @@
XObject*
StylesheetExecutionContextDefault::createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode)
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode)
{
return createXResultTreeFrag(templateChild,
sourceTree,
@@ -606,10 +610,10 @@
XObject*
StylesheetExecutionContextDefault::createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode)
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode)
{
std::auto_ptr<ResultTreeFragBase>
theFragment(m_xsltProcessor.createResultTreeFrag(*this,
@@ -631,20 +635,22 @@
-const DOMString&
+const XalanDOMString&
StylesheetExecutionContextDefault::getXSLNameSpaceURL() const
{
return m_xsltProcessor.getXSLNameSpaceURL();
}
-const DOMString&
+
+const XalanDOMString&
StylesheetExecutionContextDefault::getXalanXSLNameSpaceURL() const
{
return m_xsltProcessor.getXalanXSLNameSpaceURL();
}
+
bool
StylesheetExecutionContextDefault::isTraceSelect() const
{
@@ -654,7 +660,7 @@
void
StylesheetExecutionContextDefault::traceSelect(
- const DOM_Element& theTemplate,
+ const XalanElement& theTemplate,
const NodeRefListBase& nl) const
{
m_xsltProcessor.traceSelect(theTemplate, nl);
@@ -663,8 +669,7 @@
bool
-StylesheetExecutionContextDefault::findOnElementRecursionStack(
- const ElemTemplateElement* theElement) const
+StylesheetExecutionContextDefault::findOnElementRecursionStack(const ElemTemplateElement* theElement) const
{
const ElementRecursionStackType::const_iterator i =
std::find(m_elementRecursionStack.begin(),
@@ -677,8 +682,7 @@
void
-StylesheetExecutionContextDefault::pushOnElementRecursionStack(
- const ElemTemplateElement* theElement)
+StylesheetExecutionContextDefault::pushOnElementRecursionStack(const ElemTemplateElement* theElement)
{
assert(findOnElementRecursionStack(theElement) == false);
1.5 +82 -92 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StylesheetExecutionContextDefault.hpp 2000/03/01 20:43:44 1.4
+++ StylesheetExecutionContextDefault.hpp 2000/04/11 15:09:30 1.5
@@ -92,8 +92,8 @@
// These interfaces are inherited from StylesheetExecutionContext...
- virtual const DOM_Node
- getParentOfNode(const DOM_Node& theNode) const;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& theNode) const;
virtual XPathExecutionContext&
getXPathExecutionContext();
@@ -105,18 +105,18 @@
setContextNodeList(const NodeRefListBase& theContextNodeList);
virtual XObject*
- getTopLevelVariable(const DOMString& theName) const;
+ getTopLevelVariable(const XalanDOMString& theName) const;
virtual bool
getQuietConflictWarnings() const;
- virtual const DOM_Document
+ virtual XalanDocument*
getRootDocument() const;
virtual void
- setRootDocument(const DOM_Document& theDocument);
+ setRootDocument(XalanDocument* theDocument);
- virtual const DOM_Document
+ virtual XalanDocument*
createDocument() const;
virtual void
@@ -124,27 +124,27 @@
virtual void
resetCurrentState(
- const DOM_Node& sourceTree,
- const DOM_Node& xmlNode);
+ XalanNode* sourceTree,
+ XalanNode* xmlNode);
virtual bool
doDiagnosticsOutput() const;
virtual void
- diag(const DOMString& theString);
+ diag(const XalanDOMString& theString);
virtual void
pushTime(const void* theKey);
virtual void
displayDuration(
- const DOMString& theMessage,
- const void* theKey);
+ const XalanDOMString& theMessage,
+ const void* theKey);
virtual const AttributeList&
getPendingAttributes() const;
- virtual DOMString
+ virtual XalanDOMString
getPendingElementName() const;
virtual void
@@ -152,32 +152,30 @@
virtual void
replacePendingAttribute(
- const XMLCh* theName,
- const XMLCh* theNewType,
- const XMLCh* theNewValue);
+ const XalanDOMChar* theName,
+ const XalanDOMChar* theNewType,
+ const XalanDOMChar* theNewValue);
virtual void
- setPendingElementName(const DOMString& elementName);
+ setPendingElementName(const XalanDOMString& elementName);
virtual void
addResultAttribute(
- const DOMString& aname,
- const DOMString& value);
+ const XalanDOMString& aname,
+ const XalanDOMString& value);
virtual void
copyNamespaceAttributes(
- const DOM_Node& src,
+ const XalanNode& src,
bool srcIsStylesheetTree);
- virtual DOMString
- getResultPrefixForNamespace(
- const DOMString& theNamespace) const;
-
- virtual DOMString
- getResultNamespaceForPrefix(
- const DOMString& thePrefix) const;
+ virtual XalanDOMString
+ getResultPrefixForNamespace(const XalanDOMString& theNamespace) const;
- virtual DOMString
+ virtual XalanDOMString
+ getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const;
+
+ virtual XalanDOMString
getUniqueNameSpaceValue() const;
virtual FormatterListener*
@@ -191,37 +189,37 @@
virtual XObject*
executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
const PrefixResolver& resolver);
virtual XObject*
executeXPath(
- const DOMString& str,
- const DOM_Node& contextNode,
- const DOM_Element& resolver);
+ const XalanDOMString& str,
+ XalanNode* contextNode,
+ const XalanElement& resolver);
virtual XPath*
createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver);
- virtual const DOMString
+ virtual const XalanDOMString
evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue);
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue);
virtual void
pushVariable(
const QName& name,
XObject* var,
- const DOM_Node& element);
+ const XalanNode* element);
virtual void
pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode);
+ const XalanNode* caller,
+ const XalanNode* sourceNode);
virtual void
popCurrentContext();
@@ -235,10 +233,10 @@
virtual void
pushParams(
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate);
+ const XalanNode* targetTemplate);
virtual XObject*
getParamVariable(const QName& theName) const;
@@ -250,68 +248,61 @@
endDocument();
virtual void
- characters(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length);
+ startElement(const XalanDOMChar* name);
virtual void
- charactersRaw(
- const XMLCh* ch,
- unsigned int start,
- unsigned int length);
+ endElement(const XalanDOMChar* name);
virtual void
- comment(
- const XMLCh* data);
+ characters(
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length);
virtual void
- processingInstruction(
- const XMLCh* target,
- const XMLCh* data);
+ charactersRaw(
+ const XalanDOMChar* ch,
+ unsigned int start,
+ unsigned int length);
virtual void
- startElement(
- const XMLCh* name);
+ comment(const XalanDOMChar* data);
virtual void
- endElement(
- const XMLCh* name);
+ processingInstruction(
+ const XalanDOMChar* target,
+ const XalanDOMChar* data);
virtual void
flushPending();
virtual void
cloneToResultTree(
- const DOM_Node& node,
- bool isLiteral,
- bool overrideStrip,
- bool shouldCloneAttributes);
+ XalanNode& node,
+ bool isLiteral,
+ bool overrideStrip,
+ bool shouldCloneAttributes);
virtual XObject*
createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode);
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode);
virtual XObject*
createXResultTreeFrag(
- const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
- const QName& mode);
-
- /**
- * Given a result tree fragment, walk the tree and
- * output it to the result stream.
- */
+ const ElemTemplateElement& templateChild,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
+ const QName& mode);
+
virtual void
outputResultTreeFragment(const XObject& theTree);
- virtual const DOMString&
+ virtual const XalanDOMString&
getXSLNameSpaceURL() const;
- virtual const DOMString&
+ virtual const XalanDOMString&
getXalanXSLNameSpaceURL() const;
virtual bool
@@ -319,39 +310,38 @@
virtual void
traceSelect(
- const DOM_Element& theTemplate,
+ const XalanElement& theTemplate,
const NodeRefListBase& nl) const;
virtual bool
- findOnElementRecursionStack(
- const ElemTemplateElement* theElement) const;
+ findOnElementRecursionStack(const ElemTemplateElement* theElement) const;
virtual void
- pushOnElementRecursionStack(
- const ElemTemplateElement* theElement);
+ pushOnElementRecursionStack(const ElemTemplateElement* theElement);
virtual const ElemTemplateElement*
popElementRecursionStack();
+
// These interfaces are inherited from ExecutionContext...
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
private:
1.15 +332 -214 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- StylesheetHandler.cpp 2000/03/21 03:22:48 1.14
+++ StylesheetHandler.cpp 2000/04/11 15:09:30 1.15
@@ -85,6 +85,7 @@
#include "ElemComment.hpp"
#include "ElemCopy.hpp"
#include "ElemCopyOf.hpp"
+#include "ElemDecimalFormat.hpp"
#include "ElemElement.hpp"
#include "ElemEmpty.hpp"
#include "ElemExtensionCall.hpp"
@@ -117,10 +118,12 @@
Stylesheet& stylesheetTree,
StylesheetConstructionContext& constructionContext) :
FormatterListener(),
+ m_pendingException(),
+ m_exceptionPending(false),
m_processor(processor),
m_stylesheet(stylesheetTree),
m_constructionContext(constructionContext),
- m_includeBase(),
+ m_includeBase(stylesheetTree.getBaseIdentifier()),
m_pTemplate(0),
m_pLastPopped(0),
m_inTemplate(false),
@@ -133,20 +136,29 @@
m_pLXSLTExtensionNSH(0),
m_elemStack()
{
- m_includeBase = m_stylesheet.getBaseIdentifier();
}
StylesheetHandler::~StylesheetHandler()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
// Clean up the element stack vector
- std::for_each(m_elemStack.begin(),
- m_elemStack.end(),
- DeleteFunctor<ElemTemplateElement>());
+ for_each(m_elemStack.begin(),
+ m_elemStack.end(),
+ DeleteFunctor<ElemTemplateElement>());
+
+ // Clean up the whitespace elements.
+ for_each(m_whiteSpaceElems.begin(),
+ m_whiteSpaceElems.end(),
+ DeleteFunctor<ElemTemplateElement>());
}
+
void StylesheetHandler::setDocumentLocator(const Locator* const locator)
{
m_processor.pushLocatorOnStack(locator);
@@ -155,9 +167,9 @@
void StylesheetHandler::startDocument()
{
- m_pendingException = "";
+ m_exceptionPending = false;
- // No other action for the moment.
+ clear(m_pendingException);
}
@@ -165,31 +177,41 @@
{
m_processor.popLocatorStack();
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
{
throw SAXException(toCharArray(m_pendingException));
}
}
-bool StylesheetHandler::isAttrOK(const DOMString& attrName, const AttributeList& atts, int which)
+bool
+StylesheetHandler::isAttrOK(
+ const XalanDOMChar* attrName,
+ const AttributeList& atts,
+ int which)
{
return m_stylesheet.isAttrOK(attrName, atts, which, m_constructionContext);
}
-bool StylesheetHandler::processSpaceAttr(const DOMString& aname, const AttributeList& atts, int which)
+
+bool
+StylesheetHandler::processSpaceAttr(
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which)
{
- const bool isSpaceAttr = equals(aname, "xml:space");
+ const bool isSpaceAttr = equals(aname, XALAN_STATIC_UCODE_STRING("xml:space"));
if(isSpaceAttr)
{
- const DOMString spaceVal = atts.getValue(which);
- if(equals(spaceVal, "default"))
+ const XalanDOMChar* const spaceVal = atts.getValue(which);
+
+ if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")))
{
m_stylesheet.setDefaultSpaceProcessing(true);
}
- else if(equals(spaceVal, "preserve"))
+ else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")))
{
m_stylesheet.setDefaultSpaceProcessing(false);
}
@@ -203,45 +225,47 @@
}
-void StylesheetHandler::startElement (const XMLCh* const name, AttributeList& atts)
+
+void
+StylesheetHandler::startElement (const XMLCh* const name, AttributeList& atts)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
try
{
- m_whiteSpaceElems.erase(m_whiteSpaceElems.begin(),m_whiteSpaceElems.end());
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
+ // Clean up the whitespace elements.
+ for_each(m_whiteSpaceElems.begin(),
+ m_whiteSpaceElems.end(),
+ DeleteFunctor<ElemTemplateElement>());
- const Locator* const locator = m_processor.getLocatorFromStack();
+ m_whiteSpaceElems.clear();
- int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
- int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
-
- if(false)
- {
- DOMString id;
+ const Locator* const locator = m_processor.getLocatorFromStack();
- if (locator)
- if (locator->getPublicId())
- id = locator->getPublicId();
- else
- id = locator->getSystemId();
+ const int lineNumber = 0 != locator ? locator->getLineNumber() : 0;
+ const int columnNumber = 0 != locator ? locator->getColumnNumber() : 0;
- assert(locator);
-
- // if(0 != locator)
- // System.out.println(id + "; line " + lineNumber + "; "+columnNumber);
- }
-
// First push namespaces
m_stylesheet.pushNamespaces(atts);
+
+ const XalanDOMString ns = m_stylesheet.getNamespaceFromStack(name);
- DOMString ns = m_stylesheet.getNamespaceFromStack(name);
+ const unsigned int nameLength = length(name);
+ const unsigned int index = indexOf(name,':');
- int index = indexOf(name,':');
+ const XalanDOMString localName = index == nameLength ? XalanDOMString(name) : substring(name, index + 1);
- DOMString localName = (index < 0) ? DOMString(name) : substring(name,index+1);
+ if(length(ns) == 0 && nameLength == length(localName))
+ {
+ // Warn that there is a prefix that was not resolved...
+ m_constructionContext.warn(XalanDOMString("Could not resolve prefix ") + name);
+ }
ElemTemplateElement* elem = 0;
@@ -261,11 +285,11 @@
XSLTEngineImpl::AttributeKeysMapType::const_iterator iter=
XSLTEngineImpl::getElementKeys().find(localName);
- int xslToken = (iter!= XSLTEngineImpl::getElementKeys().end()) ? (*iter).second : -2;
+ int xslToken = iter!= XSLTEngineImpl::getElementKeys().end() ? (*iter).second : -2;
if(!m_inTemplate)
{
- if(m_foundStylesheet && (Constants::ELEMNAME_IMPORT != xslToken))
+ if(m_foundStylesheet && Constants::ELEMNAME_IMPORT != xslToken)
{
m_foundNotImport = true;
}
@@ -286,11 +310,11 @@
break;
case Constants::ELEMNAME_EXTENSION:
- if(!equalsIgnoreCase(ns,m_processor.getXalanXSLNameSpaceURL()))
+ if(!equalsIgnoreCase(ns, m_processor.getXalanXSLNameSpaceURL()))
{
- m_processor.warn("Old syntax: the functions instruction should use a url of "+m_processor.getXalanXSLNameSpaceURL());
+ m_constructionContext.warn("Old syntax: the functions instruction should use a url of " + m_processor.getXalanXSLNameSpaceURL());
}
- // m_processor.handleFunctionsInstruction((Element)child);
+ // m_constructionContext.handleFunctionsInstruction((Element)child);
break;
case Constants::ELEMNAME_VARIABLE:
@@ -314,30 +338,34 @@
break;
case Constants::ELEMNAME_LOCALE:
- m_processor.warn("xsl:locale not yet supported!");
+ m_processor.warn(XALAN_STATIC_UCODE_STRING("xsl:locale not yet supported!"));
break;
case Constants::ELEMNAME_PRESERVESPACE:
case Constants::ELEMNAME_STRIPSPACE:
{
+ // $$$ ToDo: We should separate this out into a separate function.
ElemEmpty nsNode(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
- const int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
bool foundIt = false;
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
if(equals(aname, Constants::ATTRNAME_ELEMENTS))
{
foundIt = true;
- StringTokenizer tokenizer(atts.getValue(i), " \t\n\r");
+
+ StringTokenizer tokenizer(atts.getValue(i),
+ XALAN_STATIC_UCODE_STRING(" \t\n\r"));
+
while(tokenizer.hasMoreTokens())
{
// Use only the root, at least for right now.
- const DOMString wildcardName = tokenizer.nextToken();
+ const XalanDOMString wildcardName = tokenizer.nextToken();
/**
* Creating a match pattern is too much overhead, but it's a reasonably
@@ -349,23 +377,23 @@
if(Constants::ELEMNAME_PRESERVESPACE == xslToken)
{
- m_stylesheet.getStylesheetRoot().m_whitespacePreservingElements.push_back(matchPat);
+ m_stylesheet.getStylesheetRoot().pushWhitespacePreservingElement(matchPat);
}
else
{
- m_stylesheet.getStylesheetRoot().m_whitespaceStrippingElements.push_back(matchPat);
+ m_stylesheet.getStylesheetRoot().pushWhitespaceStrippingElement(matchPat);
}
}
}
else if(!isAttrOK(aname, atts, i))
{
- m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
+ m_constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(!foundIt)
{
- DOMString msg("(StylesheetHandler) " + DOMString(name) +
+ XalanDOMString msg("(StylesheetHandler) " + XalanDOMString(name) +
" requires a " + Constants::ATTRNAME_ELEMENTS + " attribute!");
throw SAXException(toCharArray(msg));
@@ -407,6 +435,26 @@
m_stylesheet.getStylesheetRoot().processOutputSpec(name, atts, m_constructionContext);
break;
+ case Constants::ELEMNAME_DECIMALFORMAT:
+ {
+ ElemDecimalFormat* const edf =
+ new ElemDecimalFormat(m_constructionContext,
+ m_stylesheet,
+ name,
+ atts,
+ lineNumber,
+ columnNumber);
+
+ m_stylesheet.processDecimalFormatElement(edf, atts, m_constructionContext);
+ }
+ break;
+
+ case Constants::ELEMNAME_NSALIAS:
+ {
+ m_stylesheet.processNSAliasElement(name, atts, m_constructionContext);
+ }
+ break;
+
case Constants::ELEMNAME_WITHPARAM:
case Constants::ELEMNAME_ATTRIBUTE:
case Constants::ELEMNAME_APPLY_TEMPLATES:
@@ -441,7 +489,7 @@
case Constants::ELEMNAME_COUNTERSCOPE:
case Constants::ELEMNAME_APPLY_IMPORTS:
{
- DOMString msg("(StylesheetHandler) " + DOMString(name) + " not allowed inside a stylesheet!");
+ XalanDOMString msg("(StylesheetHandler) " + XalanDOMString(name) + " not allowed inside a stylesheet!");
throw SAXException(toCharArray(msg));
}
@@ -451,16 +499,18 @@
{
m_stylesheet.setWrapperless(false);
m_foundStylesheet = true;
- const int nAttrs = atts.getLength();
- bool fVersionFound = false;
+
+ const unsigned int nAttrs = atts.getLength();
+
+ bool fVersionFound = false;
// bool didSpecifiyIndent = false; //doesn't seem to be used
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
- if(equals(aname, "result-ns"))
+ if(equals(aname, XALAN_STATIC_UCODE_STRING("result-ns")))
{
throw SAXException("result-ns no longer supported! Use xsl:output instead.");
}
@@ -471,33 +521,35 @@
else if(equals(aname, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
{
// BEGIN SANJIVA CODE
- StringTokenizer tokenizer(atts.getValue (i), " \t\n\r", false);
+ StringTokenizer tokenizer(atts.getValue(i),
+ XALAN_STATIC_UCODE_STRING(" \t\n\r"),
+ false);
while(tokenizer.hasMoreTokens ())
{
- const DOMString prefix = tokenizer.nextToken ();
+ const XalanDOMString prefix = tokenizer.nextToken();
// SANJIVA: ask Scott: is the line below correct?
- const DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack(prefix);
+ const XalanDOMString extns = m_stylesheet.getNamespaceForPrefixFromStack(prefix);
ExtensionNSHandler* const nsh = new ExtensionNSHandler (m_processor, extns);
m_stylesheet.addExtensionNamespace(extns, nsh);
}
// END SANJIVA CODE
}
- else if(equals(aname, "id"))
+ else if(equals(aname, XALAN_STATIC_UCODE_STRING("id")))
{
//
}
- else if(equals(aname, "indent-result"))
+ else if(equals(aname, XALAN_STATIC_UCODE_STRING("indent-result")))
{
throw SAXException("indent-result no longer supported! Use xsl:output instead.");
}
- else if(equals(aname, "version"))
+ else if(equals(aname, XALAN_STATIC_UCODE_STRING("version")))
{
- const DOMString versionStr = atts.getValue(i);
+ const XalanDOMChar* const versionStr = atts.getValue(i);
- m_stylesheet.setXSLTVerDeclared(DOMStringToDouble(versionStr));
+ m_stylesheet.setXSLTVerDeclared(WideStringToDouble(versionStr));
fVersionFound = true;
}
@@ -505,7 +557,7 @@
{
if(false == m_stylesheet.isWrapperless())
{
- DOMString msg("(StylesheetHandler) " + DOMString(name) +
+ XalanDOMString msg("(StylesheetHandler) " + XalanDOMString(name) +
" has an illegal attribute: " + aname);
throw SAXException(toCharArray(msg));
@@ -520,7 +572,7 @@
if (fVersionFound == false)
{
-// const DOMString msg("The stylesheet element did not specify a version attribute!");
+// const XalanDOMString msg("The stylesheet element did not specify a version attribute!");
// throw SAXException(toCharArray(msg));
}
@@ -529,7 +581,7 @@
default:
{
- DOMString msg("Unknown XSL element: " + localName);
+ XalanDOMString msg("Unknown XSL element: " + localName);
throw SAXException(toCharArray(msg));
}
@@ -562,20 +614,21 @@
case Constants::ELEMNAME_FOREACH:
elem = new ElemForEach(m_constructionContext,
m_stylesheet,
- name, atts, lineNumber, columnNumber, true);
+ name, atts, lineNumber, columnNumber);
break;
case Constants::ELEMNAME_SORT:
{
- ElemForEach* foreach = dynamic_cast<ElemForEach*>(m_elemStack.back());
+ ElemForEach* foreach = static_cast<ElemForEach*>(m_elemStack.back());
ElemSort* sortElem = new ElemSort(m_constructionContext,
m_stylesheet,
name, atts, lineNumber, columnNumber);
-
+
// Note: deleted in ElemForEach destructor
foreach->getSortElems().push_back(sortElem);
- sortElem->setParentNode(foreach);
+
+ sortElem->setParentNodeElem(foreach);
}
break;
@@ -627,10 +680,10 @@
if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
{
- ElemTemplateElement* const lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
+ ElemTemplateElement* const lastChild = parent->getLastChildElem();
- if((0 == lastChild) ||
- (Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
+ if(0 == lastChild ||
+ Constants::ELEMNAME_WHEN == lastChild->getXSLToken())
{
elem = new ElemWhen(m_constructionContext,
m_stylesheet,
@@ -654,10 +707,10 @@
if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
{
- ElemTemplateElement* lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
+ ElemTemplateElement* lastChild = parent->getLastChildElem();
- if((0 == lastChild) ||
- (Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
+ if(0 == lastChild ||
+ Constants::ELEMNAME_WHEN == lastChild->getXSLToken())
{
elem = new ElemOtherwise(m_constructionContext,
m_stylesheet,
@@ -744,7 +797,7 @@
case Constants::ELEMNAME_PRESERVESPACE:
case Constants::ELEMNAME_STRIPSPACE:
{
- DOMString msg("(StylesheetHandler) " + DOMString(name) + " is not allowed inside a template!");
+ XalanDOMString msg("(StylesheetHandler) " + XalanDOMString(name) + " is not allowed inside a template!");
throw SAXException(toCharArray(msg));
}
break;
@@ -754,7 +807,7 @@
// supported, don't flag an error.
if(XSLTEngineImpl::getXSLTVerSupported() < m_stylesheet.getXSLTVerDeclared())
{
- DOMString msg("Unknown XSL element: " + localName);
+ XalanDOMString msg("Unknown XSL element: " + localName);
throw SAXException(toCharArray(msg));
}
}
@@ -763,50 +816,50 @@
// BEGIN SANJIVA CODE
else if (!m_inTemplate && startsWith(ns,m_processor.getXalanXSLNameSpaceURL()))
{
- if (equals(localName, "component"))
+ if (equals(localName, XALAN_STATIC_UCODE_STRING("component")))
{
- DOMString prefix;
- DOMString elements;
- DOMString functions;
+ XalanDOMString prefix;
+ XalanDOMString elements;
+ XalanDOMString functions;
const int nAttrs = atts.getLength();
- for (int i = 0; i < nAttrs; i++)
+ for (int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName (i);
+ const XalanDOMChar* const aname = atts.getName (i);
- if (equals(aname, "prefix"))
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("prefix")))
{
prefix = atts.getValue (i);
}
- else if (equals(aname, "elements"))
+ else if (equals(aname, XALAN_STATIC_UCODE_STRING("elements")))
{
elements = atts.getValue (i);
}
- else if (equals(aname, "functions"))
+ else if (equals(aname, XALAN_STATIC_UCODE_STRING("functions")))
{
functions = atts.getValue (i);
}
else if(!isAttrOK(aname, atts, i))
{
- m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
+ m_constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if (isEmpty(prefix))
{
- DOMString msg("StylesheetHandler) " + DOMString(name) + " attribute 'prefix' is missing");
+ XalanDOMString msg("StylesheetHandler) " + XalanDOMString(name) + " attribute 'prefix' is missing");
throw SAXException(toCharArray(msg));
}
// SCOTT: is the line below correct?
- DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack (prefix);
+ XalanDOMString extns = m_stylesheet.getNamespaceForPrefixFromStack (prefix);
ExtensionNSHandler* nsh = m_stylesheet.lookupExtensionNSHandler(extns);
if (nsh == 0)
{
- DOMString msg("(StylesheetHandler) " + DOMString(name) + " extension namespace prefix '" + prefix + "' unknown");
+ XalanDOMString msg("(StylesheetHandler) " + XalanDOMString(name) + " extension namespace prefix '" + prefix + "' unknown");
throw SAXException(toCharArray(msg));
}
@@ -824,33 +877,33 @@
m_pLXSLTExtensionNSH = nsh; // hang on to it for processing
// endElement on lxslt:script
}
- else if (equals(localName, "script"))
+ else if (equals(localName, XALAN_STATIC_UCODE_STRING("script")))
{
// process this in end element so that I can see whether I had
// a body as well. The default pushing logic will save the
// attributes for me. The body will be accumulated into the
// following string buffer
m_inLXSLTScript = true;
- m_LXSLTScriptBody = DOMString();
+ m_LXSLTScriptBody = XalanDOMString();
const int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
- if (equals(aname, "lang"))
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("lang")))
{
m_LXSLTScriptLang = atts.getValue (i);
}
- else if (aname.equals ("src"))
+ else if (equals(aname, XALAN_STATIC_UCODE_STRING("src")))
{
m_LXSLTScriptSrcURL = atts.getValue (i);
}
else if(!isAttrOK(aname, atts, i))
{
- m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
+ m_constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -898,16 +951,14 @@
// END SANJIVA CODE
}
- if(m_inTemplate && (0 != elem))
+ if(m_inTemplate && 0 != elem)
{
if(!m_elemStack.empty())
{
ElemTemplateElement* const parent = m_elemStack.back();
- parent->appendChild(elem);
+ parent->appendChildElem(elem);
}
- assert(dynamic_cast<ElemTemplateElement *>(elem));
-
m_elemStack.push_back(elem);
}
@@ -928,28 +979,51 @@
// and then throw the exception during endDocument
catch(SAXException& e)
{
+ m_exceptionPending = true;
+
m_pendingException = e.getMessage();
+ m_elemStack.clear();
}
+ catch(...)
+ {
+ // $$$ ToDo: This probably should't happen, but it does...
+ m_exceptionPending = true;
+
+ m_elemStack.clear();
+
+ throw;
+ }
}
-ElemTemplateElement* StylesheetHandler::initWrapperless (const DOMString& name,
+ElemTemplateElement* StylesheetHandler::initWrapperless (const XalanDOMString& name,
const AttributeList& atts, int lineNumber, int columnNumber)
{
m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
AttributeListImpl templateAttrs;
- templateAttrs.addAttribute(c_wstr("name"), c_wstr("CDATA"), c_wstr("simple"));
+ templateAttrs.addAttribute(c_wstr(XALAN_STATIC_UCODE_STRING("name")),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(XALAN_STATIC_UCODE_STRING("simple")));
- m_pTemplate = new ElemTemplate(m_constructionContext, m_stylesheet, "xsl:template",
- templateAttrs, lineNumber, columnNumber);
+ m_pTemplate = new ElemTemplate(m_constructionContext,
+ m_stylesheet,
+ XALAN_STATIC_UCODE_STRING("xsl:template"),
+ templateAttrs,
+ lineNumber,
+ columnNumber);
- ElemTemplateElement* pElem = new ElemLiteralResult(m_constructionContext,
- m_stylesheet, name, atts, lineNumber, columnNumber);
+ ElemTemplateElement* const pElem =
+ new ElemLiteralResult(m_constructionContext,
+ m_stylesheet,
+ name,
+ atts,
+ lineNumber,
+ columnNumber);
- m_pTemplate->appendChild(pElem);
+ m_pTemplate->appendChildElem(pElem);
m_inTemplate = true;
m_stylesheet.setWrapperlessTemplate(m_pTemplate);
@@ -957,7 +1031,7 @@
m_foundStylesheet = true;
m_stylesheet.setWrapperless(true);
- if(name.equals("HTML"))
+ if(equals(name, XALAN_STATIC_UCODE_STRING("HTML")))
{
m_stylesheet.getStylesheetRoot().setIndentResult(true);
m_stylesheet.getStylesheetRoot().setOutputMethod(Formatter::OUTPUT_METH_HTML);
@@ -988,16 +1062,20 @@
}
-void StylesheetHandler::processImport(const DOMString& name, const AttributeList& atts)
+void
+StylesheetHandler::processImport(
+ const XalanDOMChar* name,
+ const AttributeList& atts)
{
- int nAttrs = atts.getLength();
- bool foundIt = false;
+ const unsigned int nAttrs = atts.getLength();
+
+ bool foundIt = false;
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
- if(aname.equals(Constants::ATTRNAME_HREF))
+ if(equals(aname, Constants::ATTRNAME_HREF))
{
foundIt = true;
@@ -1006,9 +1084,9 @@
throw SAXException("Imports can only occur as the first elements in the stylesheet!");
}
- const DOMString saved_XSLNameSpaceURL = m_processor.getXSLNameSpaceURL();
+ const XalanDOMString saved_XSLNameSpaceURL = m_processor.getXSLNameSpaceURL();
- const DOMString href = atts.getValue(i);
+ const XalanDOMString href = atts.getValue(i);
const XMLURL* const hrefUrl = m_processor.getURLFromString(href, m_stylesheet.getBaseIdentifier());
assert(hrefUrl != 0);
@@ -1017,7 +1095,7 @@
if(stackContains(importStack, *hrefUrl))
{
- DOMString msg(DOMString(hrefUrl->getURLText()) + " is directly or indirectly importing itself!");
+ XalanDOMString msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly importing itself!");
throw SAXException(toCharArray(msg));
}
@@ -1033,7 +1111,7 @@
pImportedStylesheet->setBaseIdentifier(hrefUrl->getURLText());
- m_processor.parseXML(*hrefUrl, &tp, DOM_UnimplementedDocument(pImportedStylesheet));
+ m_processor.parseXML(*hrefUrl, &tp, pImportedStylesheet);
// I'm going to insert the elements in backwards order,
// so I can walk them 0 to n.
@@ -1046,96 +1124,76 @@
}
else if(!isAttrOK(aname, atts, i))
{
- m_constructionContext.error(name + " has an illegal attribute: " + aname);
+ m_constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
+
if(!foundIt)
{
- DOMString msg("Could not find href attribute for " + name);
+ XalanDOMString msg("Could not find href attribute for " + XalanDOMString(name));
throw SAXException(toCharArray(msg));
}
}
-void StylesheetHandler::processInclude(const DOMString& name, const AttributeList& atts)
+void
+StylesheetHandler::processInclude(
+ const XalanDOMChar* name,
+ const AttributeList& atts)
{
- int nAttrs = atts.getLength();
- bool foundIt = false;
+ const unsigned int nAttrs = atts.getLength();
+
+ bool foundIt = false;
- for(int i = 0; i < nAttrs; i++)
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- const DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
+
if(equals(aname, Constants::ATTRNAME_HREF))
{
foundIt = true;
- // Save state, so this class can be reused.
- ElemTemplateStackType saved_ElemStack(m_elemStack);
- m_elemStack.clear();
-
- ElemTemplate* saved_pTemplate = m_pTemplate;
- m_pTemplate = 0;
+ PushPopIncludeState theStateHandler(*this);
- ElemTemplateElement* saved_pLastPopped = m_pLastPopped;
- m_pLastPopped = 0;
+ const XalanDOMString href = atts.getValue(i);
- bool saved_inTemplate = m_inTemplate;
- m_inTemplate = false;
-
- bool saved_foundStylesheet = m_foundStylesheet;
- m_foundStylesheet = false;
-
- DOMString saved_XSLNameSpaceURL = m_processor.getXSLNameSpaceURL();
-
- bool saved_foundNotImport = m_foundNotImport;
- m_foundNotImport = false;
-
- const DOMString href = atts.getValue(i);
-
assert(m_stylesheet.getIncludeStack().back() != 0);
const XMLURL* const hrefUrl = m_processor.getURLFromString(href, m_stylesheet.getIncludeStack().back()->getURLText());
if(stackContains(m_stylesheet.getIncludeStack(), *hrefUrl))
{
- DOMString msg(DOMString(hrefUrl->getURLText()) + " is directly or indirectly including itself!");
+ XalanDOMString msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly including itself!");
+
throw SAXException(toCharArray(msg));
}
-
+
m_stylesheet.getIncludeStack().push_back(hrefUrl);
- m_processor.parseXML(*hrefUrl, this, DOM_UnimplementedDocument(&m_stylesheet));
+ m_processor.parseXML(*hrefUrl, this, &m_stylesheet);
m_stylesheet.getIncludeStack().pop_back();
- // We've got a whole new set of pointers in the m_elemStack vector
- // from the include, need to get rid of them
- this->~StylesheetHandler();
-
- m_elemStack = saved_ElemStack;
- m_pTemplate = saved_pTemplate;
- m_pLastPopped = saved_pLastPopped;
- m_inTemplate = saved_inTemplate;
- m_foundStylesheet = saved_foundStylesheet;
- m_processor.setXSLNameSpaceURL(saved_XSLNameSpaceURL);
- m_foundNotImport = saved_foundNotImport;
}
else if(!isAttrOK(aname, atts, i))
{
- m_constructionContext.error(name+ " has an illegal attribute: " + aname);
+ m_constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
+
if(!foundIt)
{
- DOMString msg("Could not find href attribute for " + DOMString(name));
+ XalanDOMString msg("Could not find href attribute for " + XalanDOMString(name));
+
throw SAXException(toCharArray(msg));
}
}
+
void StylesheetHandler::endElement(const XMLCh* const name)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
m_stylesheet.popNamespaces();
@@ -1144,7 +1202,7 @@
m_elemStack.pop_back();
m_pLastPopped->setFinishedConstruction(true);
- int tok = m_pLastPopped->getXSLToken();
+ const int tok = m_pLastPopped->getXSLToken();
if(Constants::ELEMNAME_TEMPLATE == tok)
{
@@ -1153,7 +1211,8 @@
else if((Constants::ELEMNAME_PARAMVARIABLE == tok) ||
Constants::ELEMNAME_VARIABLE == tok)
{
- ElemVariable* var = dynamic_cast<ElemVariable *>(m_pLastPopped);
+ ElemVariable* const var = static_cast<ElemVariable*>(m_pLastPopped);
+
if(var->isTopLevel())
{
// Top-level param or variable
@@ -1164,17 +1223,26 @@
{
m_inTemplate = false;
}
+ else if (tok == Constants::ELEMNAME_UNDEFINED ||
+ tok == Constants::ELEMNAME_TEXT)
+ {
+ // These are stray elements, so delete them...
+ delete m_pLastPopped;
+ }
+
// BEGIN SANJIVA CODE
if (m_inLXSLTScript)
{
if (isEmpty(m_LXSLTScriptLang))
{
- DOMString msg(DOMString(name) + " attribute \'lang\' is missing");
+ XalanDOMString msg(XalanDOMString(name) + " attribute \'lang\' is missing");
+
throw SAXException(toCharArray(msg));
}
if (m_pLXSLTExtensionNSH == 0)
{
- DOMString msg("(StylesheetHandler) misplaced " + DOMString(name) + " element?? Missing container element " + "'component'");
+ XalanDOMString msg("(StylesheetHandler) misplaced " + XalanDOMString(name) + " element?? Missing container element " + "'component'");
+
throw SAXException(toCharArray(msg));
}
@@ -1194,26 +1262,27 @@
void StylesheetHandler::characters (const XMLCh* const chars, const unsigned int length)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
if(m_inTemplate)
{
- ElemTemplateElement* parent = m_elemStack.back();
- bool preserveSpace = false;
- bool disableOutputEscaping = false;
+ ElemTemplateElement* parent = m_elemStack.back();
+ bool preserveSpace = false;
+ bool disableOutputEscaping = false;
+
if(Constants::ELEMNAME_TEXT == parent->getXSLToken())
{
- disableOutputEscaping = (dynamic_cast<ElemText*>(parent))->getDisableOutputEscaping();
+ disableOutputEscaping = static_cast<ElemText*>(parent)->getDisableOutputEscaping();
parent = m_elemStack[m_elemStack.size()-2];
preserveSpace = true;
}
const Locator* const locator = m_processor.getLocatorFromStack();
- const int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
- const int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
+ const int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
+ const int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
ElemTextLiteral *elem = new ElemTextLiteral(m_constructionContext,
m_stylesheet,
@@ -1228,40 +1297,44 @@
{
while(!m_whiteSpaceElems.empty())
{
- ElemTextLiteral* whiteElem = m_whiteSpaceElems.back();
- m_whiteSpaceElems.pop_back();
+ parent->appendChildElem(m_whiteSpaceElems.back());
- parent->appendChild(whiteElem);
+ m_whiteSpaceElems.pop_back();
}
- parent->appendChild(elem);
- elem=0;
+ parent->appendChildElem(elem);
+
+ elem = 0;
}
else if(isWhite)
{
- bool shouldPush = true;
- NodeImpl* last = parent->getLastChild();
+ bool shouldPush = true;
+
+ ElemTemplateElement* const last = parent->getLastChildElem();
+
if(0 != last)
{
- ElemTemplateElement* lastElem = dynamic_cast<ElemTemplateElement *>(last);
- if(Constants::ELEMNAME_TEXTLITERALRESULT == lastElem->getXSLToken() &&
- !(dynamic_cast<ElemTextLiteral *>(lastElem))->isPreserveSpace())
+ if(Constants::ELEMNAME_TEXTLITERALRESULT == last->getXSLToken() &&
+ static_cast<ElemTextLiteral*>(last)->isPreserveSpace() == false)
{
- parent->appendChild(elem);
+ parent->appendChildElem(elem);
+
shouldPush = false;
}
}
+
if(shouldPush)
{
m_whiteSpaceElems.push_back(elem);
- elem=0;
+
+ elem = 0;
}
}
}
// BEGIN SANJIVA CODE
else if (m_inLXSLTScript)
{
- DOMString tmpStr(chars, length);
+ XalanDOMString tmpStr(chars, length);
append(m_LXSLTScriptBody,tmpStr);
}
// END SANJIVA CODE
@@ -1272,18 +1345,19 @@
void StylesheetHandler::cdata(const XMLCh* const chars, const unsigned int length)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
if(m_inTemplate)
{
- ElemTemplateElement* parent = m_elemStack.back();
- bool preserveSpace = false;
- bool disableOutputEscaping = false;
+ ElemTemplateElement* parent = m_elemStack.back();
+
+ bool preserveSpace = false;
+ bool disableOutputEscaping = false;
if(Constants::ELEMNAME_TEXT == parent->getXSLToken())
{
- disableOutputEscaping = (static_cast<ElemText*>(parent))->getDisableOutputEscaping();
+ disableOutputEscaping = static_cast<ElemText*>(parent)->getDisableOutputEscaping();
parent = m_elemStack[m_elemStack.size()-2];
preserveSpace = true;
}
@@ -1306,28 +1380,29 @@
{
while(!m_whiteSpaceElems.empty())
{
- ElemTextLiteral *whiteElem = m_whiteSpaceElems.back();
- m_whiteSpaceElems.pop_back();
+ parent->appendChildElem(m_whiteSpaceElems.back());
- parent->appendChild(whiteElem);
+ m_whiteSpaceElems.pop_back();
}
- parent->appendChild(elem);
+
+ parent->appendChildElem(elem);
}
else if(isWhite)
{
- bool shouldPush = true;
- NodeImpl* last = parent->getLastChild();
+ bool shouldPush = true;
+
+ ElemTemplateElement* const last = parent->getLastChildElem();
+
if(0 != last)
{
- ElemTemplateElement* lastElem = dynamic_cast<ElemTemplateElement*>(last);
-
- if(Constants::ELEMNAME_TEXTLITERALRESULT == lastElem->getXSLToken() &&
- !dynamic_cast<ElemTextLiteral*>(lastElem)->isPreserveSpace())
+ if(Constants::ELEMNAME_TEXTLITERALRESULT == last->getXSLToken() &&
+ static_cast<ElemTextLiteral*>(last)->isPreserveSpace() == false)
{
- parent->appendChild(elem);
+ parent->appendChildElem(elem);
shouldPush = false;
}
}
+
if(shouldPush)
m_whiteSpaceElems.push_back(elem);
}
@@ -1345,7 +1420,7 @@
void StylesheetHandler::ignorableWhitespace (const XMLCh* const /*chars*/, const unsigned int /*length*/)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// Ignore!
@@ -1355,7 +1430,7 @@
void StylesheetHandler::processingInstruction (const XMLCh* const /*target*/, const XMLCh* const /*data*/)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// No action for the moment.
@@ -1365,7 +1440,7 @@
void StylesheetHandler::comment(const XMLCh* const /*data*/)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// No action for the moment.
@@ -1375,7 +1450,7 @@
void StylesheetHandler::entityReference(const XMLCh* const /*name*/)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// No action for the moment.
@@ -1385,7 +1460,7 @@
void StylesheetHandler::resetDocument()
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// No action for the moment.
@@ -1396,8 +1471,51 @@
StylesheetHandler::charactersRaw(const XMLCh* const /* chars */, const unsigned int /* length */)
{
// if we have apending exception, we don't want to even try to process this
- if (!isEmpty(m_pendingException))
+ if (m_exceptionPending == true)
return;
// No action for the moment.
+}
+
+
+
+StylesheetHandler::PushPopIncludeState::PushPopIncludeState(StylesheetHandler& theHandler) :
+ m_handler(theHandler),
+ m_elemStack(theHandler.m_elemStack),
+ m_pTemplate(theHandler.m_pTemplate),
+ m_pLastPopped(theHandler.m_pLastPopped),
+ m_inTemplate(theHandler.m_inTemplate),
+ m_foundStylesheet(theHandler.m_foundStylesheet),
+ m_XSLNameSpaceURL(theHandler.m_processor.getXSLNameSpaceURL()),
+ m_foundNotImport(theHandler.m_foundNotImport)
+{
+ m_handler.m_elemStack.clear();
+ m_handler.m_pTemplate = 0;
+ m_handler.m_pLastPopped = 0;
+ m_handler.m_inTemplate = false;
+ m_handler.m_foundStylesheet = false;
+ m_handler.m_foundNotImport = false;
+}
+
+
+
+StylesheetHandler::PushPopIncludeState::~PushPopIncludeState()
+{
+ // Clean up the element stack vector
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
+ // Clean up the element stack vector
+ for_each(m_handler.m_elemStack.begin(),
+ m_handler.m_elemStack.end(),
+ DeleteFunctor<ElemTemplateElement>());
+
+ m_handler.m_elemStack = m_elemStack;
+ m_handler.m_pTemplate = m_pTemplate;
+ m_handler.m_pLastPopped = m_pLastPopped;
+ m_handler.m_inTemplate = m_inTemplate;
+ m_handler.m_foundStylesheet = m_foundStylesheet;
+ m_handler.m_processor.setXSLNameSpaceURL(m_XSLNameSpaceURL);
+ m_handler.m_foundNotImport = m_foundNotImport;
}
1.9 +55 -14 xml-xalan/c/src/XSLT/StylesheetHandler.hpp
Index: StylesheetHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetHandler.hpp 2000/03/21 03:22:48 1.8
+++ StylesheetHandler.hpp 2000/04/11 15:09:30 1.9
@@ -70,7 +70,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -102,7 +102,7 @@
/**
* Stack to keep track of the current include base.
*/
- DOMString m_includeBase;
+ XalanDOMString m_includeBase;
/**
* Construct a StylesheetHandler ... it will add the DOM nodes
@@ -350,7 +350,11 @@
* @param which The index into the attribute list (not used at this time).
* @return True if this is a namespace name.
*/
- bool isAttrOK(const DOMString& attrName, const AttributeList& atts, int which);
+ bool
+ isAttrOK(
+ const XalanDOMChar* attrName,
+ const AttributeList& atts,
+ int which);
/**
* Tell whether or not this is a xml:space attribute and, if so, process it.
@@ -360,25 +364,35 @@
* @param which The index of the attribute into the attribute list.
* @return True if this is a xml:space attribute.
*/
- bool processSpaceAttr(const DOMString& aname, const AttributeList& atts, int which);
+ bool
+ processSpaceAttr(
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which);
/**
* Process xsl:import.
*/
- void processImport(const DOMString& name, const AttributeList& atts);
+ void
+ processImport(
+ const XalanDOMChar* name,
+ const AttributeList& atts);
/**
* Process xsl:include.
*/
- void processInclude(const DOMString& name, const AttributeList& atts);
-
+ void
+ processInclude(const XalanDOMChar* name,
+ const AttributeList& atts);
+
private:
// not implemented
StylesheetHandler(const StylesheetHandler &);
StylesheetHandler& operator=(const StylesheetHandler &);
- DOMString m_pendingException;
+ XalanDOMString m_pendingException;
+ bool m_exceptionPending;
typedef std::vector<ElemTemplateElement*> ElemTemplateStackType;
@@ -447,23 +461,50 @@
// BEGIN SANJIVA CODE
bool m_inLXSLTScript;
- DOMString m_LXSLTScriptBody;
- DOMString m_LXSLTScriptLang;
- DOMString m_LXSLTScriptSrcURL;
+ XalanDOMString m_LXSLTScriptBody;
+ XalanDOMString m_LXSLTScriptLang;
+ XalanDOMString m_LXSLTScriptSrcURL;
ExtensionNSHandler* m_pLXSLTExtensionNSH;
// END SANJIVA CODE
/**
* Init the wrapperless template
*/
- ElemTemplateElement* initWrapperless (const DOMString& name,
+ ElemTemplateElement* initWrapperless (const XalanDOMString& name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
+ class PushPopIncludeState
+ {
+ public:
+
+ PushPopIncludeState(StylesheetHandler& theHandler);
+
+ ~PushPopIncludeState();
+
+ private:
+
+ StylesheetHandler& m_handler;
+
+ ElemTemplateStackType m_elemStack;
+
+ ElemTemplate* const m_pTemplate;
+
+ ElemTemplateElement* const m_pLastPopped;
+
+ const bool m_inTemplate;
+
+ const bool m_foundStylesheet;
+
+ const XalanDOMString m_XSLNameSpaceURL;
+
+ const bool m_foundNotImport;
+ };
+
+ friend class PushPopIncludeState;
};
-#endif // XALAN_STYLESHEETHANDLER_HEADER_GUARD
-// $ Log: $
+#endif // XALAN_STYLESHEETHANDLER_HEADER_GUARD
1.8 +202 -196 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StylesheetRoot.cpp 2000/03/23 12:59:36 1.7
+++ StylesheetRoot.cpp 2000/04/11 15:09:30 1.8
@@ -71,33 +71,43 @@
#include <sax/SAXException.hpp>
+
+
#include <util/XMLURL.hpp>
+
+#include <XalanDOM/XalanDocumentFragment.hpp>
+
+
+
+#include <PlatformSupport/StringTokenizer.hpp>
+#include <PlatformSupport/AttributeListImpl.hpp>
+
-#include <Include/DOMHelper.hpp>
#include <XPath/XPathFactory.hpp>
#include <XPath/XPathProcessor.hpp>
+
+
#include <XMLSupport/Formatter.hpp>
#include <XMLSupport/FormatterToHTML.hpp>
#include <XMLSupport/FormatterToText.hpp>
#include <XMLSupport/FormatterToXML.hpp>
#include <XMLSupport/FormatterToDOM.hpp>
-#include <PlatformSupport/StringTokenizer.hpp>
-#include <PlatformSupport/AttributeListImpl.hpp>
+
#include <XercesPlatformSupport/XercesDOMPrintWriter.hpp>
#include <XercesPlatformSupport/XercesStdTextOutputStream.hpp>
+
+#include "Constants.hpp"
#include "ElemApplyTemplates.hpp"
#include "ElemTemplate.hpp"
#include "ElemValueOf.hpp"
-
-#include "Constants.hpp"
#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
#include "TraceListener.hpp"
@@ -112,9 +122,11 @@
* halt processing.
*/
StylesheetRoot::StylesheetRoot(
- const DOMString& baseIdentifier,
+ const XalanDOMString& baseIdentifier,
StylesheetConstructionContext& constructionContext) :
- Stylesheet(*this, baseIdentifier, constructionContext),
+ Stylesheet(*this,
+ baseIdentifier,
+ constructionContext),
m_importStack(),
m_resultNameSpaceURL(),
m_outputmethod(Formatter::OUTPUT_METH_XML),
@@ -158,54 +170,37 @@
{
// Clean up all entries in the vector.
std::for_each(m_importStack.begin(),
- m_importStack.end(),
- DeleteFunctor<XMLURL>());
+ m_importStack.end(),
+ DeleteFunctor<XMLURL>());
- if (m_defaultRule != 0)
- {
- NodeImpl* const child = m_defaultRule->getFirstChild();
- m_defaultRule->removeChild(child);
- delete child;
- delete m_defaultRule;
- }
-
- if (m_defaultTextRule != 0)
- {
- NodeImpl* const child = m_defaultTextRule->getFirstChild();
- m_defaultTextRule->removeChild(child);
- delete child;
- delete m_defaultTextRule;
- }
-
- if (m_defaultRootRule != 0)
- {
- NodeImpl* const child = m_defaultRootRule->getFirstChild();
- m_defaultRootRule->removeChild(child);
- delete child;
- delete m_defaultRootRule;
- }
+ delete m_defaultRule;
+ delete m_defaultTextRule;
+ delete m_defaultRootRule;
}
-void StylesheetRoot::process(
- const DOM_Node& sourceTree,
+void
+StylesheetRoot::process(
+ XalanNode* sourceTree,
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext)
{
// Find the root pattern in the XSL.
ElemTemplate* rootRule =
- dynamic_cast<ElemTemplate*>(findTemplate(executionContext, sourceTree, sourceTree));
+ findTemplate(executionContext, sourceTree, sourceTree);
if(0 == rootRule)
{
rootRule = m_defaultRootRule;
assert(rootRule);
}
+
executionContext.setStylesheetRoot(this);
FormatterListener* flistener = 0;
bool newListener = false;
+
// $$$ ToDo: Why is this Xerces-specific?
XercesDOMPrintWriter* pw = 0;
bool newPW = false;
@@ -238,8 +233,8 @@
{
/*
java:
- DOMString mimeEncoding;
- DOMString encoding;
+ XalanDOMString mimeEncoding;
+ XalanDOMString encoding;
mimeEncoding = getOutputEncoding();
encoding = getJavaOutputEncoding();
if(0 == encoding)
@@ -297,8 +292,7 @@
case Formatter::OUTPUT_METH_HTML:
flistener = new FormatterToHTML(
*pw, m_version, doIndent, indentAmount, m_encoding, m_mediatype,
- m_doctypeSystem, m_doctypePublic, ! m_omitxmlDecl, m_standalone,
- &m_cdataSectionElems);
+ m_doctypeSystem, m_doctypePublic, !m_omitxmlDecl, m_standalone);
newListener = true;
break;
case Formatter::OUTPUT_METH_TEXT:
@@ -309,36 +303,40 @@
default:
flistener = new FormatterToXML(
*pw, m_version, doIndent, indentAmount, m_encoding, m_mediatype,
- m_doctypeSystem, m_doctypePublic, ! m_omitxmlDecl, m_standalone,
- &m_cdataSectionElems);
+ m_doctypeSystem, m_doctypePublic, !m_omitxmlDecl, m_standalone);
newListener = true;
break;
}
+
+ executionContext.setFormatterListener(flistener);
}
/*
* Output target has a node
*/
else if(0 != outputTarget.getNode())
{
- switch(outputTarget.getNode().getNodeType())
+ switch(outputTarget.getNode()->getNodeType())
{
- case DOM_Node::DOCUMENT_NODE:
+ case XalanNode::DOCUMENT_NODE:
flistener = new
- FormatterToDOM(static_cast<DOM_Document&>(outputTarget.getNode()));
+ FormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
newListener = true;
break;
- case DOM_Node::DOCUMENT_FRAGMENT_NODE:
+
+ case XalanNode::DOCUMENT_FRAGMENT_NODE:
flistener = new
FormatterToDOM(executionContext.createDocument(),
- static_cast<DOM_DocumentFragment&>(outputTarget.getNode()));
+ static_cast<XalanDocumentFragment*>(outputTarget.getNode()));
newListener = true;
break;
- case DOM_Node::ELEMENT_NODE:
+
+ case XalanNode::ELEMENT_NODE:
flistener = new
FormatterToDOM(executionContext.createDocument(),
- static_cast<DOM_Element&>(outputTarget.getNode()));
+ static_cast<XalanElement*>(outputTarget.getNode()));
newListener = true;
break;
+
default:
executionContext.error("Can only output to an Element, DocumentFragment, Document, or PrintWriter.");
}
@@ -349,24 +347,24 @@
else
{
outputTarget.setNode(executionContext.createDocument());
- flistener = new
- FormatterToDOM(static_cast<DOM_Document&>(outputTarget.getNode()));
+ flistener = new
+ FormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
newListener = true;
}
executionContext.setFormatterListener(flistener);
executionContext.resetCurrentState(sourceTree, sourceTree);
// @@ JMD: Is this OK ??
- executionContext.setRootDocument(static_cast<const DOM_Document&>(sourceTree));
+ executionContext.setRootDocument(static_cast<XalanDocument*>(sourceTree));
if(executionContext.doDiagnosticsOutput())
{
- executionContext.diag("=============================");
- executionContext.diag("Transforming...");
+ executionContext.diag(XALAN_STATIC_UCODE_STRING("============================="));
+ executionContext.diag(XALAN_STATIC_UCODE_STRING("Transforming..."));
executionContext.pushTime(&sourceTree);
}
- executionContext.pushContextMarker(DOM_Node(), DOM_Node());
+ executionContext.pushContextMarker(0, 0);
try
{
@@ -392,7 +390,7 @@
if(executionContext.doDiagnosticsOutput())
{
- executionContext.displayDuration("transform", &sourceTree);
+ executionContext.displayDuration(XALAN_STATIC_UCODE_STRING("transform"), &sourceTree);
}
if (newListener) delete flistener;
// Can't release this until flistener is gone, since it contains a
@@ -417,7 +415,7 @@
/** Get the version string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getOutputVersion() const
{
return m_version;
@@ -433,7 +431,7 @@
/** Get the encoding string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getOutputEncoding() const
{
return m_encoding;
@@ -441,14 +439,20 @@
/** Get the encoding string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getJavaOutputEncoding() const
{
- DOMString encoding;
+ XalanDOMString encoding;
+
if(isEmpty(m_encoding))
- encoding = DOMString("UTF8");
- else if( equalsIgnoreCase(m_encoding, DOMString("UTF-16") ) )
- encoding = DOMString("Unicode");
+ {
+ encoding = XALAN_STATIC_UCODE_STRING("UTF8");
+ }
+ else if(equalsIgnoreCase(m_encoding, XALAN_STATIC_UCODE_STRING("UTF-16")))
+ {
+ encoding = XALAN_STATIC_UCODE_STRING("Unicode");
+ }
+
// @@ JMD: do we need this ??
// else
// @@ to do encoding = FormatterToXML.convertMime2JavaEncoding( m_encoding );
@@ -457,7 +461,7 @@
/** Get the media-type string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getOutputMediaType() const
{
return m_mediatype;
@@ -465,7 +469,7 @@
/** Get the doctype-system-id string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getOutputDoctypeSystem() const
{
return m_doctypeSystem;
@@ -473,7 +477,7 @@
/** Get the doctype-public-id string that was specified in the stylesheet. */
-DOMString
+XalanDOMString
StylesheetRoot::getOutputDoctypePublic() const
{
return m_doctypePublic;
@@ -484,18 +488,22 @@
*/
void
StylesheetRoot::processOutputSpec(
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
StylesheetConstructionContext& constructionContext)
{
- int nAttrs = atts.getLength();
- bool didSpecifyIndent = false;
- for(int i = 0; i < nAttrs; i++)
+ const unsigned int nAttrs = atts.getLength();
+
+ bool didSpecifyIndent = false;
+
+ for(unsigned int i = 0; i < nAttrs; i++)
{
- DOMString aname = atts.getName(i);
+ const XalanDOMChar* const aname = atts.getName(i);
+
if(equals(aname, Constants::ATTRNAME_OUTPUT_METHOD))
{
- DOMString method = atts.getValue(i);
+ const XalanDOMChar* const method = atts.getValue(i);
+
if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_HTML))
m_outputmethod = Formatter::OUTPUT_METH_HTML;
else if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_XML))
@@ -503,7 +511,7 @@
else if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_TEXT))
m_outputmethod = Formatter::OUTPUT_METH_TEXT;
}
- else if(equals(aname,Constants::ATTRNAME_OUTPUT_VERSION))
+ else if(equals(aname, Constants::ATTRNAME_OUTPUT_VERSION))
{
m_version = atts.getValue(i);
}
@@ -539,18 +547,22 @@
else if(equals(aname,Constants::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS))
{
StringTokenizer tokenizer(atts.getValue(i));
+
while(tokenizer.hasMoreTokens())
{
- DOMString token = tokenizer.nextToken();
- QName qname(token, getNamespaces());
+ const XalanDOMString token = tokenizer.nextToken();
+
+ const QName qname(token, getNamespaces());
+
m_cdataSectionElems.push_back(qname);
}
}
else
{
- constructionContext.error(name+DOMString(" has an illegal attribute: ")+aname);
+ constructionContext.error(name + XalanDOMString(" has an illegal attribute: ")+aname);
}
}
+
if((Formatter::OUTPUT_METH_HTML == m_outputmethod) &&
(false == didSpecifyIndent))
{
@@ -559,69 +571,108 @@
}
-/**
- * Create the default rule if needed.
- */
+
void
StylesheetRoot::initDefaultRule(StylesheetConstructionContext& constructionContext)
{
- int lineNumber = 0;
- int columnNumber = 0;
- // Then manufacture a default
-
- AttributeListImpl attrs;
- //const AttributeListImpl attrs() ;
- attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(DOMString("CDATA")),
- c_wstr(DOMString("*")));
- m_defaultRule = new ElemTemplate(constructionContext, // @@ JMD: should be null
- *this,
- DOMString("xsl:")+Constants::ELEMNAME_TEMPLATE_STRING,
- attrs, lineNumber, columnNumber);
- attrs.clear();
- ElemApplyTemplates* childrenElement
- = new ElemApplyTemplates(constructionContext, *this,
- DOMString("xsl:")+Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
- attrs, lineNumber, columnNumber);
- childrenElement->setDefaultTemplate(true);
- m_defaultRule->appendChild(childrenElement);
+ if (m_defaultRule == 0)
+ {
+ assert(m_defaultTextRule == 0);
+ assert(m_defaultRootRule == 0);
+
+ const int lineNumber = 0;
+ const int columnNumber = 0;
+
+ AttributeListImpl attrs;
+
+ const XalanDOMString xslPrefix(XALAN_STATIC_UCODE_STRING("xsl:"));
+
+ attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(XALAN_STATIC_UCODE_STRING("*")));
+
+ m_defaultRule = new ElemTemplate(constructionContext, // @@ JMD: should be null
+ *this,
+ xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ attrs.clear();
+
+ ElemApplyTemplates* childrenElement
+ = new ElemApplyTemplates(constructionContext,
+ *this,
+ xslPrefix + Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ childrenElement->setDefaultTemplate(true);
+ m_defaultRule->appendChildElem(childrenElement);
- // -----------------------------
+ // -----------------------------
- attrs.clear();
- attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(DOMString("CDATA")),
- c_wstr(DOMString("text() | @*")));
- m_defaultTextRule = new ElemTemplate(constructionContext,
- *this,
- DOMString("xsl:")+Constants::ELEMNAME_TEMPLATE_STRING,
- attrs, lineNumber, columnNumber);
- attrs.clear();
- attrs.addAttribute(c_wstr(Constants::ATTRNAME_SELECT),
- c_wstr(DOMString("CDATA")),
- c_wstr(DOMString(".")));
- ElemValueOf* elemValueOf
- = (new ElemValueOf(constructionContext, *this,
- DOMString("xsl:")+Constants::ELEMNAME_VALUEOF_STRING,
- attrs, lineNumber, columnNumber));
- m_defaultTextRule->appendChild(elemValueOf);
+ attrs.clear();
+ attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(XALAN_STATIC_UCODE_STRING("text() | @*")));
+
+ m_defaultTextRule = new ElemTemplate(constructionContext,
+ *this,
+ xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ attrs.clear();
+ attrs.addAttribute(c_wstr(Constants::ATTRNAME_SELECT),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(XALAN_STATIC_UCODE_STRING(".")));
+
+ ElemValueOf* elemValueOf =
+ new ElemValueOf(constructionContext,
+ *this,
+ xslPrefix + Constants::ELEMNAME_VALUEOF_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ m_defaultTextRule->appendChildElem(elemValueOf);
- //--------------------------------
+ //--------------------------------
- attrs.clear();
- attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(DOMString("CDATA")),
- c_wstr(DOMString("/")));
- m_defaultRootRule = new ElemTemplate(constructionContext, *this,
- DOMString("xsl:")+Constants::ELEMNAME_TEMPLATE_STRING,
- attrs, lineNumber, columnNumber);
- attrs.clear();
- childrenElement
- = (new ElemApplyTemplates(constructionContext, *this,
- DOMString("xsl:")+Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
- attrs, lineNumber, columnNumber));
- childrenElement->setDefaultTemplate(true);
- m_defaultRootRule->appendChild(childrenElement);
+ attrs.clear();
+ attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(XALAN_STATIC_UCODE_STRING("/")));
+
+ m_defaultRootRule =
+ new ElemTemplate(constructionContext,
+ *this,
+ xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ attrs.clear();
+
+ childrenElement =
+ new ElemApplyTemplates(constructionContext,
+ *this,
+ xslPrefix + Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
+ attrs,
+ lineNumber,
+ columnNumber);
+
+ childrenElement->setDefaultTemplate(true);
+
+ m_defaultRootRule->appendChildElem(childrenElement);
+ }
+
+ assert(m_defaultRule != 0);
+ assert(m_defaultTextRule != 0);
+ assert(m_defaultRootRule != 0);
}
@@ -655,83 +706,38 @@
m_traceListeners.erase(it);
}
}
-
+
+
+
+
/**
* Fire a trace event.
*/
-void StylesheetRoot::fireTraceEvent(const TracerEvent& te) const
+void
+StylesheetRoot::fireTraceEvent(const TracerEvent& te) const
{
- int nListeners = m_traceListeners.size();
- for(int i = 0; i < nListeners; i++)
+ const ListenersVectorType::size_type nListeners =
+ m_traceListeners.size();
+
+ for(ListenersVectorType::size_type i = 0; i < nListeners; i++)
{
- TraceListener* tl = m_traceListeners[i];
- tl->trace(te);
+ m_traceListeners[i]->trace(te);
}
}
+
+
/**
* Fire a selection event.
*/
-void StylesheetRoot::fireSelectedEvent(const SelectionEvent& se) const
+void
+StylesheetRoot::fireSelectedEvent(const SelectionEvent& se) const
{
- int nListeners = m_traceListeners.size();
- for(int i = 0; i < nListeners; i++)
+ const ListenersVectorType::size_type nListeners =
+ m_traceListeners.size();
+
+ for(ListenersVectorType::size_type i = 0; i < nListeners; i++)
{
- TraceListener* tl = m_traceListeners[i];
- tl->selected(se);
+ m_traceListeners[i]->selected(se);
}
}
-
-
-
-#if 0
-
-// Transfer these to StylesheetExecutionContext() and StylesheetConstructionContext(), etc...
-XPath*
-StylesheetRoot::createMatchPattern(
- const DOMString& str,
- const PrefixResolver& resolver)
-{
- assert(m_processor != 0);
- assert(m_processor->getXPathProcessor() != 0);
-
- XPath* const xpath = m_xpathFactory.create();
-
- m_processor->getXPathProcessor()->initMatchPattern(*xpath,
- str,
- resolver,
- m_xobjectFactory,
- m_processor->getXPathEnvSupport());
-
- return xpath;
-}
-
-
-
-XPath*
-StylesheetRoot::createXPath(
- const DOMString& str,
- const PrefixResolver& resolver)
-{
- assert(m_processor != 0);
- assert(m_processor->getXPathProcessor() != 0);
-
- XPath* const xpath = m_xpathFactory.create();
-
- // It's OK to use the XPathEnvSupport of the processor,
- // since we're in construction phase.
- m_processor->getXPathProcessor()->initXPath(*xpath,
- str,
- resolver,
- m_xobjectFactory,
- m_processor->getXPathEnvSupport());
-
- return xpath;
-}
-#endif
-
-
-
-/*
- * $ Log: $
- */
1.7 +48 -36 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StylesheetRoot.hpp 2000/03/23 12:59:36 1.6
+++ StylesheetRoot.hpp 2000/04/11 15:09:30 1.7
@@ -57,24 +57,18 @@
#if !defined(XALAN_STYLESHEETROOT_HEADER_GUARD)
#define XALAN_STYLESHEETROOT_HEADER_GUARD
-/**
- * $Id: StylesheetRoot.hpp,v 1.6 2000/03/23 12:59:36 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
-
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
#include "Stylesheet.hpp"
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -86,6 +80,7 @@
class XSLTResultTarget;
+
/**
* This acts as the stylesheet root of the stylesheet
* tree, and holds values that are shared by all
@@ -108,7 +103,7 @@
* @param constructionContext context for construction of object
*/
StylesheetRoot(
- const DOMString& baseIdentifier,
+ const XalanDOMString& baseIdentifier,
StylesheetConstructionContext& constructionContext);
virtual
@@ -123,7 +118,7 @@
*/
void
process(
- const DOM_Node& sourceTree,
+ XalanNode* sourceTree,
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext);
@@ -142,7 +137,7 @@
*
* @return version string
*/
- DOMString
+ XalanDOMString
getOutputVersion() const;
/**
@@ -158,7 +153,7 @@
*
* @return encoding string
*/
- DOMString
+ XalanDOMString
getOutputEncoding() const;
/**
@@ -166,7 +161,7 @@
*
* @return encoding string
*/
- DOMString
+ XalanDOMString
getJavaOutputEncoding() const;
/**
@@ -174,7 +169,7 @@
*
* @return document type string
*/
- DOMString
+ XalanDOMString
getOutputDoctypeSystem() const;
/**
@@ -182,7 +177,7 @@
*
* @return media type string
*/
- DOMString
+ XalanDOMString
getOutputMediaType() const;
/**
@@ -190,7 +185,7 @@
*
* @return document type public id string
*/
- DOMString
+ XalanDOMString
getOutputDoctypePublic() const;
/**
@@ -198,7 +193,11 @@
*
* @return true to output declarations
*/
- bool getOmitOutputXMLDecl() { return m_omitxmlDecl; }
+ bool
+ getOmitOutputXMLDecl() const
+ {
+ return m_omitxmlDecl;
+ }
/**
* Get the standalone string that was specified in the stylesheet, either
@@ -206,7 +205,11 @@
*
* @return standalone string
*/
- DOMString getOutputStandalone() const { return m_standalone; }
+ XalanDOMString
+ getOutputStandalone() const
+ {
+ return m_standalone;
+ }
/**
* Get the template representing the default rule for text.
@@ -251,7 +254,7 @@
*/
void
processOutputSpec(
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
StylesheetConstructionContext& constructionContext);
@@ -267,7 +270,7 @@
* The version tells the version of XML to be used for outputting the result tree,
* as specified in xsl:output.
*/
- DOMString m_version; // = null;
+ XalanDOMString m_version; // = null;
/**
* indent-result is by default no, which means an XSL processor must not
@@ -279,20 +282,20 @@
* The encoding attribute specifies the preferred encoding to use
* for outputting the result tree.
*/
- DOMString m_encoding; // = null;
+ XalanDOMString m_encoding; // = null;
/**
* The media-type attribute is applicable for the xml output method.
* The default value for the media-type attribute is text/xml.
*/
- DOMString m_mediatype; // = null;
+ XalanDOMString m_mediatype; // = null;
/**
* If the doctype-system-id attribute is specified, the xml output method should
* output a document type declaration immediately before the first element.
* The name following <!DOCTYPE should be the name of the first element.
*/
- DOMString m_doctypeSystem; // = null;
+ XalanDOMString m_doctypeSystem; // = null;
/**
* If doctype-public-id attribute is also specified, then the xml output
@@ -302,7 +305,7 @@
* doctype-public-id attribute should be ignored unless the doctype-system-id
* attribute is specified.
*/
- DOMString m_doctypePublic; // = null;
+ XalanDOMString m_doctypePublic; // = null;
/**
* Tells whether or not to output an XML declaration.
@@ -312,14 +315,15 @@
/**
* Tells what the xmldecl should specify for the standalone value.
*/
- DOMString m_standalone; // = null;
+ XalanDOMString m_standalone; // = null;
/**
* Retrieve the stack of imported stylesheets.
*
* @return stack of URIs for stylesheets
*/
- URLStackType& getImportStack()
+ URLStackType&
+ getImportStack()
{
return m_importStack;
}
@@ -329,7 +333,8 @@
*
* @return const stack of URIs for stylesheets
*/
- const URLStackType& getImportStack() const
+ const URLStackType&
+ getImportStack() const
{
return m_importStack;
}
@@ -340,7 +345,8 @@
*
* @param bIndent true to indent results
*/
- void setIndentResult(bool bIndent)
+ void
+ setIndentResult(bool bIndent)
{
m_indentResult = bIndent;
}
@@ -351,7 +357,8 @@
*
* @param meth new method number
*/
- void setOutputMethod(int meth)
+ void
+ setOutputMethod(int meth)
{
m_outputmethod = meth;
}
@@ -369,35 +376,40 @@
*
* @param tl pointer to listener to add
*/
- void addTraceListener(TraceListener *tl);
+ void
+ addTraceListener(TraceListener *tl);
/**
* Remove a trace listener.
*
* @param tl pointer to listener to remove
*/
- void removeTraceListener(TraceListener* tl);
+ void
+ removeTraceListener(TraceListener* tl);
/**
* Fire a trace event.
*
* @param te trace event to fire
*/
- void fireTraceEvent(const TracerEvent& te) const;
+ void
+ fireTraceEvent(const TracerEvent& te) const;
/**
* Fire a selection event.
*
* @param se selection event to fire
*/
- void fireSelectedEvent(const SelectionEvent& se) const;
+ void
+ fireSelectedEvent(const SelectionEvent& se) const;
/**
* Retrieve list of CDATA section elements.
*
* @return vector of elements
*/
- const QNameVectorType& getCdataSectionElems()
+ const QNameVectorType&
+ getCdataSectionElems()
{
return m_cdataSectionElems;
}
@@ -414,7 +426,7 @@
* The URL that belongs to the result namespace.
* @serial
*/
- DOMString m_resultNameSpaceURL; // = null;
+ XalanDOMString m_resultNameSpaceURL; // = null;
/**
* List of listeners who are interested in tracing what's going on.
1.3 +40 -61 xml-xalan/c/src/XSLT/TracerEvent.cpp
Index: TracerEvent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/TracerEvent.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TracerEvent.cpp 2000/01/26 14:27:00 1.2
+++ TracerEvent.cpp 2000/04/11 15:09:30 1.3
@@ -56,31 +56,22 @@
*/
#include "TracerEvent.hpp"
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Element.hpp>
-#include <dom/DOM_NodeList.hpp>
+
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
-/**
- * This is the parent class of events generated for tracing the
- * progress of the XSL processor.
- */
- /**
- * 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 mode The current mode.
- * @param m_styleNode node in the style tree reference for the event.
- * Should not be null. That is not enforced.
- */
+
TracerEvent::TracerEvent(
const StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ const XalanNode* sourceTree,
+ const XalanNode* sourceNode,
const QName& mode,
const ElemTemplateElement& styleNode) :
m_executionContext(executionContext),
@@ -99,45 +90,34 @@
- /**
- Returns a string representation of the node.
- The string returned for elements will contain the element name
- and any attributes enclosed in angle brackets.
- The string returned for attributes will be of form, "name=value."
-
- @param n any DOM node. Must not be null.
-
- @return a string representation of the given node.
- */
-DOMString
-TracerEvent::printNode(const DOM_Node& n)
+XalanDOMString
+TracerEvent::printNode(const XalanNode& n)
{
- // in Java was thigs: String r = n.hashCode() + " ";
+ XalanDOMString r = LongToDOMString(reinterpret_cast<long>(&n)) + XALAN_STATIC_UCODE_STRING(" ");
- DOMString r = LongToDOMString(reinterpret_cast<long>(&n)) + " ";
-
- if (n.getNodeType() == DOM_Node::ELEMENT_NODE)
+ if (n.getNodeType() == XalanNode::ELEMENT_NODE)
{
- r += "<" + n.getNodeName();
+ r += XALAN_STATIC_UCODE_STRING("<") + n.getNodeName();
- DOM_Node c = n.getFirstChild();
+ const XalanNode* c = n.getFirstChild();
while (c != 0)
{
- if (c.getNodeType() == DOM_Node::ATTRIBUTE_NODE)
+ if (c->getNodeType() == XalanNode::ATTRIBUTE_NODE)
{
- r += printNode(c) + " ";
+ r += printNode(*c) + XALAN_STATIC_UCODE_STRING(" ");
}
- c = c.getNextSibling();
+
+ c = c->getNextSibling();
}
- r += ">";
+ r += XALAN_STATIC_UCODE_STRING(">");
}
else
{
- if (n.getNodeType() == DOM_Node::ATTRIBUTE_NODE)
+ if (n.getNodeType() == XalanNode::ATTRIBUTE_NODE)
{
- r += n.getNodeName() + "=" + n.getNodeValue();
+ r += n.getNodeName() + XALAN_STATIC_UCODE_STRING("=") + n.getNodeValue();
}
else
{
@@ -159,32 +139,31 @@
@return a string representation of the given node list.
*/
-DOMString
-TracerEvent::printNodeList(const DOM_NodeList& l)
+XalanDOMString
+TracerEvent::printNodeList(const XalanNodeList& l)
{
- // in Java was this: String r = l.hashCode() + "[";
- DOMString r = LongToDOMString(reinterpret_cast<long>(&l)) + "[";
+ XalanDOMString r = LongToDOMString(reinterpret_cast<long>(&l)) +
+ XALAN_STATIC_UCODE_STRING("[");
- int len = l.getLength() - 1;
- int i = 0;
+ unsigned int len = l.getLength();
+ unsigned int i = 0;
while (i < len)
{
- DOM_Node n = l.item(i);
+ XalanNode* const n = l.item(i);
+
if (n != 0)
{
- r += printNode(n) + ", ";
+ r += printNode(*n);
+
+ if (i != len - 1)
+ {
+ r += XALAN_STATIC_UCODE_STRING(", ");
+ }
}
+
++i;
}
- if (i == len)
- {
- DOM_Node n = l.item(len);
- if (n != 0)
- {
- r += printNode(n);
- }
- }
- return r + "]";
-}
+ return r + XALAN_STATIC_UCODE_STRING("]");
+}
1.4 +54 -42 xml-xalan/c/src/XSLT/TracerEvent.hpp
Index: TracerEvent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/TracerEvent.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TracerEvent.hpp 2000/02/29 20:54:24 1.3
+++ TracerEvent.hpp 2000/04/11 15:09:30 1.4
@@ -57,21 +57,31 @@
#if !defined(XALAN_TracerEvent_HEADER_GUARD)
#define XALAN_TracerEvent_HEADER_GUARD
+
+
// Base include file. Must be first.
-#include "XSLTDefinitions.hpp"
+#include <XSLT/XSLTDefinitions.hpp>
+
+
+
+// $$$ ToDo: This is necessary while XalanDOMString is a typedef.
+#include <XalanDOM/XalanDOMString.hpp>
+
+
-class DOMString;
-class DOM_Node;
-class DOM_NodeList;
+class XalanNode;
+class XalanNodeList;
class QName;
class StylesheetExecutionContext;
class ElemTemplateElement;
+
+
/**
* This is the parent class of events generated for tracing the
* progress of the XSL processor.
*/
-class TracerEvent
+class XALAN_XSLT_EXPORT TracerEvent
{
public:
@@ -86,8 +96,8 @@
*/
TracerEvent(
const StylesheetExecutionContext& executionContext,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ const XalanNode* sourceTree,
+ const XalanNode* sourceNode,
const QName& mode,
const ElemTemplateElement& styleNode);
@@ -100,46 +110,48 @@
* angle brackets. The string returned for attributes will be of form,
* "name=value."
*
- * @param n any DOM node, must not be null
+ * @param n any DOM node
* @return string representation of the given node
+ */
+ static XalanDOMString
+ printNode(const XalanNode& n);
+
+ /**
+ * Returns a string representation of the node list. The string will contain
+ * the list of nodes inside square braces. Elements will contain the element
+ * name and any attributes enclosed in angle brackets. Attributes will be of
+ * form, "name=value."
+ *
+ * @param l any DOM node list
+ * @return string representation of the given node list
*/
- static DOMString printNode(const DOM_Node& n);
+ static XalanDOMString
+ printNodeList(const XalanNodeList& l);
- /**
- * Returns a string representation of the node list. The string will contain
- * the list of nodes inside square braces. Elements will contain the element
- * name and any attributes enclosed in angle brackets. Attributes will be of
- * form, "name=value."
- *
- * @param l any DOM node list, must not be null
- * @return string representation of the given node list
- */
- static DOMString printNodeList(const DOM_NodeList& l);
-
- /**
- * The XSLT processor instance.
- */
- const StylesheetExecutionContext& m_executionContext;
-
- /**
- * The input source tree.
- */
- const DOM_Node& m_sourceTree;
+ /**
+ * The XSLT processor instance.
+ */
+ const StylesheetExecutionContext& m_executionContext;
+
+ /**
+ * The input source tree.
+ */
+ const XalanNode* m_sourceTree;
- /**
- * The current context node.
- */
- const DOM_Node& m_sourceNode;
+ /**
+ * The current context node.
+ */
+ const XalanNode* m_sourceNode;
- /**
- * The current mode.
- */
- const QName& m_mode;
-
- /**
- * The node in the style tree where the event occurs.
- */
- const ElemTemplateElement& m_styleNode;
+ /**
+ * The current mode.
+ */
+ const QName& m_mode;
+
+ /**
+ * The node in the style tree where the event occurs.
+ */
+ const ElemTemplateElement& m_styleNode;
private:
1.20 +942 -752 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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XSLTEngineImpl.cpp 2000/03/23 12:59:36 1.19
+++ XSLTEngineImpl.cpp 2000/04/11 15:09:30 1.20
@@ -54,65 +54,6 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-/**
- * $Id: XSLTEngineImpl.cpp,v 1.19 2000/03/23 12:59:36 jdonohue Exp $
- *
- * $State: Exp $
- *
- * @author Scott Boag (scott_boag@lotus.com)
- @@ Need to check this text based on newer implementation:
- *
- * It is the responsibility of the XSLTEngineImpl class to traverse the
- * source DOM tree according to the instructions in the style DOM tree,
- * and output nodes into the result DOM tree.
- *
- * Basic flow of control:
- * Starting from process(Document sourceTree, Document out, String mode),
- * 1) init the Stylesheet instances (which hold the state for each imported
- * XSL stylesheet) in the parseXSLRoot method, then
- * 2) locate the rootRule (all rules are found via Stylesheet.findTemplate),
- * then pass the root node of the source tree to
- * 3) buildResultFromTemplate, which processes each of the template's
- * child elements by calling
- * 4) processTemplateElement, which either processes the element
- * by handling it as an XSL directive (if it is in the xsl: namespace),
- * or by cloning the source node to the result tree.
- * If it is an XSL instruction,
- * 5) processXSLTemplateInstruction is called, which calls various
- * subfunctions according to the tag name.
- * The XSL directives that effect the source traversal are xsl:apply-templates
- * and xsl:for-each, which are handled in the
- * 6) handleApplyTemplatesInstruction, which selects the start node and
- * calls the
- * 7) transformSelectedChildren method, which performs a query or just
- * traverses the child list, then for each node in the selected list calls
- * 8) transformChild, which then calls
- * 9) Stylesheet.findTemplate (if it is not an xsl:for-each instruction)
- * to locate the corresponding template, and then calls
- * 10) buildResultFromTemplate, recursing back in to step 3 and starting the
- * traversal cycle all over again.
- *
- * Glossory (abbreviations used in variable and method
- * names in square brackets):
- * <DL>
- * <DT>XSL Instruction [instruction]</DT>
- * <DD>Any tag with an XSL namespace prefix.</DD>
- * <DT>XSL Template Instruction [instruction]</DT>
- * <DD>Any tag with an XSL namespace prefix
- * that occurs inside an xsl:template element.</DD>
- * <DT>Template Child [templateChild]</DT>
- * <DD>Any node that is a child of an xsl:template element.</DD>
- * <DT>Source Tree</DT>
- * <DD>The tree input to the XSL process.</DD>
- * <DT>Result Tree</DT>
- * <DD>The tree that is output by the XSL process.</DD>
- * <DT>Stylesheet Tree</DT>
- * <DD>The stylesheet tree produced from the XSL file.</DD>
- * <DT>Pattern List [patternList]</DT>
- * <DD>A parsed query or match pattern.</DD>
- * </DL>
- *
- */
@@ -123,30 +64,38 @@
#include <memory>
+
+#include <XalanDOM/XalanDOMException.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanAttr.hpp>
+#include <XalanDOM/XalanComment.hpp>
+#include <XalanDOM/XalanCDATASection.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
+#include <XalanDOM/XalanProcessingInstruction.hpp>
+#include <XalanDOM/XalanText.hpp>
-#include <dom/DOM_DOMException.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_NodeList.hpp>
-#include <dom/DOM_NamedNodeMap.hpp>
-#include <dom/DOM_ProcessingInstruction.hpp>
+
+
#include <sax/DocumentHandler.hpp>
#include <sax/Locator.hpp>
#include <sax/SAXException.hpp>
#include <util/PlatformUtils.hpp>
#include <framework/URLInputSource.hpp>
+
-#include <Include/DOMHelper.hpp>
#include <PlatformSupport/DOMStringPrintWriter.hpp>
#include <PlatformSupport/PrintWriter.hpp>
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
+
+
#include <DOMSupport/DOMServices.hpp>
-#include <DOMSupport/UnimplementedNode.hpp>
-#include <DOMSupport/UnimplementedElement.hpp>
-#include <DOMSupport/UnimplementedDocumentFragment.hpp>
+
+
#include <XMLSupport/Formatter.hpp>
#include <XMLSupport/FormatterToDOM.hpp>
#include <XMLSupport/FormatterToText.hpp>
@@ -154,6 +103,8 @@
#include <XMLSupport/XMLParserLiaison.hpp>
#include <XMLSupport/FormatterTreeWalker.hpp>
+
+
#include <XPath/ElementPrefixResolverProxy.hpp>
#include <XPath/ResultTreeFrag.hpp>
#include <XPath/XObject.hpp>
@@ -167,6 +118,7 @@
#include <XPath/XResultTreeFrag.hpp>
+
#include "Arg.hpp"
#include "Constants.hpp"
#include "ContextMarker.hpp"
@@ -194,10 +146,10 @@
-const double XSLTEngineImpl::s_XSLTVerSupported(1.0);
-const DOMString XSLTEngineImpl::s_DefaultXSLNameSpaceURL(XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform/1.0"));
-const DOMString XSLTEngineImpl::s_XSLNameSpaceURLPre(XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform"));
-const DOMString XSLTEngineImpl::s_XSLT4JNameSpaceURL(XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt"));
+const double XSLTEngineImpl::s_XSLTVerSupported(1.0);
+const XalanDOMString XSLTEngineImpl::s_DefaultXSLNameSpaceURL(XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform/1.0"));
+const XalanDOMString XSLTEngineImpl::s_XSLNameSpaceURLPre(XALAN_STATIC_UCODE_STRING("http://www.w3.org/1999/XSL/Transform"));
+const XalanDOMString XSLTEngineImpl::s_XSLT4JNameSpaceURL(XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt"));
/**
* Control if the xsl:variable is resolved early or
@@ -227,18 +179,18 @@
//==========================================================
XSLTEngineImpl::XSLTEngineImpl(
- XMLParserLiaison& parserLiaison,
- XPathSupport& xpathSupport,
- XPathEnvSupport& xpathEnvSupport,
- XObjectFactory& xobjectFactory,
- XPathFactory& xpathFactory) :
+ XMLParserLiaison& parserLiaison,
+ XPathSupport& xpathSupport,
+ XPathEnvSupport& xpathEnvSupport,
+ XObjectFactory& xobjectFactory,
+ XPathFactory& xpathFactory) :
XSLTProcessor(),
DocumentHandler(),
m_rootDoc(),
m_outputCarriageReturns(false),
m_outputLinefeeds(false),
m_formatter(0),
- m_resultTreeFactory(),
+ m_resultTreeFactory(0),
m_resultNameSpacePrefix(),
m_resultNameSpaceURL(),
m_stylesheets(),
@@ -311,7 +263,7 @@
m_XSLNameSpaceURL = s_DefaultXSLNameSpaceURL;
m_durationsTable.clear();
m_stylesheetLocatorStack.clear();
- m_pendingElementName = DOMString();
+ m_pendingElementName = XalanDOMString();
m_pendingAttributes.clear();
m_cdataStack.clear();
m_resultTreeFactory = 0;
@@ -334,6 +286,7 @@
}
+
XSLTEngineImpl::~XSLTEngineImpl()
{
delete m_problemListener;
@@ -342,13 +295,14 @@
}
+
//==========================================================
// SECTION: Main API Functions
//==========================================================
-DOM_Document
+XalanDocument*
XSLTEngineImpl::getRootDoc() const
{
return m_rootDoc;
@@ -357,7 +311,7 @@
void
-XSLTEngineImpl::setRootDoc(const DOM_Document& doc)
+XSLTEngineImpl::setRootDoc(XalanDocument* doc)
{
m_rootDoc = doc;
}
@@ -372,7 +326,7 @@
-DOMString
+const XalanDOMString
XSLTEngineImpl::getPendingElementName() const
{
return m_pendingElementName;
@@ -389,7 +343,7 @@
void
-XSLTEngineImpl::setPendingElementName(const DOMString& elementName)
+XSLTEngineImpl::setPendingElementName(const XalanDOMString& elementName)
{
m_pendingElementName = elementName;
}
@@ -406,43 +360,64 @@
{
try
{
- DOMString xslIdentifier(((0 == stylesheetSource) ||
+ XalanDOMString xslIdentifier(((0 == stylesheetSource) ||
(0 == stylesheetSource->getSystemId()))
- ? DOMString("Input XSL") : stylesheetSource->getSystemId());
+ ? XalanDOMString(XALAN_STATIC_UCODE_STRING("Input XSL")) : stylesheetSource->getSystemId());
bool totalTimeID = true;
pushTime(&totalTimeID);
- DOM_Node sourceTree;
+
+ XalanNode* sourceTree = 0;
+
if(0 != inputSource)
sourceTree = getSourceTreeFromInput(inputSource);
+
if(0 != stylesheetSource)
{
m_stylesheetRoot = processStylesheet(*stylesheetSource, constructionContext);
}
else if(0 != sourceTree)
{
- DOMString stylesheetURI = 0;
- DOM_NodeList children = sourceTree.getChildNodes();
- int nNodes = children.getLength();
- std::vector<DOMString> hrefs;
+ XalanDOMString stylesheetURI = 0;
+ XalanNode* child = sourceTree->getFirstChild();
- for(int i = 0; i < nNodes; i++)
+#if !defined(XALAN_NO_NAMESPACES
+ using std::vector;
+#endif
+
+ vector<XalanDOMString> hrefs;
+
+ // $$$ ToDo: is this first one style valid?
+ const XalanDOMString stylesheetNodeName1(XALAN_STATIC_UCODE_STRING("xml-stylesheet"));
+ const XalanDOMString stylesheetNodeName2(XALAN_STATIC_UCODE_STRING("xml:stylesheet"));
+
+ // $$$ ToDo: This code is much like that in getStyleSheetURIFromDoc().
+ // Why is it repeated???
+ // $$$ ToDo: Move these embedded strings from inside these loops
+ // out here...
+ // $$$ ToDo: These loops are a mess of repeated use of the
+ // same data values.
+ while(child != 0)
{
- DOM_Node child = children.item(i);
- if(DOM_Node::PROCESSING_INSTRUCTION_NODE == child.getNodeType())
+ if(XalanNode::PROCESSING_INSTRUCTION_NODE == child->getNodeType())
{
- /*DOM_ProcessingInstruction*/const DOM_Node& pi = child;
- if(pi.getNodeName().equals("xml-stylesheet")
- || pi.getNodeName().equals("xml:stylesheet"))
+ const XalanDOMString nodeName(child->getNodeName());
+
+ if(equals(nodeName, stylesheetNodeName1) ||
+ equals(nodeName, stylesheetNodeName2))
{
bool isOK = true;
- StringTokenizer tokenizer(pi.getNodeValue(), " \t=", true);
+
+ StringTokenizer tokenizer(child->getNodeValue(), XALAN_STATIC_UCODE_STRING(" \t="), true);
+
while(tokenizer.hasMoreTokens())
{
- if(tokenizer.nextToken().equals("type"))
+ if(equals(tokenizer.nextToken(), XALAN_STATIC_UCODE_STRING("type")))
{
- DOMString typeVal = tokenizer.nextToken();
- typeVal = substring(typeVal, 1, typeVal.length()-1);
- if(!typeVal.equals("text/xsl"))
+ XalanDOMString typeVal = tokenizer.nextToken();
+
+ typeVal = substring(typeVal, 1, length(typeVal) - 1);
+
+ if(!equals(typeVal, XALAN_STATIC_UCODE_STRING("text/xsl")))
{
isOK = false;
}
@@ -451,32 +426,35 @@
if(isOK)
{
- StringTokenizer tokenizer(pi.getNodeValue(), " \t=", true);
+ StringTokenizer tokenizer(child->getNodeValue(), XALAN_STATIC_UCODE_STRING(" \t="), true);
while(tokenizer.hasMoreTokens())
{
- if(tokenizer.nextToken().equals("href"))
+ if(equals(tokenizer.nextToken(), XALAN_STATIC_UCODE_STRING("href")))
{
stylesheetURI = tokenizer.nextToken();
stylesheetURI = substring(stylesheetURI, 1, stylesheetURI.length()-1);
hrefs.push_back(stylesheetURI);
}
- }
+ }
// break;
}
}
}
- } // end for(int i = 0; i < nNodes; i++)
+
+ child = child->getNextSibling();
+ }
+
bool isRoot = true;
Stylesheet* prevStylesheet = 0;
while(!hrefs.empty())
{
const XMLCh *pxch = (0 != inputSource) ?
inputSource->getSystemId() : 0;
- const DOMString sysid(pxch);
- const DOMString& ref = hrefs.back();
+ const XalanDOMString sysid(pxch);
+ const XalanDOMString& ref = hrefs.back();
Stylesheet* stylesheet =
- getStylesheetFromPIURL(ref, sourceTree, sysid, isRoot, constructionContext);
+ getStylesheetFromPIURL(ref, *sourceTree, sysid, isRoot, constructionContext);
if(false == isRoot)
{
@@ -504,7 +482,7 @@
if(0 != m_diagnosticsPrintWriter)
{
- displayDuration("Total time", &totalTimeID);
+ displayDuration(XALAN_STATIC_UCODE_STRING("Total time"), &totalTimeID);
}
}
}
@@ -540,7 +518,7 @@
StylesheetRoot*
XSLTEngineImpl::processStylesheet(
- const DOMString& xsldocURLString,
+ const XalanDOMString& xsldocURLString,
StylesheetConstructionContext& constructionContext)
{
try
@@ -570,8 +548,8 @@
{
delete m_stylesheetRoot;
- DOMString ds("Input XSL");
- const DOMString xslIdentifier(0 == stylesheetSource.getSystemId() ?
+ const XalanDOMString ds(XALAN_STATIC_UCODE_STRING("Input XSL"));
+ const XalanDOMString xslIdentifier(0 == stylesheetSource.getSystemId() ?
ds : stylesheetSource.getSystemId());
// In case we have a fragment identifier, go ahead and
@@ -593,12 +571,12 @@
}
else
{
- diag("========= Parsing "+xslIdentifier+" ==========");
+ diag(XALAN_STATIC_UCODE_STRING("========= Parsing ") + xslIdentifier + XALAN_STATIC_UCODE_STRING(" =========="));
pushTime(&xslIdentifier);
m_parserLiaison.parseXMLStream(stylesheetSource,
stylesheetProcessor);
if(0 != m_diagnosticsPrintWriter)
- displayDuration("Parse of "+xslIdentifier, &xslIdentifier);
+ displayDuration(XALAN_STATIC_UCODE_STRING("Parse of ") + xslIdentifier, &xslIdentifier);
}
}
catch(const XSLException&)
@@ -632,13 +610,17 @@
// SECTION: XML Parsing Functions
//==========================================================
-const DOM_Node XSLTEngineImpl::getSourceTreeFromInput(XSLTInputSource *inputSource)
+XalanNode*
+XSLTEngineImpl::getSourceTreeFromInput(XSLTInputSource *inputSource)
{
- DOM_Node sourceTree;
- const DOMString ds("Input XML");
- DOMString xmlIdentifier = ((0 == inputSource) ||
+ XalanNode* sourceTree = 0;
+
+ const XalanDOMString ds(XALAN_STATIC_UCODE_STRING("Input XML"));
+
+ XalanDOMString xmlIdentifier = ((0 == inputSource) ||
(0 == inputSource->getSystemId())) ?
ds : inputSource->getSystemId();
+
if(0 != inputSource->getNode())
{
sourceTree = inputSource->getNode();
@@ -649,14 +631,25 @@
// try to parse the XML here.
try
{
- diag("========= Parsing "+xmlIdentifier+" ==========");
+ diag(XALAN_STATIC_UCODE_STRING("========= Parsing ") +
+ xmlIdentifier +
+ XALAN_STATIC_UCODE_STRING(" =========="));
+
pushTime(&xmlIdentifier);
- sourceTree = m_parserLiaison.parseXMLStream(*inputSource,
- xmlIdentifier);
+ XalanDocument* const theDocument =
+ m_parserLiaison.parseXMLStream(*inputSource,
+ xmlIdentifier);
+ assert(theDocument != 0);
if(0 != m_diagnosticsPrintWriter)
- displayDuration("Parse of "+xmlIdentifier, &xmlIdentifier);
+ displayDuration(XALAN_STATIC_UCODE_STRING("Parse of ") +
+ xmlIdentifier,
+ &xmlIdentifier);
+
+ m_xpathEnvSupport.setSourceDocument(xmlIdentifier, theDocument);
+
+ sourceTree = theDocument;
}
// catch(Exception e)
// @@ Fix later
@@ -682,16 +675,17 @@
-DOM_Document
+XalanDocument*
XSLTEngineImpl::parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- const DOM_Document& docToRegister)
+ const XMLURL& url,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister)
{
// java: url.toExternalForm();
- const DOMString& urlString = url.getURLText();
+ const XalanDOMString& urlString = url.getURLText();
- DOM_Document doc = m_xpathEnvSupport.getSourceDocument(urlString);
+ XalanDocument* doc =
+ m_xpathEnvSupport.getSourceDocument(urlString);
if(doc == 0)
{
@@ -719,62 +713,69 @@
Stylesheet*
XSLTEngineImpl::getStylesheetFromPIURL(
- const DOMString& xslURLString,
- const DOM_Node& fragBase,
- const DOMString& xmlBaseIdent,
+ const XalanDOMString& xslURLString,
+ XalanNode& fragBase,
+ const XalanDOMString& xmlBaseIdent,
bool isRoot,
StylesheetConstructionContext& constructionContext)
{
Stylesheet* stylesheet = 0;
- DOMString stringHolder;
- const DOMString localXSLURLString = clone(trim(xslURLString));
+ XalanDOMString stringHolder;
+ const XalanDOMString localXSLURLString = clone(trim(xslURLString));
- const int fragIndex = indexOf(localXSLURLString, '#');
+ const unsigned int fragIndex = indexOf(localXSLURLString, '#');
- DOM_Document stylesheetDoc;
+ XalanDocument* stylesheetDoc = 0;
if(fragIndex == 0)
{
diag("Locating stylesheet from fragment identifier...");
- const DOMString fragID = substring(localXSLURLString, 1);
+ const XalanDOMString fragID = substring(localXSLURLString, 1);
- DOM_Element nsNode;
+ XalanElement* nsNode = 0;
- if (fragBase.getNodeType() == DOM_Node::DOCUMENT_NODE)
+ if (fragBase.getNodeType() == XalanNode::DOCUMENT_NODE)
{
- const DOM_Document& doc = static_cast<const DOM_Document&>(fragBase);
+ const XalanDocument& doc =
+ static_cast<const XalanDocument&>(fragBase);
nsNode = doc.getDocumentElement();
}
- else if (fragBase.getNodeType() == DOM_Node::ELEMENT_NODE)
+ else if (fragBase.getNodeType() == XalanNode::ELEMENT_NODE)
{
- nsNode = (static_cast<const DOM_Element&>(fragBase));
+ nsNode = static_cast<XalanElement*>(&fragBase);
}
- else
+ else
{
- const DOM_Node node = fragBase.getParentNode();
+ XalanNode* const node = fragBase.getParentNode();
- if (node.getNodeType() == DOM_Node::ELEMENT_NODE)
- nsNode = (static_cast<const DOM_Element&>(node));
+ if (node->getNodeType() == XalanNode::ELEMENT_NODE)
+ {
+ nsNode = static_cast<XalanElement*>(node);
+ }
else
+ {
error("Could not identify fragment: " + fragID);
+ }
}
// Try a bunch of really ugly stuff to find the fragment.
// What's the right way to do this?
- DOMString ds("id(");
+ XalanDOMString ds(XALAN_STATIC_UCODE_STRING("id("));
ds += fragID;
- ds += ")";
+ ds += XALAN_STATIC_UCODE_STRING(")");
+
+ assert(nsNode != 0);
ElementPrefixResolverProxy theProxy(nsNode, m_xpathEnvSupport, m_xpathSupport);
XPathExecutionContextDefault theExecutionContext(m_xpathEnvSupport,
m_xpathSupport,
m_xobjectFactory,
- fragBase,
+ &fragBase,
NodeRefList(),
&theProxy);
@@ -784,11 +785,13 @@
if(nl->getLength() == 0)
{
- ds = "//*[@id='";
+ NodeRefList theEmptyList;
+
+ ds = XALAN_STATIC_UCODE_STRING("//*[@id='");
ds += fragID;
- ds += "']";
+ ds += XALAN_STATIC_UCODE_STRING("']");
- theExecutionContext.setContextNodeList(NodeRefList());
+ theExecutionContext.setContextNodeList(theEmptyList);
xobj = evalXPathStr(ds, theExecutionContext);
@@ -796,11 +799,11 @@
if(nl->getLength() == 0)
{
- ds = "//*[@name='";
+ ds = XALAN_STATIC_UCODE_STRING("//*[@name='");
ds += fragID;
- ds += "']";
+ ds += XALAN_STATIC_UCODE_STRING("']");
- theExecutionContext.setContextNodeList(NodeRefList());
+ theExecutionContext.setContextNodeList(theEmptyList);
xobj = evalXPathStr(ds, theExecutionContext);
@@ -809,11 +812,11 @@
if(nl->getLength() == 0)
{
// Well, hell, maybe it's an XPath...
- theExecutionContext.setContextNodeList(NodeRefList());
+ theExecutionContext.setContextNodeList(theEmptyList);
xobj = evalXPathStr(fragID, theExecutionContext);
- nl = &(xobj->nodeset());
+ nl = &xobj->nodeset();
}
}
}
@@ -822,11 +825,13 @@
{
error("Could not find fragment: " + fragID);
}
+
+ XalanNode* const frag = nl->item(0);
- DOM_Node frag = nl->item(0);
- if(DOM_Node::ELEMENT_NODE == frag.getNodeType())
+ if(XalanNode::ELEMENT_NODE == frag->getNodeType())
{
- pushTime(&frag);
+ pushTime(frag);
+
if(isRoot)
{
m_stylesheetRoot = new StylesheetRoot(stringHolder, constructionContext);
@@ -836,15 +841,21 @@
{
stylesheet = new Stylesheet(*m_stylesheetRoot, stringHolder, constructionContext);
}
+
addTraceListenersToStylesheet();
StylesheetHandler stylesheetProcessor(*this, *stylesheet, constructionContext);
+
FormatterListener& flistener =
dynamic_cast<FormatterListener&>(stylesheetProcessor);
+
FormatterTreeWalker tw(flistener);
+
tw.traverse(frag);
-
- displayDuration("Setup of " + localXSLURLString, &frag);
+
+ displayDuration(XalanDOMString(XALAN_STATIC_UCODE_STRING("Setup of ")) +
+ localXSLURLString,
+ &frag);
}
else
{
@@ -856,7 +867,9 @@
{
// hmmm.. for now I'll rely on the XML parser to handle
// fragment URLs.
- diag("========= Parsing and preparing " + localXSLURLString + " ==========");
+ diag(XalanDOMString(XALAN_STATIC_UCODE_STRING("========= Parsing and preparing ")) +
+ localXSLURLString +
+ XALAN_STATIC_UCODE_STRING(" =========="));
pushTime(&localXSLURLString);
if(isRoot)
@@ -905,18 +918,18 @@
int
-XSLTEngineImpl::getXSLToken(const DOM_Node& node) const
+XSLTEngineImpl::getXSLToken(const XalanNode& node) const
{
int tok = -2;
- if(DOM_Node::ELEMENT_NODE != node.getNodeType()) return tok;
- const DOMString ns =
+ if(XalanNode::ELEMENT_NODE != node.getNodeType()) return tok;
+ const XalanDOMString ns =
m_xpathSupport.getNamespaceOfNode(node);
// was: toLowerCase
if(equals(ns, m_XSLNameSpaceURL))
{
- const DOMString localName =
+ const XalanDOMString localName =
m_xpathSupport.getLocalNameOfNode(node);
// $$$ ToDo: Why can't this iterator be a
@@ -932,7 +945,7 @@
}
else if(equals(ns, s_XSLT4JNameSpaceURL))
{
- const DOMString localName = m_xpathSupport.getLocalNameOfNode(node);
+ const XalanDOMString localName = m_xpathSupport.getLocalNameOfNode(node);
const ElementKeysMapType::const_iterator j =
s_XSLT4JElementKeys.find(localName);
if(j != s_XSLT4JElementKeys.end())
@@ -950,7 +963,7 @@
bool
-XSLTEngineImpl::isXSLTagOfType(const DOM_Node& node,
+XSLTEngineImpl::isXSLTagOfType(const XalanNode& node,
int tagType) const
{
return getXSLToken(node) == tagType ? true : false;
@@ -968,9 +981,11 @@
// is to keep all the conversion functionality in the
// XObject classes.
// JMD: Has to be an XObject
+
+ const int type = value.getType();
+
+ XalanDOMString s;
- int type = value.getType();
- DOMString s;
switch(type)
{
case XObject::eTypeBoolean:
@@ -978,47 +993,59 @@
case XObject::eTypeString:
s = value.str();
characters(toCharArray(s), 0, length(s));
- break;
+ break;
+
case XObject::eTypeNodeSet:
{
- const NodeRefListBase* nl = &(value.nodeset());
- int nChildren = nl->getLength();
- for(int i = 0; i < nChildren; i++)
- {
- DOM_Node pos = nl->item(i);
- const DOM_Node& top = pos;
- while(0 != pos)
- {
- flushPending();
- cloneToResultTree(pos, false, false, true);
- DOM_Node nextNode = pos.getFirstChild();
- while(0 == nextNode)
+ const NodeRefListBase& nl = value.nodeset();
+ const unsigned int nChildren = nl.getLength();
+
+ for(unsigned int i = 0; i < nChildren; i++)
+ {
+ XalanNode* pos = nl.item(i);
+ XalanNode* const top = pos;
+
+ while(0 != pos)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
- {
- endElement(c_wstr(pos.getNodeName()));
- }
- if(top == pos)
- break;
- nextNode = pos.getNextSibling();
- if(0 == nextNode)
+ flushPending();
+
+ cloneToResultTree(*pos, false, false, true);
+
+ XalanNode* nextNode = pos->getFirstChild();
+
+ while(0 == nextNode)
{
- pos = pos.getParentNode();
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
+ {
+ endElement(c_wstr(pos->getNodeName()));
+ }
+
if(top == pos)
+ break;
+
+ nextNode = pos->getNextSibling();
+
+ if(0 == nextNode)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ pos = pos->getParentNode();
+
+ if(top == pos)
{
- endElement(c_wstr(pos.getNodeName()));
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
+ {
+ endElement(c_wstr(pos->getNodeName()));
+ }
+
+ nextNode = 0;
+ break;
}
- nextNode = 0;
- break;
}
}
+
+ pos = nextNode;
}
- pos = nextNode;
}
}
- }
break;
case XObject::eTypeResultTreeFrag:
@@ -1036,8 +1063,8 @@
bool
XSLTEngineImpl::functionAvailable(
- DOMString& theNamespace,
- DOMString& extensionName) const
+ XalanDOMString& theNamespace,
+ XalanDOMString& extensionName) const
{
return m_xpathEnvSupport.functionAvailable(theNamespace, extensionName);
}
@@ -1050,20 +1077,40 @@
XObject*
XSLTEngineImpl::extFunction(
XPathExecutionContext& executionContext,
- const DOMString& theNamespace,
- const DOMString& extensionName,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
const std::vector<XObject*>& argVec) const
{
return m_xpathEnvSupport.extFunction( executionContext,
theNamespace, extensionName, argVec);
}
+
+
void
-XSLTEngineImpl::handleFunctionsInstruction(DOM_Element extensionElem)
+XSLTEngineImpl::handleFunctionsInstruction(XalanElement& /* extensionElem */)
{
error("Calling external functions is not supported in the C++ version of Xalan!!!");
}
+
+
+StylesheetRoot*
+XSLTEngineImpl::getStylesheetRoot() const
+{
+ return m_stylesheetRoot;
+}
+
+
+
+void
+XSLTEngineImpl::setStylesheetRoot(StylesheetRoot* theStylesheet)
+{
+ m_stylesheetRoot = theStylesheet;
+}
+
+
+
//==========================================================
// SECTION: Diagnostic functions
//==========================================================
@@ -1129,17 +1176,12 @@
}
}
-
-void XSLTEngineImpl::message(const DOMString& msg)
-{
- DOM_Node node;
- message(node, node, msg);
-}
-
-void XSLTEngineImpl::message( const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg)
+void
+XSLTEngineImpl::message(
+ const XalanDOMString& msg,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode) const
{
if (m_problemListener != 0)
{
@@ -1148,6 +1190,7 @@
ProblemListener::eMESSAGE,
styleNode, sourceNode,
c_wstr(msg), 0, 0, 0);
+
if(shouldThrow == true)
{
throw XSLTProcessorException(msg);
@@ -1156,10 +1199,12 @@
}
-void XSLTEngineImpl::problem(const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- ProblemListener::eClassification classification) const
+void
+XSLTEngineImpl::problem(
+ const XalanDOMString& msg,
+ ProblemListener::eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode) const
{
if (m_problemListener == 0) return;
@@ -1181,39 +1226,25 @@
}
}
-void
-XSLTEngineImpl::warn(const DOMString& msg) const
-{
- warn(DOM_Node(), DOM_Node(), msg);
-}
-
void
XSLTEngineImpl::warn(
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg) const
+ const XalanDOMString& msg,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode) const
{
- problem(styleNode, sourceNode, msg, ProblemListener::eWARNING);
+ problem(msg, ProblemListener::eWARNING, styleNode, sourceNode);
}
void
-XSLTEngineImpl::error(const DOMString& msg) const
-{
- error(DOM_Node(), DOM_Node(), msg);
-}
-
-
-
-void
XSLTEngineImpl::error(
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg) const
+ const XalanDOMString& msg,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode) const
{
- problem(styleNode, sourceNode, msg, ProblemListener::eERROR);
+ problem(msg, ProblemListener::eERROR, styleNode, sourceNode);
}
@@ -1253,7 +1284,7 @@
void
-XSLTEngineImpl::displayDuration(const DOMString& info,
+XSLTEngineImpl::displayDuration(const XalanDOMString& info,
const void* key) const
{
if(0 != key)
@@ -1263,11 +1294,11 @@
if(0 != m_diagnosticsPrintWriter)
{
- DOMString msg(info);
+ XalanDOMString msg(info);
- msg += " took ";
+ msg += XALAN_STATIC_UCODE_STRING(" took ");
msg += DoubleToDOMString(millis);
- msg += " millis";
+ msg += XALAN_STATIC_UCODE_STRING(" milliseconds");
m_diagnosticsPrintWriter->println(msg);
}
@@ -1283,7 +1314,7 @@
}
void
-XSLTEngineImpl::diag(const DOMString& s) const
+XSLTEngineImpl::diag(const XalanDOMString& s) const
{
if (0 != m_diagnosticsPrintWriter)
{
@@ -1301,105 +1332,116 @@
m_traceTemplates = b;
}
-/**
- * If this is set to true, simple traces of
- * template calls are made.
- */
+
+
void
XSLTEngineImpl::setTraceSelect(bool b)
{
m_traceSelects = b;
}
+
+
bool XSLTEngineImpl::isTraceSelect() const
{
return m_traceSelects;
}
-/**
- * If this is set to true, debug diagnostics about
- * template children as they are being constructed
- * will be written to the m_diagnosticsPrintWriter
- * stream. diagnoseTemplateChildren is false by
- * default.
- */
-void XSLTEngineImpl::setTraceTemplateChildren(bool b)
+void
+XSLTEngineImpl::setTraceTemplateChildren(bool b)
{
m_traceTemplateChildren = b;
}
+
+void
+XSLTEngineImpl::setQuietConflictWarnings(bool b)
+{
+ m_quietConflictWarnings = b;
+}
+
+
+
void
XSLTEngineImpl::traceSelect(
- const DOM_Element& theTemplate,
+ const XalanElement& theTemplate,
const NodeRefListBase& nl) const
{
- DOMString msg = theTemplate.getNodeName() + DOMString(": ");
- DOM_Attr attr = theTemplate.getAttributeNode(Constants::ATTRNAME_SELECT);
+ XalanDOMString msg = theTemplate.getNodeName() + XalanDOMString(XALAN_STATIC_UCODE_STRING(": "));
+
+ XalanAttr* attr = theTemplate.getAttributeNode(Constants::ATTRNAME_SELECT);
+
if(0 != attr)
{
- msg += attr.getValue();
- msg += ", ";
+ msg += attr->getValue();
+ msg += XALAN_STATIC_UCODE_STRING(", ");
msg += LongToDOMString(nl.getLength());
- msg += " selected";
+ msg += XALAN_STATIC_UCODE_STRING(" selected");
}
else
{
- msg += "*|text(), (default select), ";
+ msg += XALAN_STATIC_UCODE_STRING("*|text(), (default select), ");
msg += LongToDOMString(nl.getLength());
- msg += " selected";
+ msg += XALAN_STATIC_UCODE_STRING(" selected");
}
+
attr = theTemplate.getAttributeNode(Constants::ATTRNAME_MODE);
+
if(0 != attr)
{
- msg += DOMString(", mode = ") + attr.getValue();
+ msg += XalanDOMString(XALAN_STATIC_UCODE_STRING(", mode = ")) + attr->getValue();
}
+
+ // $$$ ToDo: We do all of this work, and don't output the message.
//System.out.println(msg);
}
-
-/**
-* Print a trace of a template that is being called, either by
-* a match, name, or as part of for-each.
-*/
+
+
void
-XSLTEngineImpl::traceTemplate(const DOM_Element& theTemplate) const
+XSLTEngineImpl::traceTemplate(const XalanElement& theTemplate) const
{
- DOMString msg;
- DOM_Attr attr = theTemplate.getAttributeNode(Constants::ATTRNAME_MATCH);
+ XalanDOMString msg;
+
+ XalanAttr* attr = theTemplate.getAttributeNode(Constants::ATTRNAME_MATCH);
+
if(0 != attr)
{
- msg = DOMString("Calling template for: ") + attr.getValue();
+ msg = XalanDOMString(XALAN_STATIC_UCODE_STRING("Calling template for: ")) + attr->getValue();
}
else
{
attr = theTemplate.getAttributeNode(Constants::ATTRNAME_NAME);
+
if(0 != attr)
{
- msg = DOMString("Calling named template, name = ") + attr.getValue();
+ msg = XalanDOMString(XALAN_STATIC_UCODE_STRING("Calling named template, name = ")) + attr->getValue();
}
else
{
const int xslToken = getXSLToken(theTemplate);
+
if(Constants::ELEMNAME_FOREACH == xslToken)
{
attr = theTemplate.getAttributeNode(Constants::ATTRNAME_SELECT);
+
if(0 != attr)
{
- msg = DOMString("Processing for-each, select = ") + attr.getValue();
+ msg = XalanDOMString(XALAN_STATIC_UCODE_STRING("Processing for-each, select = ")) + attr->getValue();
}
else
{
error("for-each must have either a match or name attribute");
- msg = "";
+ clear(msg);
}
}
else
{
error("templates must have either a match or name attribute");
- msg = "";
+ clear(msg);
}
}
}
@@ -1408,25 +1450,26 @@
if(0 != attr)
{
- msg += DOMString(", mode = ") + attr.getValue();
+ msg += XalanDOMString(XALAN_STATIC_UCODE_STRING(", mode = ")) + attr->getValue();
}
+ // $$$ ToDo: We do all of this work, and don't output the message.
//System.out.println(msg);
}
void
XSLTEngineImpl::diagnoseTemplateChildren(
- const DOM_Node& templateChild,
- const DOM_Node& sourceNode) const
+ const XalanNode& templateChild,
+ const XalanNode& sourceNode) const
{
if(m_traceTemplateChildren)
{
- const DOMString templateChildTagName = templateChild.getNodeName();
- const DOMString xmlElemName = sourceNode.getNodeName();
- diag(DOMString("source node: ")
+ const XalanDOMString templateChildTagName = templateChild.getNodeName();
+ const XalanDOMString xmlElemName = sourceNode.getNodeName();
+ diag(XalanDOMString(XALAN_STATIC_UCODE_STRING("source node: "))
+ xmlElemName
- + DOMString(", template-node: ")
+ + XalanDOMString(XALAN_STATIC_UCODE_STRING(", template-node: "))
+ templateChildTagName);
}
}
@@ -1469,8 +1512,8 @@
m_variableStacks.popCurrentContext();
}
-void XSLTEngineImpl::addResultNamespaceDecl(const DOMString& prefix,
- const DOMString& namespaceVal)
+void XSLTEngineImpl::addResultNamespaceDecl(const XalanDOMString& prefix,
+ const XalanDOMString& namespaceVal)
{
NamespaceVectorType nsVector;
NameSpace ns(prefix, namespaceVal);
@@ -1496,19 +1539,19 @@
void
XSLTEngineImpl::addResultAttribute(
AttributeListImpl& attList,
- const DOMString& aname,
- const DOMString& value)
+ const XalanDOMString& aname,
+ const XalanDOMString& value)
{
assert(length(value) > 0);
- const bool isPrefix = startsWith(aname, "xmlns:");
- if (equals(aname, "xmlns") || isPrefix == true)
+ const bool isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix == true)
{
- const DOMString p = isPrefix == true ? substring(aname, 6) : DOMString();
+ const XalanDOMString p = isPrefix == true ? substring(aname, 6) : XalanDOMString();
addResultNamespaceDecl(p, value);
}
attList.removeAttribute(c_wstr(aname));
- attList.addAttribute(c_wstr(aname), c_wstr(DOMString("CDATA")), c_wstr(value));
+ attList.addAttribute(c_wstr(aname), c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")), c_wstr(value));
}
@@ -1528,7 +1571,7 @@
fireGenerateEvent(ge);
}
m_pendingAttributes.clear();
- m_pendingElementName = "";
+ clear(m_pendingElementName);
}
}
@@ -1820,7 +1863,7 @@
void
XSLTEngineImpl::cloneToResultTree(
- const DOM_Node& node,
+ XalanNode& node,
bool isLiteral,
bool overrideStrip,
bool shouldCloneAttributes)
@@ -1829,7 +1872,7 @@
switch(node.getNodeType())
{
- case DOM_Node::TEXT_NODE:
+ case XalanNode::TEXT_NODE:
{
// If stripWhiteSpace is false, then take this as an override and
// just preserve the space, otherwise use the XSL whitespace rules.
@@ -1838,9 +1881,11 @@
stripWhiteSpace = isLiteral ? true : false;
// was: stripWhiteSpace = isLiteral ? true : shouldStripSourceNode(node);
}
- const DOM_Text& tx = static_cast<const DOM_Text&>(node);
- DOMString data;
- // System.out.println("stripWhiteSpace = "+stripWhiteSpace+", "+tx.getData());
+
+ XalanText& tx = static_cast<XalanText&>(node);
+
+ XalanDOMString data;
+
if(stripWhiteSpace == true)
{
if(!m_xpathSupport.isIgnorableWhitespace(tx))
@@ -1848,14 +1893,15 @@
data = getNormalizedText(tx);
if((0 != length(data)) && (0 == length(trim(data))))
{
- data = "";
+ clear(data);
}
}
}
else
{
- const DOM_Node parent = node.getParentNode();
- if(parent==0 || DOM_Node::DOCUMENT_NODE != parent.getNodeType())
+ XalanNode* parent = node.getParentNode();
+
+ if(parent == 0 || XalanNode::DOCUMENT_NODE != parent->getNodeType())
{
data = getNormalizedText(tx);
}
@@ -1887,13 +1933,13 @@
}
break;
- case DOM_Node::ELEMENT_NODE:
+ case XalanNode::ELEMENT_NODE:
{
if(shouldCloneAttributes == true)
{
- copyAttributesToAttList(node,
+ copyAttributesToAttList(&node,
m_stylesheetRoot,
- static_cast<const DOM_Element&>(node),
+ static_cast<const XalanElement&>(node),
m_pendingAttributes);
copyNamespaceAttributes(node,
@@ -1904,58 +1950,60 @@
}
break;
- case DOM_Node::CDATA_SECTION_NODE:
+ case XalanNode::CDATA_SECTION_NODE:
{
- const DOM_CDATASection& theCDATA =
- static_cast<const DOM_CDATASection&>(node);
- const DOMString data = theCDATA.getData();
+ const XalanCDATASection& theCDATA =
+ static_cast<const XalanCDATASection&>(node);
+
+ const XalanDOMString data = theCDATA.getData();
+
cdata(toCharArray(data), 0, length(data));
}
break;
- case DOM_Node::ATTRIBUTE_NODE:
+ case XalanNode::ATTRIBUTE_NODE:
{
- const DOM_Attr& attr =
- static_cast<const DOM_Attr&>(node);
+ const XalanAttr& attr =
+ static_cast<const XalanAttr&>(node);
+
addResultAttribute(m_pendingAttributes,
attr.getName(),
attr.getValue());
}
break;
- case DOM_Node::COMMENT_NODE:
+ case XalanNode::COMMENT_NODE:
{
- const DOM_Comment& theComment =
- static_cast<const DOM_Comment&>(node);
- const DOMString theData = theComment.getData();
+ const XalanComment& theComment =
+ static_cast<const XalanComment&>(node);
+
+ const XalanDOMString theData = theComment.getData();
+
comment(toCharArray(theData));
}
break;
- case DOM_Node::DOCUMENT_FRAGMENT_NODE:
+ case XalanNode::DOCUMENT_FRAGMENT_NODE:
{
- error(DOM_Node(), node, "No clone of a document fragment!");
+ error("No clone of a document fragment!");
}
break;
- case DOM_Node::ENTITY_REFERENCE_NODE:
+ case XalanNode::ENTITY_REFERENCE_NODE:
{
-#if 0
- EntityReference er = (EntityReference)node;
- entityReference(toCharArray(er.getNodeName()));
-#else
- const DOMString theName = node.getNodeName();
+ const XalanDOMString theName = node.getNodeName();
entityReference(toCharArray(theName));
-#endif
}
break;
- case DOM_Node::PROCESSING_INSTRUCTION_NODE:
+ case XalanNode::PROCESSING_INSTRUCTION_NODE:
{
- const DOM_ProcessingInstruction& pi =
- static_cast<const DOM_ProcessingInstruction&>(node);
- const DOMString theTarget = pi.getTarget();
- const DOMString theData = pi.getData();
+ const XalanProcessingInstruction& pi =
+ static_cast<const XalanProcessingInstruction&>(node);
+
+ const XalanDOMString theTarget = pi.getTarget();
+ const XalanDOMString theData = pi.getData();
+
processingInstruction(toCharArray(theTarget),
toCharArray(theData));
}
@@ -1963,11 +2011,11 @@
default:
{
- // $$$ ToDo: Fix this when DOMString::operator+() is const.
- DOMString msg("Can not create item in result tree: ");
+ // $$$ ToDo: Fix this when XalanDOMString::operator+() is const.
+ XalanDOMString msg("Can not create item in result tree: ");
msg +=node.getNodeName();
error(msg);
-// error(DOMString("Can not create item in result tree: ") +
+// error(XalanDOMString("Can not create item in result tree: ") +
// node.getNodeName());
}
}
@@ -1979,8 +2027,8 @@
XSLTEngineImpl::createResultTreeFrag(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode)
{
DocumentHandler* const savedFormatterListener = m_flistener;
@@ -1988,10 +2036,10 @@
std::auto_ptr<ResultTreeFragBase> pfrag(createDocFrag());
FormatterToDOM tempFormatter(m_resultTreeFactory,
- DOM_UnimplementedDocumentFragment(pfrag.get()));
+ pfrag.get());
- const DOMString savedPendingName = m_pendingElementName;
- m_pendingElementName = DOMString();
+ const XalanDOMString savedPendingName = m_pendingElementName;
+ m_pendingElementName = XalanDOMString();
AttributeListImpl savedPendingAttributes(m_pendingAttributes);
m_pendingAttributes.clear();
@@ -2013,20 +2061,20 @@
FormatterListener* flistener,
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& templateParent,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode& sourceTree,
+ XalanNode& sourceNode,
const QName& mode)
{
flushPending();
DocumentHandler* savedFormatterListener = m_flistener;
- DOMString savedPendingName = m_pendingElementName;
+ XalanDOMString savedPendingName = m_pendingElementName;
m_pendingElementName = 0;
AttributeListImpl savedPendingAttributes = m_pendingAttributes;
m_pendingAttributes.clear();
m_flistener = flistener;
- templateParent.executeChildren(executionContext, sourceTree, sourceNode, mode);
+ templateParent.executeChildren(executionContext, &sourceTree, &sourceNode, mode);
flushPending();
m_flistener = savedFormatterListener;
@@ -2039,39 +2087,50 @@
XSLTEngineImpl::outputResultTreeFragment(const XObject& theTree)
{
const ResultTreeFragBase& docFrag = theTree.rtree();
- const NodeRefListBase& nl = docFrag.getChildNodesAsNodeRefList();
+
+ // $$$ ToDo: We should optimize this so that we don't have
+ // a node list.
+ const XalanNodeList* nl = docFrag.getChildNodes();
+ assert(nl != 0);
- const int nChildren = nl.getLength();
+ const unsigned int nChildren = nl->getLength();
- for(int i = 0; i < nChildren; i++)
+ for(unsigned int i = 0; i < nChildren; i++)
{
- DOM_Node pos(nl.item(i));
- const DOM_Node top(pos);
+ XalanNode* pos = nl->item(i);
+ XalanNode* const top = pos;
while(0 != pos)
{
flushPending();
- cloneToResultTree(pos, false, false, true);
- DOM_Node nextNode = pos.getFirstChild();
+
+ cloneToResultTree(*pos, false, false, true);
+
+ XalanNode* nextNode = pos->getFirstChild();
+
while(0 == nextNode)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
{
- endElement(c_wstr(pos.getNodeName()));
+ endElement(c_wstr(pos->getNodeName()));
}
+
if(top == pos)
break;
- nextNode = pos.getNextSibling();
+
+ nextNode = pos->getNextSibling();
+
if(0 == nextNode)
{
- pos = pos.getParentNode();
+ pos = pos->getParentNode();
+
if(top == pos || 0 == pos)
{
if (0 != pos)
{
- if(DOM_Node::ELEMENT_NODE == pos.getNodeType())
+ if(XalanNode::ELEMENT_NODE == pos->getNodeType())
{
- endElement(c_wstr(pos.getNodeName()));
+ endElement(c_wstr(pos->getNodeName()));
}
}
@@ -2080,6 +2139,7 @@
}
}
}
+
pos = nextNode;
}
}
@@ -2087,57 +2147,81 @@
/**
- * Tell if a given element name should output it's text as cdata.
+ * Tell if a given element name should output its text as cdata.
*/
-bool XSLTEngineImpl::isCDataResultElem(const DOMString& elementName)
+bool
+XSLTEngineImpl::isCDataResultElem(const XalanDOMString& elementName)
{
+#if defined(XALAN_NO_NAMESPACES)
+ typedef Stylesheet::QNameVectorType QNameVectorType;
+#else
+ using Stylesheet::QNameVectorType;
+#endif
+
bool is = false;
- const Stylesheet::QNameVectorType& cdataElems = m_stylesheetRoot->getCdataSectionElems();
- if(0 != cdataElems.size())
+ const QNameVectorType& cdataElems = m_stylesheetRoot->getCdataSectionElems();
+ const QNameVectorType::size_type theSize = cdataElems.size();
+
+ if(0 != theSize)
{
- DOMString elemNS;
- DOMString elemLocalName;
- const int indexOfNSSep = indexOf(elementName, ':');
- if(indexOfNSSep > 0)
+ XalanDOMString elemNS;
+ XalanDOMString elemLocalName;
+
+ const unsigned int indexOfNSSep = indexOf(elementName, ':');
+
+ if(indexOfNSSep == length(elementName))
{
- DOMString prefix = substring(elementName, 0, indexOfNSSep);
- if(equals(prefix, "xml"))
+ elemLocalName = elementName;
+ }
+ else
+ {
+ const XalanDOMString prefix = substring(elementName, 0, indexOfNSSep);
+
+ if(equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
{
elemNS = DOMServices::s_XMLNamespaceURI;
}
else
{
elemNS = getResultNamespaceForPrefix(prefix);
- }
- if(0 == elemNS.length())
+ }
+
+ if(0 == length(elemNS))
{
- error(DOMString("Prefix must resolve to a namespace: ") + prefix);
+ error(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
// throw new RuntimeException(+prefix);
}
+
+ elemLocalName = substring(elementName, indexOfNSSep + 1);
}
- elemLocalName = (indexOfNSSep < 0) ? elementName : substring(elementName, indexOfNSSep+1);
- const int n = cdataElems.size();
- for(int i = 0; i < n; i++)
+
+ for(Stylesheet::QNameVectorType::size_type i = 0; i < theSize; i++)
{
const QName& qname = cdataElems[i];
+
is = qname.equals(QName(elemNS, elemLocalName));
+
if(is)
break;
}
}
+
return is;
}
-bool XSLTEngineImpl::qnameEqualsResultElemName(const QName& qname, const DOMString& elementName)
+bool XSLTEngineImpl::qnameEqualsResultElemName(const QName& qname, const XalanDOMString& elementName)
{
- DOMString elemNS;
- DOMString elemLocalName;
- const int indexOfNSSep = indexOf(elementName, ':');
- if(indexOfNSSep > 0)
+ XalanDOMString elemNS;
+ XalanDOMString elemLocalName;
+
+ const unsigned int indexOfNSSep = indexOf(elementName, ':');
+
+ if(indexOfNSSep < length(elementName))
{
- DOMString prefix = substring(elementName, 0, indexOfNSSep);
- if(equals(prefix, "xml"))
+ const XalanDOMString prefix = substring(elementName, 0, indexOfNSSep);
+
+ if(equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
{
elemNS = DOMServices::s_XMLNamespaceURI;
}
@@ -2147,7 +2231,7 @@
}
if(0 == elemNS.length())
{
- error(DOMString("Prefix must resolve to a namespace: ") + prefix);
+ error(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
// throw new RuntimeException(+prefix);
}
}
@@ -2155,8 +2239,8 @@
return qname.equals(QName(elemNS, elemLocalName));
}
-DOMString
-XSLTEngineImpl::getResultNamespaceForPrefix(const DOMString& prefix) const
+XalanDOMString
+XSLTEngineImpl::getResultNamespaceForPrefix(const XalanDOMString& prefix) const
{
// Search vector from first element back
return QName::getNamespaceForPrefix(m_resultNameSpaces, prefix, false);
@@ -2164,8 +2248,8 @@
-DOMString
-XSLTEngineImpl::getResultPrefixForNamespace(const DOMString& theNamespace) const
+XalanDOMString
+XSLTEngineImpl::getResultPrefixForNamespace(const XalanDOMString& theNamespace) const
{
// Search vector from first element back
return QName::getPrefixForNamespace(m_resultNameSpaces, theNamespace, false);
@@ -2173,41 +2257,55 @@
-DOMString
+XalanDOMString
XSLTEngineImpl::getPrefixForNamespace(
- const DOMString& theNamespace,
- const DOM_Element& namespaceContext) const
+ const XalanDOMString& theNamespace,
+ const XalanElement& namespaceContext) const
{
- int type;
- DOM_Node parent = namespaceContext;
- DOMString prefix;
-
- while ((0 != parent) && (0 == length(prefix))
- && (((type = parent.getNodeType()) == DOM_Node::ELEMENT_NODE)
- || (type == DOM_Node::ENTITY_REFERENCE_NODE)))
- {
- if (type == DOM_Node::ELEMENT_NODE)
- {
- DOM_NamedNodeMap nnm = parent.getAttributes();
- for (unsigned long i = 0; i < nnm.getLength(); i ++)
- {
- const DOM_Node attr = nnm.item(i);
- const DOMString aname = attr.getNodeName();
- const bool isPrefix = startsWith(aname, "xmlns:");
- if (equals(aname, "xmlns") || isPrefix)
+ int type;
+ const XalanNode* parent = &namespaceContext;
+ XalanDOMString prefix;
+
+ while (0 != parent && 0 == length(prefix)
+ && ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
+ || type == XalanNode::ENTITY_REFERENCE_NODE))
+ {
+ if (type == XalanNode::ELEMENT_NODE)
+ {
+ const XalanNamedNodeMap* const nnm =
+ parent->getAttributes();
+ assert(nnm != 0);
+
+ const unsigned int theLength = nnm->getLength();
+
+ for (unsigned int i = 0; i < theLength; i ++)
+ {
+ const XalanNode* const attr = nnm->item(i);
+ assert(attr != 0);
+
+ const XalanDOMString aname = attr->getNodeName();
+
+ const bool isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix)
{
- const int index = indexOf(aname, ':');
- const DOMString namespaceOfPrefix = attr.getNodeValue();
+ const unsigned int index = indexOf(aname, ':');
+ assert(index < length(aname));
+
+ const XalanDOMString namespaceOfPrefix = attr->getNodeValue();
+
if((0 != length(namespaceOfPrefix)) &&
equals(namespaceOfPrefix, theNamespace))
{
- prefix = isPrefix ? substring(aname, index + 1) : DOMString();
+ prefix = isPrefix ? substring(aname, index + 1) : XalanDOMString();
}
}
}
}
- parent = m_xpathSupport.getParentOfNode(parent);
+
+ parent = m_xpathSupport.getParentOfNode(*parent);
}
+
return prefix;
}
@@ -2215,40 +2313,49 @@
void
XSLTEngineImpl::copyNamespaceAttributes(
- const DOM_Node& src,
+ const XalanNode& src,
bool srcIsStylesheetTree)
{
int type;
- DOM_Node parent = src;
+
+ const XalanNode* parent = &src;
+
while (parent != 0
- && ((type = parent.getNodeType()) == DOM_Node::ELEMENT_NODE
- || (type == DOM_Node::ENTITY_REFERENCE_NODE)))
+ && ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
+ || type == XalanNode::ENTITY_REFERENCE_NODE))
{
- if (type == DOM_Node::ELEMENT_NODE)
+ if (type == XalanNode::ELEMENT_NODE)
{
- // $$$ ToDo: This can become const when getLength()
- // is made const.
- DOM_NamedNodeMap nnm = parent.getAttributes();
- const int nAttrs = nnm.getLength();
- for (int i = 0; i < nAttrs; i++)
- {
- const DOM_Node attr = nnm.item(i);
- const DOMString aname = attr.getNodeName();
- const bool isPrefix = startsWith(aname, "xmlns:");
- if (equals(aname, "xmlns") || isPrefix)
+ const XalanNamedNodeMap* const nnm =
+ parent->getAttributes();
+ assert(nnm != 0);
+
+ const unsigned int nAttrs = nnm->getLength();
+
+ for (unsigned int i = 0; i < nAttrs; i++)
+ {
+ const XalanNode* const attr = nnm->item(i);
+
+ const XalanDOMString aname = attr->getNodeName();
+
+ const bool isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+
+ if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix)
{
- const DOMString prefix = isPrefix ? substring(aname, 6) : DOMString();
- const DOMString desturi = getResultNamespaceForPrefix(prefix);
- DOMString srcURI = attr.getNodeValue();
+ const XalanDOMString prefix = isPrefix ? substring(aname, 6) : XalanDOMString();
+ const XalanDOMString desturi = getResultNamespaceForPrefix(prefix);
+ XalanDOMString srcURI = attr->getNodeValue();
+
const bool isXSLNS =
- (srcIsStylesheetTree && equalsIgnoreCase(srcURI, m_XSLNameSpaceURL)
- || (0 != m_stylesheetRoot->lookupExtensionNSHandler(srcURI))
- || (srcIsStylesheetTree && equalsIgnoreCase(srcURI, s_XSLT4JNameSpaceURL)));
+ srcIsStylesheetTree && equalsIgnoreCase(srcURI, m_XSLNameSpaceURL)
+ || 0 != m_stylesheetRoot->lookupExtensionNSHandler(srcURI)
+ || srcIsStylesheetTree && equalsIgnoreCase(srcURI, s_XSLT4JNameSpaceURL);
- if(startsWith(srcURI, "quote:"))
+ if(startsWith(srcURI, XALAN_STATIC_UCODE_STRING("quote:")))
{
srcURI = substring(srcURI, 6);
}
+
if(!equalsIgnoreCase(srcURI, desturi) && !isXSLNS)
{
addResultAttribute(m_pendingAttributes, aname, srcURI);
@@ -2256,7 +2363,8 @@
}
}
}
- parent = parent.getParentNode();
+
+ parent = parent->getParentNode();
}
}
@@ -2264,7 +2372,7 @@
XObject*
XSLTEngineImpl::evalXPathStr(
- const DOMString& str,
+ const XalanDOMString& str,
XPathExecutionContext& executionContext)
{
m_xpathProcessor->initXPath(*m_xpath,
@@ -2273,15 +2381,17 @@
m_xobjectFactory,
m_xpathEnvSupport);
- return m_xpath->execute(executionContext);
+ return m_xpath->execute(executionContext.getCurrentNode(),
+ *executionContext.getPrefixResolver(),
+ executionContext);
}
XObject*
XSLTEngineImpl::evalXPathStr(
- const DOMString& str,
- const DOM_Node& contextNode,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext)
{
@@ -2298,12 +2408,12 @@
XObject*
XSLTEngineImpl::evalXPathStr(
- const DOMString& str,
- const DOM_Node& contextNode,
- const DOM_Element& prefixResolver,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
+ const XalanElement& prefixResolver,
XPathExecutionContext& executionContext)
{
- ElementPrefixResolverProxy theProxy(prefixResolver,
+ ElementPrefixResolverProxy theProxy(&prefixResolver,
m_xpathEnvSupport,
m_xpathSupport);
@@ -2315,7 +2425,7 @@
// $$$ ToDo: This really should not be here...
XPath*
XSLTEngineImpl::createProcessingXPath(
- const DOMString& str,
+ const XalanDOMString& str,
XPathExecutionContext& executionContext,
const PrefixResolver& resolver)
{
@@ -2337,7 +2447,7 @@
*/
XPath*
XSLTEngineImpl::createXPath(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
XPath* const xpath = m_xpathFactory.create();
@@ -2356,25 +2466,25 @@
*/
double
XSLTEngineImpl::evalMatchPatternStr(
- const DOMString& str,
- const DOM_Node& context,
+ const XalanDOMString& str,
+ XalanNode* context,
XPathExecutionContext& executionContext)
-// const DOM_Node& context,
-// const PrefixResolver& resolver)
{
- assert(executionContext.getPrefixResolver() != 0);
-
FactoryObjectAutoPointer<XPath> theXPath(&m_xpathFactory,
m_xpathFactory.create());
+ const PrefixResolver* const theResolver =
+ executionContext.getPrefixResolver();
+ assert(theResolver != 0);
+
// This needs to use a factory method of some sort.
m_xpathProcessor->initMatchPattern(*theXPath.get(),
str,
- *executionContext.getPrefixResolver(),
+ *theResolver,
executionContext.getXObjectFactory(),
m_xpathEnvSupport);
- return theXPath->getMatchScore(context, executionContext);
+ return theXPath->getMatchScore(context, *theResolver, executionContext);
}
@@ -2384,7 +2494,7 @@
*/
XPath*
XSLTEngineImpl::createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
XPath* const xpath = m_xpathFactory.create();
@@ -2398,69 +2508,72 @@
XPath* XSLTEngineImpl::getExpression(
AttributeList& attrs,
- const DOMString& key,
+ const XalanDOMString& key,
const PrefixResolver& resolver)
{
const XMLCh* val = attrs.getValue(c_wstr(key));
- return (0 != val) ? createXPath(DOMString(val), resolver) : 0;
+ return (0 != val) ? createXPath(XalanDOMString(val), resolver) : 0;
}
-DOMString
+XalanDOMString
XSLTEngineImpl::getAttrVal(
- const DOM_Element& el,
- const DOMString& key,
- const DOM_Node& /* contextNode */ )
+ const XalanElement& el,
+ const XalanDOMString& key,
+ const XalanNode& /* contextNode */ )
{
// @@ JMD: context not used
- return getAttrVal( el, key);
+ return getAttrVal(el, key);
}
-DOMString
+XalanDOMString
XSLTEngineImpl::getAttrVal(
- const DOM_Element& el,
- const DOMString& key)
+ const XalanElement& el,
+ const XalanDOMString& key)
{
- const DOM_Attr a = el.getAttributeNode(key);
- return 0 == a ? DOMString() : a.getValue();
+ const XalanAttr* a = el.getAttributeNode(key);
+
+ return 0 == a ? XalanDOMString() : a->getValue();
}
-DOMString
+XalanDOMString
XSLTEngineImpl::evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue,
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue,
XPathExecutionContext& executionContext)
{
- DOMString expressedValue; // return value
- StringTokenizer tokenizer(stringedValue, "{}\"\'", true);
- const int nTokens = tokenizer.countTokens();
+ XalanDOMString expressedValue;
+ StringTokenizer tokenizer(stringedValue, XALAN_STATIC_UCODE_STRING("{}\"\'"), true);
+
+ const unsigned int nTokens = tokenizer.countTokens();
+
if(nTokens < 2)
{
expressedValue = stringedValue; // then do the simple thing
}
else
{
- DOMString buffer;
- DOMString t; // base token
- DOMString lookahead; // next token
- DOMString error; // if not empty, break from loop
+ XalanDOMString buffer;
+ XalanDOMString t; // base token
+ XalanDOMString lookahead; // next token
+ XalanDOMString error; // if not empty, break from loop
- ElementPrefixResolverProxy theProxy(namespaceContext, m_xpathEnvSupport, m_xpathSupport);
+ ElementPrefixResolverProxy theProxy(&namespaceContext, m_xpathEnvSupport, m_xpathSupport);
while(tokenizer.hasMoreTokens())
{
if(length(lookahead) != 0)
{
t = lookahead;
- lookahead = "";
+ clear(lookahead);
}
else t = tokenizer.nextToken();
@@ -2479,11 +2592,11 @@
{
// Attr template start
lookahead = tokenizer.nextToken();
- if(equals(lookahead, "{"))
+ if(equals(lookahead, XALAN_STATIC_UCODE_STRING("{")))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
- lookahead = "";
+ clear(lookahead);
break; // from switch
}
/*
@@ -2496,8 +2609,9 @@
*/
else
{
- DOMString expression = lookahead; // Probably should make into StringBuffer
- while((0 != length(lookahead)) && (!equals(lookahead, "}")))
+ XalanDOMString expression = lookahead; // Probably should make into StringBuffer
+
+ while(0 != length(lookahead) && !equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
{
lookahead = tokenizer.nextToken();
if(length(lookahead) == 1)
@@ -2509,7 +2623,7 @@
{
// String start
expression += lookahead;
- DOMString quote = lookahead;
+ XalanDOMString quote = lookahead;
// Consume stuff 'till next quote
lookahead = tokenizer.nextToken();
while(!equals(lookahead, quote))
@@ -2533,11 +2647,11 @@
const XObject* const xobj =
evalXPathStr(expression, contextNode, theProxy, executionContext);
- const DOMString exprResult(xobj->str());
+ const XalanDOMString exprResult(xobj->str());
append(buffer, exprResult);
- lookahead = ""; // breaks out of inner while loop
+ clear(lookahead); // breaks out of inner while loop
break;
}
default:
@@ -2552,7 +2666,7 @@
// part of the template stuff, just add it.
expression += lookahead;
}
- } // end while(!lookahead.equals("}"))
+ } // (0 != length(lookahead) && !equals(lookahead, "}"))
if(length(error) != 0)
{
@@ -2564,17 +2678,17 @@
case('}'):
{
lookahead = tokenizer.nextToken();
- if(equals(lookahead, "}"))
+ if(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
- lookahead = ""; // swallow
+ clear(lookahead); // swallow
}
else
{
// Illegal, I think...
warn("Found \"}\" but no attribute template open!");
- append(buffer, "}");
+ append(buffer, XALAN_STATIC_UCODE_STRING("}"));
// leave the lookahead to be processed by the next round.
}
break;
@@ -2594,8 +2708,8 @@
if(0 != length(error))
{
- // $$$ ToDo: Fix this when DOMString::operator+() is const.
- DOMString message("Attr Template, ");
+ // $$$ ToDo: Fix this when XalanDOMString::operator+() is const.
+ XalanDOMString message("Attr Template, ");
warn(message + error);
break;
@@ -2611,14 +2725,15 @@
void
XSLTEngineImpl::copyAttributeToTarget(
- const DOM_Attr& attr,
- const DOM_Node& /* contextNode */,
+ const XalanAttr& attr,
+ XalanNode* /* contextNode */,
const Stylesheet* /* stylesheetTree */,
AttributeListImpl& attrList,
- const DOM_Element& /* namespaceContext */)
+ const XalanElement& /* namespaceContext */)
{
- const DOMString attrName = trim(attr.getName());
- DOMString stringedValue = attr.getValue();
+ const XalanDOMString attrName = trim(attr.getName());
+
+ XalanDOMString stringedValue = attr.getValue();
// stringedValue = evaluateAttrVal(contextNode,
// namespaceContext,
// stringedValue);
@@ -2629,43 +2744,49 @@
// TODO: Find out about empty attribute template expression handling.
if(0 != length(stringedValue))
{
- if((equals(attrName, "xmlns") || startsWith(attrName, "xmlns:"))
- && startsWith(stringedValue, "quote:"))
+ if((equals(attrName, XALAN_STATIC_UCODE_STRING("xmlns")) || startsWith(attrName, XALAN_STATIC_UCODE_STRING("xmlns:")))
+ && startsWith(stringedValue, XALAN_STATIC_UCODE_STRING("quote:")))
{
stringedValue = substring(stringedValue, 6);
}
+
addResultAttribute(attrList, attrName, stringedValue);
}
}
+
+
void
XSLTEngineImpl::copyAttributesToAttList(
- const DOM_Node& contextNode,
+ XalanNode* contextNode,
const Stylesheet* stylesheetTree,
- const DOM_Element& templateChild,
+ const XalanElement& templateChild,
AttributeListImpl& attList)
{
assert(m_stylesheetRoot != 0);
assert(stylesheetTree != 0);
- DOM_NamedNodeMap attributes = templateChild.getAttributes();
- const int nAttributes = (0 != attributes) ? attributes.getLength() : 0;
- DOMString attrSetUseVal;
- for(int i = 0; i < nAttributes; i++)
+ const XalanNamedNodeMap* const attributes =
+ templateChild.getAttributes();
+
+ const unsigned int nAttributes = (0 != attributes) ? attributes->getLength() : 0;
+
+ XalanDOMString attrSetUseVal;
+
+ for(unsigned int i = 0; i < nAttributes; i++)
{
- const DOM_Node theNode = attributes.item(i);
- const DOM_Attr& attr = static_cast<const DOM_Attr&>(theNode);
- // $$$ ToDo: Fix this when DOMString::operator+() is const.
- DOMString theTemp(m_XSLNameSpaceURL);
- theTemp += ":use";
+ const XalanAttr* const attr =
+ static_cast<const XalanAttr*>(attributes->item(i));
+ assert(attr != 0);
+
+ const XalanDOMString theTemp(m_XSLNameSpaceURL + ":use");
- if(equalsIgnoreCase(m_parserLiaison.getExpandedAttributeName(attr), theTemp))
-// if(equalsIgnoreCase(m_parserLiaison.getExpandedAttributeName(attr), m_XSLNameSpaceURL + ":use"))
+ if(equalsIgnoreCase(m_parserLiaison.getExpandedAttributeName(*attr), theTemp))
{
- attrSetUseVal = attr.getValue();
+ attrSetUseVal = attr->getValue();
}
else
{
- copyAttributeToTarget(attr,
+ copyAttributeToTarget(*attr,
contextNode,
stylesheetTree,
attList,
@@ -2681,7 +2802,7 @@
{
if(m_translateCSS == true)
{
- DOMString styleAttrValueString;
+ XalanDOMString styleAttrValueString;
std::vector<const XMLCh*> toBeRemoved;
int nAttributes = attList.getLength();
for(int i = 0; i < nAttributes; i++)
@@ -2692,7 +2813,7 @@
toBeRemoved.push_back(attrName);
if(0 == length(styleAttrValueString))
{
- // $$$ ToDo: Fix this when DOMString::operator+() is const.
+ // $$$ ToDo: Fix this when XalanDOMString::operator+() is const.
styleAttrValueString = attrName;
styleAttrValueString += ":";
styleAttrValueString += attList.getValue(i);
@@ -2700,7 +2821,7 @@
}
else
{
- // $$$ ToDo: Fix this when DOMString::operator+() is const.
+ // $$$ ToDo: Fix this when XalanDOMString::operator+() is const.
styleAttrValueString += "; ";
styleAttrValueString += attrName;
styleAttrValueString += ":";
@@ -2724,7 +2845,7 @@
bool
-XSLTEngineImpl::isCSSAttribute(const DOMString& name) const
+XSLTEngineImpl::isCSSAttribute(const XalanDOMString& name) const
{
if(m_cssKeys.size() == 0)
{
@@ -2856,54 +2977,30 @@
}
-
-const NodeRefListBase*
-XSLTEngineImpl::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const
-{
- // Should this call the root or the current stylesheet?
- const NodeRefListBase* nl = 0;
-
- if (m_stylesheetRoot != 0)
- {
- nl = m_stylesheetRoot->getNodeSetByKey(doc, name, ref, resolver, executionContext);
- }
-
- if(0 == nl)
- {
- error(DOMString("There is no xsl:key declaration for '") + name + DOMString("'!"));
- }
-
- return nl;
-}
-
-
-DOM_Element
+XalanElement*
XSLTEngineImpl::getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const
+ const XalanDOMString& id,
+ const XalanDocument& doc) const
{
return m_xpathSupport.getElementByID(id, doc);
}
+
bool
-XSLTEngineImpl::shouldStripSourceNode(const DOM_Node& textNode) const
+XSLTEngineImpl::shouldStripSourceNode(const XalanNode& textNode) const
{
bool strip = false; // return value
int type = textNode.getNodeType();
- if((DOM_Node::TEXT_NODE == type) || (DOM_Node::CDATA_SECTION_NODE == type))
+ if((XalanNode::TEXT_NODE == type) || (XalanNode::CDATA_SECTION_NODE == type))
{
- const DOM_Text& theTextNode =
- static_cast<const DOM_Text&>(textNode);
+ const XalanText& theTextNode =
+ static_cast<const XalanText&>(textNode);
+
if(!m_xpathSupport.isIgnorableWhitespace(theTextNode))
{
- DOMString data = theTextNode.getData();
+ XalanDOMString data = theTextNode.getData();
if(0 == length(data))
{
return true;
@@ -2913,22 +3010,28 @@
return false;
}
}
- DOM_Node parent = m_xpathSupport.getParentOfNode(textNode);
+
+ XalanNode* parent = m_xpathSupport.getParentOfNode(textNode);
+
while(0 != parent)
{
- if(parent.getNodeType() == DOM_Node::ELEMENT_NODE)
+ if(parent->getNodeType() == XalanNode::ELEMENT_NODE)
{
- const DOM_Element& parentElem =
- static_cast<const DOM_Element&>(parent);
- const DOM_Attr attr = parentElem.getAttributeNode("xml:space");
+ const XalanElement* const parentElem =
+ static_cast<const XalanElement*>(parent);
+
+ const XalanAttr* const attr =
+ parentElem->getAttributeNode(XALAN_STATIC_UCODE_STRING("xml:space"));
+
if(0 != attr)
{
- const DOMString xmlSpaceVal = attr.getValue();
- if(equals(xmlSpaceVal, "preserve"))
+ const XalanDOMString xmlSpaceVal = attr->getValue();
+
+ if(equals(xmlSpaceVal, XALAN_STATIC_UCODE_STRING("preserve")))
{
strip = false;
}
- else if(equals(xmlSpaceVal, "default"))
+ else if(equals(xmlSpaceVal, XALAN_STATIC_UCODE_STRING("default")))
{
strip = true;
}
@@ -2945,8 +3048,20 @@
ElementPrefixResolverProxy theProxy(parentElem, m_xpathEnvSupport, m_xpathSupport);
{
- const int nTests = m_stylesheetRoot->m_whitespacePreservingElements.size();
+ // $$$ ToDo: All of this should be moved into a member of
+ // Stylesheet, so as not to expose these two data members...
+#if defined(XALAN_NO_NAMESPACES)
+ typedef Stylesheet::XPathVectorType XPathVectorType;
+#else
+ using Stylesheet::XPathVectorType;
+#endif
+
+ const XPathVectorType& theElements =
+ m_stylesheetRoot->getWhitespacePreservingElements();
+ const XPathVectorType::size_type nTests =
+ theElements.size();
+
XPathExecutionContextDefault theExecutionContext(m_xpathEnvSupport,
m_xpathSupport,
m_xobjectFactory,
@@ -2954,12 +3069,12 @@
NodeRefList(),
&theProxy);
- for(int i = 0; i < nTests; i++)
+ for(XPathVectorType::size_type i = 0; i < nTests; i++)
{
- const XPath* const matchPat = m_stylesheetRoot->m_whitespacePreservingElements[i];
+ const XPath* const matchPat = theElements[i];
assert(matchPat != 0);
- const double score = matchPat->getMatchScore(parent, theExecutionContext);
+ const double score = matchPat->getMatchScore(parent, theProxy, theExecutionContext);
if(score > highPreserveScore)
highPreserveScore = score;
@@ -2967,8 +3082,18 @@
}
{
- const int nTests = m_stylesheetRoot->m_whitespaceStrippingElements.size();
+#if defined(XALAN_NO_NAMESPACES)
+ typedef Stylesheet::XPathVectorType XPathVectorType;
+#else
+ using Stylesheet::XPathVectorType;
+#endif
+ const XPathVectorType& theElements =
+ m_stylesheetRoot->getWhitespaceStrippingElements();
+
+ const XPathVectorType::size_type nTests =
+ theElements.size();
+
XPathExecutionContextDefault theExecutionContext(m_xpathEnvSupport,
m_xpathSupport,
m_xobjectFactory,
@@ -2976,13 +3101,13 @@
NodeRefList(),
&theProxy);
- for(int i = 0; i < nTests; i++)
+ for(XPathVectorType::size_type i = 0; i < nTests; i++)
{
const XPath* const matchPat =
- m_stylesheetRoot->m_whitespaceStrippingElements[i];
+ theElements[i];
assert(matchPat != 0);
- const double score = matchPat->getMatchScore(parent, theExecutionContext);
+ const double score = matchPat->getMatchScore(parent, theProxy, theExecutionContext);
if(score > highStripScore)
highStripScore = score;
@@ -3007,20 +3132,22 @@
break;
}
}
- parent = parent.getParentNode();
+
+ parent = parent->getParentNode();
}
}
+
return strip;
}
-DOMString
+XalanDOMString
XSLTEngineImpl::fixWhiteSpace(
- const DOMString& string,
- bool trimHead,
- bool trimTail,
- bool doublePunctuationSpaces)
+ const XalanDOMString& string,
+ bool trimHead,
+ bool trimTail,
+ bool doublePunctuationSpaces)
{
const XMLCh* const theStringData = c_wstr(string);
std::vector<XMLCh> buf(theStringData,
@@ -3101,27 +3228,32 @@
// taking into account that we may have moved up the
// start because we're trimming the from of the string.
const int theLength = d - (start - buf.begin());
- return DOMString(start, theLength);
+ return XalanDOMString(start, theLength);
}
}
-DOMString
-XSLTEngineImpl::getNormalizedText(const DOM_Text& tx) const
+const XalanDOMString
+XSLTEngineImpl::getNormalizedText(const XalanText& tx) const
{
- DOMString theResult;
if(m_outputCarriageReturns == false && m_outputLinefeeds == false)
{
return tx.getData();
}
- const DOMString src = tx.getData();
- const int nSrcChars = src.length();
+
+ const XalanDOMString src = tx.getData();
+
+ const int nSrcChars = src.length();
+
std::vector<XMLCh> sb;
- XMLCh prevChar = 0x00;
+
+ XMLCh prevChar = 0x00;
+
for(int i = 0; i < nSrcChars; i++)
{
const XMLCh c = charAt(src, i);
+
if(0x0A == c)
{
if(0x0D != prevChar)
@@ -3145,9 +3277,10 @@
}
prevChar = c;
}
+
sb.push_back(0); // Null terminate
- theResult = DOMString(sb.begin());
- return theResult;
+
+ return XalanDOMString(sb.begin(), sb.size());
}
@@ -3160,18 +3293,18 @@
-const DOMString
+const XalanDOMString
XSLTEngineImpl::getUniqueNSValue() const
{
- return "ns" + LongToDOMString(m_uniqueNSValue++);
+ return XALAN_STATIC_UCODE_STRING("ns") + LongToDOMString(m_uniqueNSValue++);
}
-DOM_Document
+XalanDocument*
XSLTEngineImpl::getDOMFactory() const
{
- if(m_resultTreeFactory.isNull())
+ if(m_resultTreeFactory == 0)
{
m_resultTreeFactory = m_parserLiaison.createDocument();
}
@@ -3182,7 +3315,7 @@
#if 0
-XObject* XSLTEngineImpl::createXString(const DOMString& s)
+XObject* XSLTEngineImpl::createXString(const XalanDOMString& s)
{
return m_xobjectFactory->createString(s);
}
@@ -3217,7 +3350,7 @@
-XObject* XSLTEngineImpl::createXNodeSet(const DOM_Node& n)
+XObject* XSLTEngineImpl::createXNodeSet(const XalanNode& n)
{
return m_xobjectFactory->createNodeSet(n);
}
@@ -3255,7 +3388,7 @@
XSLTEngineImpl::pushVariable(
const QName& name,
XObject* val,
- const DOM_Node& e)
+ const XalanNode* e)
{
m_variableStacks.pushVariable(name, val, e);
}
@@ -3267,19 +3400,13 @@
*/
ResultTreeFragBase* XSLTEngineImpl::createDocFrag() const
{
- if(0 == m_resultTreeFactory)
- {
- m_resultTreeFactory = m_parserLiaison.createDocument();
- }
- assert(m_resultTreeFactory != 0);
-
- return new ResultTreeFrag(m_resultTreeFactory, m_xpathSupport);
+ return new ResultTreeFrag(*getDOMFactory(), m_xpathSupport);
}
XObject*
-XSLTEngineImpl::getXObjectVariable(const DOMString& name) const
+XSLTEngineImpl::getXObjectVariable(const XalanDOMString& name) const
{
assert(m_stylesheetRoot != 0);
assert(m_stylesheetExecutionContext != 0);
@@ -3297,7 +3424,7 @@
XLocator*
-XSLTEngineImpl::getXLocatorFromNode(const DOM_Node& node) const
+XSLTEngineImpl::getXLocatorFromNode(const XalanNode* node) const
{
return m_xpathEnvSupport.getXLocatorFromNode(node);
}
@@ -3306,7 +3433,7 @@
void
XSLTEngineImpl::associateXLocatorToNode(
- const DOM_Node& node,
+ const XalanNode* node,
XLocator* xlocator)
{
m_xpathEnvSupport.associateXLocatorToNode(node, xlocator);
@@ -3315,7 +3442,7 @@
XObject*
-XSLTEngineImpl::getTopLevelVariable(const DOMString& theName) const
+XSLTEngineImpl::getTopLevelVariable(const XalanDOMString& theName) const
{
TopLevelVariablesMapType::const_iterator i =
m_topLevelVariables.find(theName);
@@ -3336,102 +3463,110 @@
ResultTreeFragBase*
XSLTEngineImpl::createResultTreeFrag() const
{
- if(0 == m_resultTreeFactory)
- {
- m_resultTreeFactory = m_parserLiaison.createDocument();
- }
-
- ResultTreeFrag* pfrag = new
- ResultTreeFrag(m_resultTreeFactory, m_xpathSupport);
-
- return pfrag;
+ return new ResultTreeFrag(*getDOMFactory(), m_xpathSupport);
}
- /**
- * Given a document, get the default stylesheet URI from the
- * xsl:stylesheet PI.
- */
-DOMString
-XSLTEngineImpl::getStyleSheetURIfromDoc(const DOM_Node& sourceTree)
-// was: getStyleSheetURIfromDoc(DOM_Document sourceTree)
+const XalanDOMString
+XSLTEngineImpl::getStyleSheetURIFromDoc(const XalanNode& sourceTree)
{
- DOMString stylesheetURI;
- // $$$ ToDo: Make this const when getLength() is const.
- DOM_NodeList children = sourceTree.getChildNodes();
- const int nNodes = children.getLength();
- for(int i = 0; i < nNodes; i++)
+ XalanDOMString stylesheetURI;
+
+ const XalanNode* child = sourceTree.getFirstChild();
+
+ // $$$ ToDo: is this first one style valid?
+ const XalanDOMString stylesheetNodeName1("xml-stylesheet");
+ const XalanDOMString stylesheetNodeName2("xml:stylesheet");
+
+ // $$$ ToDo: This code is much like that in process().
+ // Why is it repeated???
+ // $$$ ToDo: Move these embedded strings from inside these loops
+ // out here...
+ // $$$ ToDo: These loops are a mess of repeated use of the
+ // same data values.
+ while(child != 0)
{
- const DOM_Node child = children.item(i);
- if(DOM_Node::PROCESSING_INSTRUCTION_NODE == child.getNodeType())
+ if(XalanNode::PROCESSING_INSTRUCTION_NODE == child->getNodeType())
{
- /*DOM_ProcessingInstruction*/ const DOM_Node& pi = child;
- if(equals(pi.getNodeName(), "xml-stylesheet") ||
- equals(pi.getNodeName(), "xml:stylesheet"))
+ const XalanDOMString nodeName(child->getNodeName());
+
+ if(equals(nodeName, stylesheetNodeName1) ||
+ equals(nodeName, stylesheetNodeName2))
{
bool isOK = true;
- StringTokenizer tokenizer(pi.getNodeValue(), " \t=");
+
+ const XalanDOMString nodeValue(child->getNodeValue());
+
+ StringTokenizer tokenizer(nodeValue, XALAN_STATIC_UCODE_STRING(" \t="));
+
while(tokenizer.hasMoreTokens() == true)
{
- if(equals(tokenizer.nextToken(), "type") == true)
+ const XalanDOMString nextToken(tokenizer.nextToken());
+
+ if(equals(nextToken, XALAN_STATIC_UCODE_STRING("type")) == true)
{
- DOMString typeVal = tokenizer.nextToken();
- typeVal = substring(typeVal, 1, typeVal.length() - 1);
- if(equals(typeVal, "text/xsl") == false)
+ const XalanDOMString typeVal =
+ substring(nextToken, 1, length(nextToken) - 1);
+
+ if(equals(typeVal, XALAN_STATIC_UCODE_STRING("text/xsl")) == false)
{
isOK = false;
}
}
}
+
if(isOK == true)
{
- StringTokenizer tokenizer(pi.getNodeValue(), " \t=");
+ StringTokenizer tokenizer(nodeValue, XALAN_STATIC_UCODE_STRING(" \t="));
+
while(tokenizer.hasMoreTokens() == true)
{
- if(tokenizer.nextToken().equals("href"))
+ const XalanDOMString nextToken(tokenizer.nextToken());
+
+ if(equals(nextToken, XALAN_STATIC_UCODE_STRING("href")))
{
- stylesheetURI = tokenizer.nextToken();
stylesheetURI =
- substring(stylesheetURI, 1, stylesheetURI.length() - 1);
+ substring(nextToken, 1, nextToken.length() - 1);
}
- }
+ }
break;
}
}
}
+
+ child = child->getNextSibling();
}
+
return stylesheetURI;
}
-//bool
void
XSLTEngineImpl::setStylesheetParam(
- const DOMString& theName,
- const DOMString& expression)
+ const XalanDOMString& theName,
+ const XalanDOMString& expression)
{
- // java: QName qname = new QName(key, null, m_parserLiaison);
- QName qname(theName, DOM_Element(), m_xpathEnvSupport, m_xpathSupport);
- Arg arg(qname, expression, true);
- m_topLevelParams.push_back(arg);
+ const QName qname(theName, 0, m_xpathEnvSupport, m_xpathSupport);
+
+ m_topLevelParams.push_back(Arg(qname, expression, true));
}
+
void
XSLTEngineImpl::setStylesheetParam(
- const DOMString& theName,
- XObject* theValue)
+ const XalanDOMString& theName,
+ XObject* theValue)
{
- // java: QName qname = new QName(key, null, m_parserLiaison);
- const QName qname(theName, DOM_Element(), m_xpathEnvSupport, m_xpathSupport);
- const Arg arg(qname, theValue);
+ const QName qname(theName, 0, m_xpathEnvSupport, m_xpathSupport);
- m_topLevelParams.push_back(arg);
+ m_topLevelParams.push_back(Arg(qname, theValue, true));
}
+
void
XSLTEngineImpl::resolveTopLevelParams(StylesheetExecutionContext& executionContext)
{
@@ -3442,8 +3577,8 @@
void
XSLTEngineImpl::resetCurrentState(
- const DOM_Node& /* sourceTree */,
- const DOM_Node& xmlNode)
+ XalanNode* /* sourceTree */,
+ XalanNode* xmlNode)
{
if(0 != xmlNode)
{
@@ -3458,8 +3593,8 @@
void
XSLTEngineImpl::registerExtensionHandlerByName(
- const DOMString& /* classid */,
- const DOMString& /* codetype */)
+ const XalanDOMString& /* classid */,
+ const XalanDOMString& /* codetype */)
{
#if 1
error("XSL4C does not support extensions at this time!");
@@ -3504,7 +3639,7 @@
void
XSLTEngineImpl::registerExtensionHandler(
- const DOMString& /* mimeType */,
+ const XalanDOMString& /* mimeType */,
DispatcherFactory* /* factory */)
{
#if 1
@@ -3512,7 +3647,7 @@
#else
if(0 != m_diagnosticsPrintWriter)
{
- diag(DOMString("Registering dispatcher factory for: ") + mimeType);
+ diag(XalanDOMString("Registering dispatcher factory for: ") + mimeType);
}
m_dispatcherFactories.put(mimeType, factory);
@@ -3523,61 +3658,67 @@
-DOM_Element
+// $$$ ToDo: This really belongs in DOMServices or DOMSupport()
+XalanElement*
XSLTEngineImpl::findElementByAttribute(
- const DOM_Element& elem,
- const DOMString& targetElementName,
- const DOMString& targetAttributeName,
- const DOMString& targetAttributeValue)
-{
- DOM_Element theFoundElement;
- const DOMString tagName = elem.getTagName();
- if((0 == length(targetElementName)) || tagName.equals(targetElementName))
+ XalanElement& elem,
+ const XalanDOMString& targetElementName,
+ const XalanDOMString& targetAttributeName,
+ const XalanDOMString& targetAttributeValue)
+{
+ XalanElement* theFoundElement = 0;
+
+ const XalanDOMString tagName = elem.getTagName();
+
+ if(0 == length(targetElementName) || equals(tagName, targetElementName))
{
- // $$$ Todo: Make this const when getLength is const.
- DOM_NamedNodeMap attributes = elem.getAttributes();
+ const XalanNamedNodeMap* const attributes = elem.getAttributes();
try
{
- const int nAttributes = (0 != attributes) ? attributes.getLength() : 0;
- for(int i = 0; i < nAttributes; i++)
+ const unsigned int nAttributes = 0 != attributes ? attributes->getLength() : 0;
+
+ for(unsigned int i = 0; i < nAttributes; i++)
{
- DOM_Node theNode = attributes.item(i);
- const DOM_Attr& attr =
- static_cast<DOM_Attr&>(theNode);
- const DOMString attrName = attr.getName();
- if(attrName.equals(targetAttributeName))
+ const XalanAttr* attr =
+ static_cast<const XalanAttr*>(attributes->item(i));
+
+ const XalanDOMString attrName = attr->getName();
+
+ if(equals(attrName, targetAttributeName))
{
- DOMString attrVal = attr.getValue();
- if(attrVal.equals(targetAttributeValue))
+ const XalanDOMString attrVal = attr->getValue();
+
+ if(equals(attrVal, targetAttributeValue))
{
- theFoundElement = elem;
+ theFoundElement = &elem;
break;
}
}
}
}
- catch(const DOM_DOMException&)
+ catch(const XalanDOMException&)
{
}
}
+
if(0 == theFoundElement)
{
- // $$$ Todo: Make this const when getLength is const.
- DOM_NodeList children = elem.getChildNodes();
- const int nNodes = children.getLength();
- for(int i = 0; i < nNodes; i++)
- {
- const DOM_Node childNode = children.item(i);
- if (childNode.getNodeType() == DOM_Node::ELEMENT_NODE)
- {
- const DOM_Element& child =
- static_cast<const DOM_Element&>(childNode);
- const DOMString childName = child.getTagName();
+ XalanNode* childNode = elem.getFirstChild();
+
+ while(childNode != 0)
+ {
+ if (childNode->getNodeType() == XalanNode::ELEMENT_NODE)
+ {
+ XalanElement* child =
+ static_cast<XalanElement*>(childNode);
+
+ const XalanDOMString childName = child->getTagName();
+
if(0 != length(childName))
{
theFoundElement = findElementByAttribute(
- child,
+ *child,
targetElementName,
targetAttributeName,
targetAttributeValue);
@@ -3588,15 +3729,18 @@
}
}
}
+
+ childNode = childNode->getNextSibling();
}
}
+
return theFoundElement;
}
XMLURL*
-XSLTEngineImpl::getURLFromString (const DOMString& urlString) const
+XSLTEngineImpl::getURLFromString (const XalanDOMString& urlString) const
{
std::auto_ptr<XMLURL> url(new XMLURL);
@@ -3607,7 +3751,7 @@
// 'urlString' not a valid url, try to construct a file url
catch (const MalformedURLException&)
{
- DOMString fullpath("file:///");
+ XalanDOMString fullpath("file:///");
try
{
@@ -3628,7 +3772,7 @@
-XMLURL* XSLTEngineImpl::getURLFromString(const DOMString& urlString, const DOMString& base) const
+XMLURL* XSLTEngineImpl::getURLFromString(const XalanDOMString& urlString, const XalanDOMString& base) const
{
if (isEmpty(base))
return getURLFromString(urlString);
@@ -3637,17 +3781,19 @@
// base is a complete file URL and urlString is a forward relative path, i.e.
// in the same directory as the urlString or a subdirectory
- DOMString context;
+ XalanDOMString context;
// just to be robust, we'll accept a forward or back slash
- int i1 = lastIndexOf(base,'/');
- int i2 = lastIndexOf(base,'\\');
+ const unsigned int theLength = length(base);
- int i = i1>i2 ? i1: i2;
+ const unsigned int i1 = lastIndexOf(base,'/');
+ const unsigned int i2 = lastIndexOf(base,'\\');
- if (i != -1)
- context = substring(base,0,i+1);
+ const unsigned int i = i1 > i2 && i1 < theLength ? i1: i2;
+ if (i < theLength)
+ context = substring(base, 0, i + 1);
+
context += urlString;
return getURLFromString(context);
@@ -3658,7 +3804,9 @@
XSLTEngineImpl::setFormatter(Formatter* formatter)
{
flushPending();
+
m_formatter = formatter;
+
if(0 != formatter)
{
m_flistener = formatter->getFormatterListener();
@@ -3703,9 +3851,9 @@
//////////////////////////////////////////////////////////////////////////////
XSLTEngineImpl::StackGuard::StackGuard(
- XSLTEngineImpl& processor,
- const DOM_Element& xslTemplate,
- const DOM_Node& sourceXML) :
+ XSLTEngineImpl& processor,
+ const XalanElement* xslTemplate,
+ const XalanNode* sourceXML) :
m_processor(&processor),
m_xslRule(xslTemplate),
m_sourceXML(sourceXML),
@@ -3726,21 +3874,18 @@
XSLTEngineImpl::StackGuard::print(PrintWriter& pw) const
{
// for the moment, these diagnostics are really bad...
- const int theType = m_sourceXML.getNodeType();
+ const int theType = m_sourceXML->getNodeType();
- if(theType == DOM_Node::TEXT_NODE)
+ if(theType == XalanNode::TEXT_NODE)
{
- const DOM_Text& tx =
- static_cast<const DOM_Text&>(m_sourceXML);
+ const XalanText* const tx =
+ static_cast<const XalanText*>(m_sourceXML);
- pw.println(tx.getData());
+ pw.println(tx->getData());
}
- else if(theType == DOM_Node::ELEMENT_NODE)
+ else if(theType == XalanNode::ELEMENT_NODE)
{
- const DOM_Element& elem =
- static_cast<const DOM_Element&>(m_sourceXML);
-
- pw.println(elem.getNodeName());
+ pw.println(m_sourceXML->getNodeName());
}
}
@@ -3764,26 +3909,26 @@
{
DOMStringPrintWriter pw;
- pw.println(DOMString("Infinite loop diagnosed! Stack trace:"));
+ pw.println(XalanDOMString("Infinite loop diagnosed! Stack trace:"));
int k = 0;
for(; k < nRules; k++)
{
- pw.println(DOMString("Source Elem #") +
+ pw.println(XalanDOMString("Source Elem #") +
LongToDOMString(k) +
- DOMString(" "));
+ XalanDOMString(" "));
m_stack[i].print(pw);
}
- pw.println(DOMString("Source Elem #") +
+ pw.println(XalanDOMString("Source Elem #") +
LongToDOMString(k) +
- DOMString(" "));
+ XalanDOMString(" "));
guard.print(pw);
- pw.println(DOMString("End of infinite loop diagnosis."));
+ pw.println(XalanDOMString("End of infinite loop diagnosis."));
m_processor->diag(pw.getString());
@@ -3796,20 +3941,27 @@
void
XSLTEngineImpl::StackGuard::push(
- const DOM_Element& xslTemplate,
- const DOM_Node& sourceXML)
+ const XalanElement* xslTemplate,
+ const XalanNode* sourceXML)
{
const StackGuard guard(*m_processor, xslTemplate, sourceXML);
+
checkForInfiniteLoop(guard);
+
m_stack.push_back(guard);
}
+
+
void
XSLTEngineImpl::StackGuard::pop()
{
m_stack.pop_back();
}
+
+
+
//////////////////////////////////////////////////////////////////////////////
// CLASS XSLTEngineImpl::VariableStack
//////////////////////////////////////////////////////////////////////////////
@@ -3820,7 +3972,7 @@
m_stack(),
m_processor(theProcessor)
{
- pushContextMarker(DOM_Node(), DOM_Node());
+ pushContextMarker(0, 0);
}
@@ -3837,16 +3989,18 @@
{
// Delete all entries left on the stack
std::for_each(m_stack.begin(),
- m_stack.end(),
- DeleteFunctor<StackEntry>());
+ m_stack.end(),
+ DeleteFunctor<StackEntry>());
+
m_stack.clear();
- pushContextMarker(DOM_Node(), DOM_Node());
+
+ pushContextMarker(0, 0);
}
void
-XSLTEngineImpl::VariableStack::pushElementMarker(const DOM_Node& elem)
+XSLTEngineImpl::VariableStack::pushElementMarker(const XalanNode* elem)
{
m_stack.push_back(new ElementMarker(elem));
}
@@ -3854,17 +4008,20 @@
void
-XSLTEngineImpl::VariableStack::popElementMarker(const DOM_Node& elem)
+XSLTEngineImpl::VariableStack::popElementMarker(const XalanNode* elem)
{
if(elementMarkerAlreadyPushed(elem) == true)
{
- int nElems = m_stack.size();
+ const int nElems = m_stack.size();
+
bool fFound = false;
+
// Sub 1 extra for the context marker.
for(int i = (nElems - 1); i >= 0 && fFound == false; i--)
{
const StackEntry* const theEntry = m_stack[i];
assert(theEntry != 0);
+
if(theEntry->getType() == StackEntry::eElementMarker)
{
m_stack.pop_back();
@@ -3874,6 +4031,7 @@
{
m_stack.pop_back();
}
+
delete theEntry;
}
}
@@ -3882,7 +4040,7 @@
bool
-XSLTEngineImpl::VariableStack::elementMarkerAlreadyPushed(const DOM_Node& elem) const
+XSLTEngineImpl::VariableStack::elementMarkerAlreadyPushed(const XalanNode* elem) const
{
const int nElems = m_stack.size();
// Sub 1 extra for the context marker.
@@ -3890,17 +4048,19 @@
{
const StackEntry* const theEntry = m_stack[i];
assert(theEntry != 0);
+
if(theEntry->getType() == StackEntry::eElementMarker)
{
const ElementMarker* const theElementMarkerEntry =
static_cast<const ElementMarker*>(theEntry);
- if(&theElementMarkerEntry->getElement() == &elem)
+ if(theElementMarkerEntry->getElement() == elem)
{
return true;
}
}
}
+
return false;
}
@@ -3908,8 +4068,8 @@
void
XSLTEngineImpl::VariableStack::pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode)
+ const XalanNode* caller,
+ const XalanNode* sourceNode)
{
m_stack.push_back(new ContextMarker(caller, sourceNode));
}
@@ -3935,39 +4095,54 @@
}
+
void
XSLTEngineImpl::VariableStack::pushParams(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate)
+ const XalanNode* targetTemplate)
{
StackEntry* const theStackEntry = m_stack.back();
+
if (theStackEntry->getType() != StackEntry::eContextMarker)
{
// @@ $$$ ToDo: Fix this!!!
// throw InvalidStackContext();
return;
}
+
VariableStackStackType tempStack;
+
ContextMarker* const cm =
- dynamic_cast<ContextMarker*>(theStackEntry);
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (ContextMarker*)theStackEntry;
+#else
+ static_cast<ContextMarker*>(theStackEntry);
+#endif
+
try
{
try
{
m_stack.pop_back();
- NodeImpl* child =
- (const_cast<ElemTemplateElement&>(xslCallTemplateElement)).getFirstChild();
+
+ const ElemTemplateElement* child =
+ xslCallTemplateElement.getFirstChildElem();
+
while(0 != child)
{
- if(Constants::ELEMNAME_WITHPARAM ==
- (dynamic_cast<ElemTemplateElement*>(child))->getXSLToken())
+ if(Constants::ELEMNAME_WITHPARAM == child->getXSLToken())
{
- ElemWithParam* xslParamElement =
- dynamic_cast<ElemWithParam*>(child);
+ const ElemWithParam* const xslParamElement =
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (ElemWithParam*)child;
+#else
+ static_cast<const ElemWithParam*>(child);
+#endif
+
Arg* theArg = 0;
const XPath* const pxpath = xslParamElement->getSelectPattern();
@@ -3979,7 +4154,7 @@
*xslParamElement,
executionContext.getXPathExecutionContext());
- theArg = new Arg(xslParamElement->getQName(), theXObject);
+ theArg = new Arg(xslParamElement->getQName(), theXObject, true);
}
else
{
@@ -3990,24 +4165,28 @@
sourceNode,
mode);
assert(theDocFragment != 0);
- // Cast to result tree fragment
- ResultTreeFrag* const theResultTreeFrag =
- static_cast<ResultTreeFrag* const>(theDocFragment);
- XObject* var = m_processor.createXResultTreeFrag(*theResultTreeFrag);
- theArg = new Arg(xslParamElement->getQName(), var);
+
+ XObject* var = m_processor.createXResultTreeFrag(*theDocFragment);
+
+ theArg = new Arg(xslParamElement->getQName(), var, true);
}
assert(theArg != 0);
+
tempStack.push_back(theArg);
}
- child = child->getNextSibling();
- } // while
+
+ child = child->getNextSiblingElem();
+ }
}
catch(...)
{
m_stack.push_back(cm);
+
throw;
}
+
m_stack.push_back(cm);
+
try
{
pushElementMarker(targetTemplate);
@@ -4036,11 +4215,16 @@
throw;
}
}
+
-bool XSLTEngineImpl::VariableStack::hasParamVariable(QName& qname)
+
+bool
+XSLTEngineImpl::VariableStack::hasParamVariable(const QName& qname) const
{
bool hasit = false;
+
const int nElems = m_stack.size();
+
// Sub 1 extra for the context marker.
for(int i = (nElems - 1); i >= 0; i--)
{
@@ -4048,8 +4232,9 @@
assert(theEntry != 0);
if(theEntry->getType() == StackEntry::eArgument)
{
- const Arg* const theArg = dynamic_cast<const Arg*>(theEntry);
- if((theArg->getName()).equals(qname))
+ const Arg* const theArg = static_cast<const Arg*>(theEntry);
+
+ if(theArg->getName().equals(qname))
{
hasit = true;
break;
@@ -4060,6 +4245,7 @@
break;
}
}
+
return hasit;
}
@@ -4068,14 +4254,14 @@
XSLTEngineImpl::VariableStack::pushVariable(
const QName& name,
XObject* val,
- const DOM_Node& e)
+ const XalanNode* e)
{
if(elementMarkerAlreadyPushed(e) == false)
{
pushElementMarker(e);
}
- m_stack.push_back(new Arg(name, val));
+ m_stack.push_back(new Arg(name, val, false));
}
@@ -4126,7 +4312,7 @@
const Arg* const theArg =
dynamic_cast<const Arg*>(theEntry);
- if((theArg->getName()).equals(qname))
+ if(theArg->getName().equals(qname))
{
theResult = theArg;
break;
@@ -4148,8 +4334,9 @@
if(theEntry->getType() == StackEntry::eArgument)
{
const Arg* const theArg =
- dynamic_cast<const Arg*>(theEntry);
- if((theArg->getName()).equals(qname))
+ static_cast<const Arg*>(theEntry);
+
+ if(theArg->getName().equals(qname))
{
theResult = theArg;
break;
@@ -4314,6 +4501,9 @@
s_elementKeys[Constants::ELEMNAME_LOCALE_STRING] = Constants::ELEMNAME_LOCALE;
s_elementKeys[Constants::ELEMNAME_FALLBACK_STRING] = Constants::ELEMNAME_FALLBACK;
s_elementKeys[Constants::ELEMNAME_OUTPUT_STRING] = Constants::ELEMNAME_OUTPUT;
+
+ s_elementKeys[Constants::ELEMNAME_DECIMALFORMAT_STRING] = Constants::ELEMNAME_DECIMALFORMAT;
+ s_elementKeys[Constants::ELEMNAME_NSALIAS_STRING] = Constants::ELEMNAME_NSALIAS;
}
1.21 +487 -605 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XSLTEngineImpl.hpp 2000/03/21 03:22:50 1.20
+++ XSLTEngineImpl.hpp 2000/04/11 15:09:30 1.21
@@ -10,33 +10,33 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
@@ -57,65 +57,6 @@
#if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
#define XALAN_XSLTENGINEIMPL_HEADER_GUARD
-/**
- *
- * $Id: XSLTEngineImpl.hpp,v 1.20 2000/03/21 03:22:50 dbertoni Exp $
- *
- * $State: Exp $
- *
- * @author Scott Boag (scott_boag@lotus.com)
- *
- * It is the responsibility of the XSLTEngineImpl class to traverse the
- * source DOM tree according to the instructions in the style DOM tree,
- * and output nodes into the result DOM tree.
- *
- * Basic flow of control:
- * Starting from process(Document sourceTree, Document out, String mode),
- * 1) init the Stylesheet instances (which hold the state for each imported
- * XSL stylesheet) in the parseXSLRoot method, then
- * 2) locate the rootRule (all rules are found via Stylesheet.findTemplate),
- * then pass the root node of the source tree to
- * 3) buildResultFromTemplate, which processes each of the template's
- * child elements by calling
- * 4) processTemplateElement, which either processes the element
- * by handling it as an XSL directive (if it is in the xsl: namespace),
- * or by cloning the source node to the result tree.
- * If it is an XSL instruction,
- * 5) processXSLTemplateInstruction is called, which calls various
- * subfunctions according to the tag name.
- * The XSL directives that effect the source traversal are xsl:apply-templates
- * and xsl:for-each, which are handled in the
- * 6) handleApplyTemplatesInstruction, which selects the start node and
- * calls the
- * 7) transformSelectedChildren method, which performs a query or just
- * traverses the child list, then for each node in the selected list calls
- * 8) transformChild, which then calls
- * 9) Stylesheet.findTemplate (if it is not an xsl:for-each instruction)
- * to locate the corresponding template, and then calls
- * 10) buildResultFromTemplate, recursing back in to step 3 and starting the
- * traversal cycle all over again.
- *
- * Glossary (abbreviations used in variable and method names in square
- * brackets):
- *
- * XSL Instruction [instruction]
- * Any tag with an XSL namespace prefix.
- * XSL Template Instruction [instruction]
- * Any tag with an XSL namespace prefix
- * that occurs inside an xsl:template element.
- * Template Child [templateChild]
- * Any node that is a child of an xsl:template element.
- * Source Tree
- * The tree input to the XSL process.
- * Result Tree
- * The tree that is output by the XSL process.
- * Stylesheet Tree
- * The stylesheet tree produced from the XSL file.
- * Pattern List [patternList]
- * A parsed query or match pattern.
- *
- *
- */
// Base include file. Must be first.
@@ -131,36 +72,32 @@
// Standard library headers
#include <cassert>
#include <ctime>
-#if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
-#include <hash_map>
-#endif
#include <map>
#include <set>
-#if defined(__GNUC__)
-#include <stdexcept>
-#endif
-
-
-// Xerces DOM header file
-#include <dom/DOM_Document.hpp>
-#include <dom/DOMString.hpp>
#include <sax/DocumentHandler.hpp>
// XSL header files.
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
#include <PlatformSupport/AttributeListImpl.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
+
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/NameSpace.hpp>
+
#include "Arg.hpp"
#include "KeyDeclaration.hpp"
#include "ProblemListener.hpp"
+#include "XSLTProcessorException.hpp"
@@ -177,6 +114,8 @@
class StylesheetConstructionContext;
class StylesheetExecutionContext;
class StylesheetRoot;
+class XalanAttr;
+class XalanText;
class XLocator;
class XMLParserLiaison;
class XMLURL;
@@ -193,68 +132,47 @@
* It's the responsibility of the XSLTEngineImpl class, collaborating with the
* XML parser liaison, the DOM, and the XPath engine, to transform a source
* tree of nodes into a result tree according to instructions and templates
- * specified by a stylesheet tree. The process method is the primary
+ * specified by a stylesheet tree. The process method is the primary
* public entry points.
*
*
* If you reuse the processor instance, you should call reset() between calls.
- *
- *
- * @author Scott Boag
- * @author David N. Bertoni (david_n_bertoni@lotus.com)
+ *
*/
-class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor,
- private DocumentHandler
+class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, private DocumentHandler
{
-
public:
-class StackGuard;
-
#if defined(XALAN_NO_NAMESPACES)
# define XALAN_STD
#else
# define XALAN_STD std::
#endif
-
-typedef XALAN_STD auto_ptr<XPathProcessor> XPathProcessorPtrType;
-typedef XALAN_STD map<DOMString, XObject*> TopLevelVariablesMapType;
-typedef XALAN_STD map<DOMString, int> AttributeKeysMapType;
-typedef XALAN_STD map<DOMString, int> ElementKeysMapType;
-typedef XALAN_STD map<const void*, clock_t> DurationsTableMapType;
-typedef XALAN_STD set<DOMString> TranslateCSSSetType;
-typedef XALAN_STD vector<Arg> ParamVectorType;
-typedef XALAN_STD vector<ElemAttributeSet*> AttrStackType;
-typedef XALAN_STD vector<KeyDeclaration> KeyDeclarationVectorType;
-typedef XALAN_STD vector<const Locator*> LocatorStack;
-typedef XALAN_STD vector<NameSpace> NamespaceVectorType;
-typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
-typedef XALAN_STD vector<StackEntry*> VariableStackStackType;
-typedef XALAN_STD vector<StackGuard> StackGuardStackType;
-typedef XALAN_STD vector<TraceListener*> TraceListenerVectorType;
-typedef XALAN_STD vector<XObject*> XObjectPtrVectorType;
-typedef XALAN_STD vector<bool> BoolVectorType;
-typedef XALAN_STD runtime_error RuntimeError;
-
-#if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
- typedef hash_map<DOM_Node, int, DOM_NodeHashFunction> XSLDirectiveMapType;
- typedef hash_map<DOMString,
- DOM_Node,
- DOMStringHashFunction,
- DOMStringEqualsFunction> NamedTemplatesMapType;
- typedef hash_map<DOMString,
- Stylesheet*,
- DOMStringHashFunction,
- DOMStringEqualsFunction> StylesheetMapType;
-#else
- typedef XALAN_STD map<DOM_Node, int> XSLDirectiveMapType;
- typedef XALAN_STD map<DOMString,
- DOM_Node> NamedTemplatesMapType;
- typedef XALAN_STD map<DOMString,
- Stylesheet*> StylesheetMapType;
-#endif
+ typedef XALAN_STD auto_ptr<XPathProcessor> XPathProcessorPtrType;
+ typedef XALAN_STD map<XalanDOMString, XObject*> TopLevelVariablesMapType;
+ typedef XALAN_STD map<XalanDOMString, int> AttributeKeysMapType;
+ typedef XALAN_STD map<XalanDOMString, int> ElementKeysMapType;
+ typedef XALAN_STD map<const void*, clock_t> DurationsTableMapType;
+ typedef XALAN_STD set<XalanDOMString> TranslateCSSSetType;
+ typedef XALAN_STD vector<Arg> ParamVectorType;
+ typedef XALAN_STD vector<ElemAttributeSet*> AttrStackType;
+ typedef XALAN_STD vector<KeyDeclaration> KeyDeclarationVectorType;
+ typedef XALAN_STD vector<const Locator*> LocatorStack;
+ typedef XALAN_STD vector<NameSpace> NamespaceVectorType;
+ typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
+ typedef XALAN_STD vector<StackEntry*> VariableStackStackType;
+ typedef XALAN_STD vector<TraceListener*> TraceListenerVectorType;
+ typedef XALAN_STD vector<XObject*> XObjectPtrVectorType;
+ typedef XALAN_STD vector<bool> BoolVectorType;
+
+
+ typedef XALAN_STD map<const XalanNode*, int> XSLDirectiveMapType;
+ typedef XALAN_STD map<XalanDOMString,
+ const XalanNode*> NamedTemplatesMapType;
+ typedef XALAN_STD map<XalanDOMString,
+ Stylesheet*> StylesheetMapType;
#undef XALAN_STD
// Public members
@@ -263,7 +181,7 @@
/**
* The root document.
*/
- DOM_Document m_rootDoc;
+ XalanDocument* m_rootDoc;
/**
* If true, output carriage returns.
@@ -287,7 +205,7 @@
/**
* The factory that will be used to create result tree fragments.
*/
- mutable DOM_Document m_resultTreeFactory;
+ mutable XalanDocument* m_resultTreeFactory;
/**
* The namespace that the result tree conforms to. A null value
@@ -295,12 +213,12 @@
* A empty string indicates that the result tree conforms to the
* default namespace.
*/
- DOMString m_resultNameSpacePrefix;
+ XalanDOMString m_resultNameSpacePrefix;
/**
* The URL that belongs to the result namespace.
*/
- DOMString m_resultNameSpaceURL;
+ XalanDOMString m_resultNameSpaceURL;
/**
@@ -309,17 +227,17 @@
* of the XSLTEngineImpl class each time you run a transformation.
*
* @param XMLParserLiaison liaison to an object that can help with a
- * specific parser implementation
- * @param xpathSupport $$$
+ * specific parser implementation
+ * @param xpathSupport $$$
* @param xpathEnvSupport $$$
* @param xobjectFactory object responsible for XObject objects
- * @param xpathFactory object responsible for XPath objects
+ * @param xpathFactory object responsible for XPath objects
*/
XSLTEngineImpl(
XMLParserLiaison& parserLiaison,
XPathSupport& xpathSupport,
XPathEnvSupport& xpathEnvSupport,
- XObjectFactory& xobjectFactory,
+ XObjectFactory& xobjectFactory,
XPathFactory& xpathFactory);
virtual ~XSLTEngineImpl();
@@ -335,10 +253,10 @@
virtual void
process(
XSLTInputSource* inputSource,
- XSLTInputSource* stylesheetSource,
- XSLTResultTarget& outputTarget,
+ XSLTInputSource* stylesheetSource,
+ XSLTResultTarget& outputTarget,
StylesheetConstructionContext& constructionContext,
- StylesheetExecutionContext& executionContext);
+ StylesheetExecutionContext& executionContext);
virtual StylesheetRoot*
processStylesheet(
@@ -347,42 +265,42 @@
virtual StylesheetRoot*
processStylesheet(
- const DOMString& xsldocURLString,
+ const XalanDOMString& xsldocURLString,
StylesheetConstructionContext& constructionContext);
- virtual const DOM_Node getSourceTreeFromInput(XSLTInputSource *inputSource);
+ virtual XalanNode*
+ getSourceTreeFromInput(XSLTInputSource *inputSource);
virtual void
- outputToResultTree(
- const XObject& xobj);
+ outputToResultTree(const XObject& xobj);
virtual XObject*
- getTopLevelVariable(const DOMString& theName) const;
+ getTopLevelVariable(const XalanDOMString& theName) const;
virtual void
resetCurrentState(
- const DOM_Node& sourceTree,
- const DOM_Node& xmlNode);
+ XalanNode* sourceTree,
+ XalanNode* xmlNode);
- virtual DOM_Document
+ virtual XalanDocument*
getRootDoc() const;
virtual void
- setRootDoc(const DOM_Document& doc);
+ setRootDoc(XalanDocument* doc);
- virtual DOMString
+ virtual XalanDOMString
evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue,
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue,
XPathExecutionContext& executionContext);
virtual ResultTreeFragBase*
createResultTreeFrag(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode);
virtual ResultTreeFragBase*
@@ -394,11 +312,11 @@
virtual XMLParserLiaison&
getXMLParserLiaison() const;
- virtual const DOMString
+ virtual const XalanDOMString
getUniqueNSValue() const;
virtual XObject*
- createXResultTreeFrag(const ResultTreeFragBase& r) const;
+ createXResultTreeFrag(const ResultTreeFragBase& r) const;
virtual XObject*
getVariable(const QName& qname) const;
@@ -410,24 +328,16 @@
pushVariable(
const QName& name,
XObject* var,
- const DOM_Node& element);
+ const XalanNode* element);
virtual void setStylesheetParam(
- const DOMString& key,
- const DOMString& expression);
+ const XalanDOMString& key,
+ const XalanDOMString& expression);
virtual void
setStylesheetParam(
- const DOMString& key,
- XObject* value);
-
- virtual const NodeRefListBase*
- getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const;
+ const XalanDOMString& key,
+ XObject* value);
/**
* Tells, through the combination of the default-space attribute on
@@ -440,13 +350,13 @@
* @return true if the text node should be stripped of extra whitespace
*/
virtual bool
- shouldStripSourceNode(const DOM_Node& textNode) const;
+ shouldStripSourceNode(const XalanNode& textNode) const;
virtual FormatterListener*
getFormatterListener() const;
virtual void
- setFormatterListener(FormatterListener* flistener);
+ setFormatterListener(FormatterListener* flistener);
virtual void addTraceListener(TraceListener* tl);
@@ -456,18 +366,16 @@
bool isTraceSelect() const;
virtual void
- setTraceSelect(bool b);
+ setTraceSelect(bool b);
virtual void
setTraceTemplateChildren(bool b);
virtual void
- setQuietConflictWarnings(bool b)
- {
- m_quietConflictWarnings = b;
- }
+ setQuietConflictWarnings(bool b);
- virtual void removeTraceListener(TraceListener* tl);
+ virtual void
+ removeTraceListener(TraceListener* tl);
virtual void
setDiagnosticsOutput(PrintWriter* pw);
@@ -484,29 +392,29 @@
* @return document object, which represents the parsed XML
* @exception SAXException
*/
- DOM_Document
+ XalanDocument*
parseXML(
const XMLURL& url,
DocumentHandler* docHandler,
- const DOM_Document& docToRegister);
+ XalanDocument* docToRegister);
/**
* Reset the state of the XSL processor by reading in a new XSL stylesheet
* from a processing instruction.
*
- * @param xslURLString valid URI to an XSL stylesheet
- * @param fragBase base of tree if URI represents document
- * fragment
- * @param xmlBaseIdent base identifier for stylesheet URI
- * @param isRoot true if stylesheet is root of tree
+ * @param xslURLString valid URI to an XSL stylesheet
+ * @param fragBase base of tree if URI represents document
+ * fragment
+ * @param xmlBaseIdent base identifier for stylesheet URI
+ * @param isRoot true if stylesheet is root of tree
* @param constructionContext context for construction of object
* @return pointer to stylesheet
*/
Stylesheet*
getStylesheetFromPIURL(
- const DOMString& xslURLString,
- const DOM_Node& fragBase,
- const DOMString& xmlBaseIdent,
+ const XalanDOMString& xslURLString,
+ XalanNode& fragBase,
+ const XalanDOMString& xmlBaseIdent,
bool isRoot,
StylesheetConstructionContext& constructionContext);
@@ -518,11 +426,11 @@
/**
* Add a namespace declaration to the namespace stack
*
- * @param prefix namespace prefix
+ * @param prefix namespace prefix
* @param namespaceVal value of namespace
*/
- void addResultNamespaceDecl(const DOMString& prefix,
- const DOMString& namespaceVal);
+ void addResultNamespaceDecl(const XalanDOMString& prefix,
+ const XalanDOMString& namespaceVal);
/**
* Add attribute to attribute list, and if it is a namespace, add it to the
@@ -535,8 +443,8 @@
void
addResultAttribute(
AttributeListImpl& attList,
- const DOMString& aname,
- const DOMString& value);
+ const XalanDOMString& aname,
+ const XalanDOMString& value);
/**
* Add attribute to pending attributes list, and if it is a namespace, add
@@ -547,8 +455,8 @@
*/
void
addResultAttribute(
- const DOMString& aname,
- const DOMString& value)
+ const XalanDOMString& aname,
+ const XalanDOMString& value)
{
addResultAttribute(m_pendingAttributes,
aname,
@@ -559,7 +467,7 @@
* Receive notification of character data.
*
* <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
+ * character data. SAX parsers may return all contiguous character
* data in a single chunk, or they may split it into several
* chunks; however, all of the characters in any single event
* must come from the same external entity, so that the Locator
@@ -574,7 +482,7 @@
*
* NOTE: This method is only provided for compatibility with existing code
*
- * @param ch pointer to characters from the XML document
+ * @param ch pointer to characters from the XML document
* @param start startng offset in 'ch' array
* @param length number of characters to read from the array
* @deprecated
@@ -615,7 +523,7 @@
/**
* Called when a Comment is to be constructed.
*
- * @param data pointer to comment data
+ * @param data pointer to comment data
* @exception SAXException
*/
virtual void
@@ -636,7 +544,7 @@
* Receive notification of cdata.
*
* <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
+ * character data. SAX parsers may return all contiguous character
* data in a single chunk, or they may split it into several
* chunks; however, all of the characters in any single event
* must come from the same external entity, so that the Locator
@@ -649,7 +557,7 @@
* ignorableWhitespace() method rather than this one (validating
* parsers must do so).</p>
*
- * @param ch pointer to characters from the XML document
+ * @param ch pointer to characters from the XML document
* @param start start position in the array
* @param length number of characters to read from the array
* @exception SAXException
@@ -657,23 +565,23 @@
virtual void
cdata(
const XMLCh* const ch,
- const unsigned int start,
- const unsigned int length);
+ const unsigned int start,
+ const unsigned int length);
/**
* Clone an element with or without children.
*
- * @param node node to clone
- * @param isLiteral true if a literal element
- * @param overrideStrip false if white space stripping should be done
+ * @param node node to clone
+ * @param isLiteral true if a literal element
+ * @param overrideStrip false if white space stripping should be done
* @param shouldCloneAttributes true if attributes should be cloned
*/
void
cloneToResultTree(
- const DOM_Node& node,
- bool isLiteral,
- bool overrideStrip,
- bool shouldCloneAttributes);
+ XalanNode& node,
+ bool isLiteral,
+ bool overrideStrip,
+ bool shouldCloneAttributes);
/**
* Given a result tree fragment, walk the tree and output it to the result
@@ -682,35 +590,35 @@
* @param theTree result tree fragment
*/
void
- outputResultTreeFragment(const XObject& theTree);
+ outputResultTreeFragment(const XObject& theTree);
/**
* Determine if an external function is available.
*
- * @param theNamespace namespace for function
+ * @param theNamespace namespace for function
* @param extensionName name of extension function
* @return whether the given function is available or not
*/
bool
functionAvailable(
- DOMString& theNamespace,
- DOMString& extensionName) const;
+ XalanDOMString& theNamespace,
+ XalanDOMString& extensionName) const;
/**
* Handle an extension function.
*
- * @param executionContext current execution context
- * @param theNamespace namespace of function
+ * @param executionContext current execution context
+ * @param theNamespace namespace of function
* @param extensionName extension function name
- * @param argVec vector of arguments to function
+ * @param argVec vector of arguments to function
* @return pointer to XObject result
*/
virtual XObject*
extFunction(
XPathExecutionContext& executionContext,
- const DOMString& theNamespace,
- const DOMString& extensionName,
- const XObjectPtrVectorType& argVec) const;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectPtrVectorType& argVec) const;
// This is public for class Stylesheet...
/**
@@ -722,30 +630,23 @@
* @param extensionElem extension element
*/
void
- handleFunctionsInstruction(
- DOM_Element extensionElem);
+ handleFunctionsInstruction(XalanElement& extensionElem);
/**
* Retrieve the root stylesheet.
*
* @return pointer to root stylesheet
*/
- StylesheetRoot*
- getStylesheetRoot() const
- {
- return m_stylesheetRoot;
- }
+ virtual StylesheetRoot*
+ getStylesheetRoot() const;
/**
* Set the root stylesheet.
*
* @param theStylesheet pointer to new root stylesheet
*/
- void
- setStylesheetRoot(StylesheetRoot* theStylesheet)
- {
- m_stylesheetRoot = theStylesheet;
- }
+ virtual void
+ setStylesheetRoot(StylesheetRoot* theStylesheet);
/**
* Table of stylesheet documents. Document objects are keyed by URL string.
@@ -770,7 +671,7 @@
*
* @return prefix string
*/
- static const DOMString&
+ static const XalanDOMString&
getXSLNameSpaceURLPre()
{
return s_XSLNameSpaceURLPre;
@@ -782,7 +683,7 @@
*
* @return URI string
*/
- const DOMString&
+ const XalanDOMString&
getXSLNameSpaceURL() const
{
return m_XSLNameSpaceURL;
@@ -793,7 +694,7 @@
*
* @return Xalan namespace for extensions
*/
- static const DOMString&
+ static const XalanDOMString&
getXalanXSLNameSpaceURL()
{
return s_XSLT4JNameSpaceURL;
@@ -805,7 +706,7 @@
* @param theXSLNameSpaceURL XSLT namespace URI
*/
void
- setXSLNameSpaceURL(const DOMString& theXSLNameSpaceURL)
+ setXSLNameSpaceURL(const XalanDOMString& theXSLNameSpaceURL)
{
m_XSLNameSpaceURL = theXSLNameSpaceURL;
}
@@ -845,10 +746,10 @@
*
* @param name a probable xsl:xxx element
* @return Constants.ELEMNAME_XXX token, -1 if in XSL or Xalan namespace,
- * or -2 if not in known namespace
+ * or -2 if not in known namespace
*/
int
- getAttrTok(const DOMString& name) const
+ getAttrTok(const XalanDOMString& name) const
{
AttributeKeysMapType::const_iterator iter=
s_attributeKeys.find(name);
@@ -863,23 +764,22 @@
*
* @param node a probable xsl:xxx element.
* @return Constants.ELEMNAME_XXX token, -1 if in XSL or Xalan namespace,
- * or -2 if not in known namespace
+ * or -2 if not in known namespace
*/
int
- getXSLToken(
- const DOM_Node& node) const;
+ getXSLToken(const XalanNode& node) const;
/**
* Find the type of an element using this method.
*
- * @param node a probable xsl:xxx element
+ * @param node a probable xsl:xxx element
* @param tagType Constants.ELEMNAME_XXX token
* @return true if node is of tagType
*/
bool
isXSLTagOfType(
- const DOM_Node& node,
- int tagType) const;
+ const XalanNode& node,
+ int tagType) const;
/**
* Add list of trace listeners to the root sylesheet for the purposes of
@@ -905,71 +805,42 @@
return m_quietConflictWarnings;
}
- /**
- * Warn the user of an problem. This is public for access by extensions.
- *
- * @exception XSLProcessorException
- */
- void message(const DOMString& msg);
-
- /**
- * Warn the user of an problem. This is public for access by extensions.
- *
- * @param msg text of message
- * @exception XSLProcessorException
- */
- void message( const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg);
-
- /**
- * Tell the user of an warning, and probably throw an exception.
- *
- * @param msg text of message to output
- * @exception XSLProcessorException
- */
virtual void
- warn(const DOMString& msg) const;
+ message(
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
/**
* Tell the user of an warning, and probably throw an exception.
*
- * @param msg text of message to output
+ * @param msg text of message to output
* @param sourceNode node in source where error occurred
* @param styleNode node in stylesheet where error occurred
* @exception XSLProcessorException
*/
virtual void
warn(
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg) const;
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
- /**
- * Tell the user of an error, and probably throw an exception.
- *
- * @param msg text of message to output
- * @exception XSLProcessorException
- */
- void
- error(const DOMString& msg) const;
-
//@@ HOLD until we figure out exceptions
-// void error(DOMString& msg, Exception e);
+// void error(XalanDOMString& msg, Exception e);
/**
* Tell the user of an error, and probably throw an exception.
*
- * @param msg text of message to output
+ * @param msg text of message to output
* @param sourceNode node in source where error occurred
* @param styleNode node in stylesheet where error occurred
* @exception XSLProcessorException
*/
- void
+ virtual void
error(
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg) const;
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
/**
* Mark the time, so that displayDuration can later display the elapsed
@@ -987,7 +858,7 @@
* @param key pointer to element involved
*/
clock_t
- popDuration(const void* key) const;
+ popDuration(const void* key) const;
/**
* Display the duration since pushTime was called for element in
@@ -998,8 +869,8 @@
*/
void
displayDuration(
- const DOMString& info,
- const void* key) const;
+ const XalanDOMString& info,
+ const void* key) const;
/**
@@ -1017,16 +888,16 @@
*/
void
diag(
- const DOMString& s) const;
+ const XalanDOMString& s) const;
/**
* Compose a diagnostic trace of the current selection
*
* @param theTemplate current context node
- * @param nl list of selected nodes
+ * @param nl list of selected nodes
*/
void traceSelect(
- const DOM_Element& theTemplate,
+ const XalanElement& theTemplate,
const NodeRefListBase& nl) const;
/**
@@ -1036,16 +907,16 @@
* @param elementName name of element
* @return true if it should output as cdata
*/
- bool isCDataResultElem(const DOMString& elementName);
+ bool isCDataResultElem(const XalanDOMString& elementName);
/**
* Tell if a qualified name equals the current result tree name.
*
- * @param qname QName to compare to
+ * @param qname QName to compare to
* @param elementName current result tree element
* @return true if names are the same
*/
- bool qnameEqualsResultElemName(const QName& qname, const DOMString& elementName);
+ bool qnameEqualsResultElemName(const QName& qname, const XalanDOMString& elementName);
/**
* Retrieve the result namespace corresponding to a prefix.
@@ -1053,9 +924,9 @@
* @param prefix prefix for namespace
* @return string for namespace URI
*/
- DOMString
+ XalanDOMString
getResultNamespaceForPrefix(
- const DOMString& prefix) const;
+ const XalanDOMString& prefix) const;
/**
* Retrieve the result prefix corresponding to a namespace.
@@ -1063,89 +934,89 @@
* @param theNamespace namespace for prefix
* @return string for namespace prefix
*/
- DOMString
+ XalanDOMString
getResultPrefixForNamespace(
- const DOMString& theNamespace) const;
+ const XalanDOMString& theNamespace) const;
/**
* Evaluate an xpath string and return the result as a numberic score.
*
- * @param str string to evaluate
- * @param context context node
+ * @param str string to evaluate
+ * @param context context node
* @param executionContext current execution context
* @return score number, higher representing better match
*/
double
evalMatchPatternStr(
- const DOMString& str,
- const DOM_Node& context,
+ const XalanDOMString& str,
+ XalanNode* context,
XPathExecutionContext& executionContext);
/**
* Create and initialize an xpath and return it.
*
- * @param str string for XPath
+ * @param str string for XPath
* @param resolver resolver for namespace resolution
* @return pointer to XPath created
*/
XPath*
createMatchPattern(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver);
/**
* Copy XMLNS: attributes in if not already in scope.
*
- * @param src source node
+ * @param src source node
* @param srcIsStylesheetTree true if source node is a stylesheet tree
*/
void
copyNamespaceAttributes(
- const DOM_Node& src,
- bool srcIsStylesheetTree);
+ const XalanNode& src,
+ bool srcIsStylesheetTree);
/**
* Evaluate an xpath string and return the result.
*
- * @param str string to evaluate
+ * @param str string to evaluate
* @param executionContext current execution context
* @return pointer to XObject result
*/
XObject*
evalXPathStr(
- const DOMString& str,
+ const XalanDOMString& str,
XPathExecutionContext& executionContext);
/**
* Evaluate an xpath string and return the result.
*
- * @param str string to evaluate
- * @param contextNode context node
+ * @param str string to evaluate
+ * @param contextNode context node
* @param prefixResolver prefix resolver to use
* @param executionContext current execution context
* @return pointer to XObject result
*/
XObject*
evalXPathStr(
- const DOMString& str,
- const DOM_Node& contextNode,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext);
/**
* Evaluate an xpath string and return the result.
*
- * @param str string to evaluate
- * @param contextNode context node
+ * @param str string to evaluate
+ * @param contextNode context node
* @param prefixResolver prefix resolver to use
* @param executionContext current execution context
* @return pointer to XObject result
*/
XObject*
evalXPathStr(
- const DOMString& str,
- const DOM_Node& contextNode,
- const DOM_Element& prefixResolver,
+ const XalanDOMString& str,
+ XalanNode* contextNode,
+ const XalanElement& prefixResolver,
XPathExecutionContext& executionContext);
/**
@@ -1153,14 +1024,14 @@
* is complete. Do not use this to create an XPath to be
* held by a stylesheet.
*
- * @param str string to evaluate
+ * @param str string to evaluate
* @param executionContext current execution context
- * @param resolver resolver for namespace resolution
+ * @param resolver resolver for namespace resolution
* @return pointer to XPath created
*/
virtual XPath*
createProcessingXPath(
- const DOMString& str,
+ const XalanDOMString& str,
XPathExecutionContext& executionContext,
const PrefixResolver& resolver);
@@ -1171,22 +1042,22 @@
* @param doc document to search
* @return element for ID
*/
- DOM_Element
+ XalanElement*
getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const;
/**
* Push a context marker onto the stack to let us know when to stop
* searching for a var.
*
- * @param caller caller node
+ * @param caller caller node
* @param sourceNode source node
*/
void
pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode)
+ const XalanNode* caller,
+ const XalanNode* sourceNode)
{
m_variableStacks.pushContextMarker(caller, sourceNode);
}
@@ -1205,21 +1076,21 @@
* Also, push default arguments on the stack. You <em>must</em> call
* popContext() when you are done with the arguments.
*
- * @param executionContext execution context
+ * @param executionContext execution context
* @param xslCallTemplateElement "call-template" element
- * @param sourceTree source tree
- * @param sourceNode source node
- * @param mode mode under which the template is operating
- * @param targetTemplate target template
+ * @param sourceTree source tree
+ * @param sourceNode source node
+ * @param mode mode under which the template is operating
+ * @param targetTemplate target template
*/
void
pushParams(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate)
+ const XalanNode* targetTemplate)
{
m_variableStacks.pushParams(executionContext,
xslCallTemplateElement,
@@ -1233,59 +1104,59 @@
* Get an Expression object from a select node. Does not cache!
*
* @param attrs attribute list to search
- * @param key key value to search for
+ * @param key key value to search for
* @param resolver resolver for namespace resolution
* @return pointer to XPath for expression
*/
XPath* getExpression(
AttributeList& attrs,
- const DOMString& key,
+ const XalanDOMString& key,
const PrefixResolver& resolver);
/**
* Given an element, return an attribute value in the form of a string.
*
- * @param el element from where to get the attribute
- * @param key name of the attribute
+ * @param el element from where to get the attribute
+ * @param key name of the attribute
* @param contextNode context to evaluate the attribute value template
* @return string for attribute value
*/
- DOMString
+ XalanDOMString
getAttrVal(
- const DOM_Element& el,
- const DOMString& key,
- const DOM_Node& contextNode);
+ const XalanElement& el,
+ const XalanDOMString& key,
+ const XalanNode& contextNode);
/**
* Given an element, return an attribute value in the form of a string.
*
- * @param el element from where to get the attribute
- * @param key name of the attribute
+ * @param el element from where to get the attribute
+ * @param key name of the attribute
* @return string for attribute value
*/
- static DOMString
+ static XalanDOMString
getAttrVal(
- const DOM_Element& el,
- const DOMString& key);
+ const XalanElement& el,
+ const XalanDOMString& key);
/**
* Copy an attribute to the created output element, executing attribute
* templates as need be, and processing the 'xsl:use' attribute.
*
- * @param attr attribute to copy
- * @param contextNode current context node
+ * @param attr attribute to copy
+ * @param contextNode current context node
* @param stylesheetTree associated stylesheet object
- * @param attrList attribute list added to
+ * @param attrList attribute list added to
* @param namespaceContext context for namespace
* @exception XSLProcessorException
*/
void
copyAttributeToTarget(
- const DOM_Attr& attr,
- const DOM_Node& contextNode,
- const Stylesheet* stylesheetTree,
- AttributeListImpl& attrList,
- const DOM_Element& namespaceContext);
+ const XalanAttr& attr,
+ XalanNode* contextNode,
+ const Stylesheet* stylesheetTree,
+ AttributeListImpl& attrList,
+ const XalanElement& namespaceContext);
/**
* Determine whether to translate CSS attributes on the output to a "style"
@@ -1317,7 +1188,7 @@
* Determine the value of the default-space attribute.
*
* @return true if the default-space attribute is "strip," false if
- * the attribute is "preserve"
+ * the attribute is "preserve"
*/
bool
getStripWhiteSpace() const
@@ -1329,10 +1200,10 @@
* Change the value of the default-space attribute.
*
* @param b sets the default of the default-space attribute to "strip" if
- * true, or "preserve" if false.
+ * true, or "preserve" if false.
*/
void
- setStripWhiteSpace(bool fStrip)
+ setStripWhiteSpace(bool fStrip)
{
m_stripWhiteSpace = fStrip;
}
@@ -1346,14 +1217,14 @@
* probably do its own white space handling based on the semantics of the
* formatting object.
*
- * @param string string to be trimmed
- * @param trimHead whether to trim leading whitespace
- * @param trimTail whether to trim trailing whitespace
+ * @param string string to be trimmed
+ * @param trimHead whether to trim leading whitespace
+ * @param trimTail whether to trim trailing whitespace
* @param doublePunctuationSpaces true to use double spaces for punctuation
* @return trimmed string
*/
- DOMString fixWhiteSpace(
- const DOMString& string,
+ XalanDOMString fixWhiteSpace(
+ const XalanDOMString& string,
bool trimHead,
bool trimTail,
bool doublePunctuationSpaces);
@@ -1369,30 +1240,31 @@
m_outputCarriageReturns = b;
}
- /**
- * Control if linefeeds are put in the result tree. Default is to output
- * linefeeds.
- *
- * @param b true to output linefeeds
- */
- void setOutputLinefeeds(bool b)
+ /**
+ * Control if linefeeds are put in the result tree. Default is to output
+ * linefeeds.
+ *
+ * @param b true to output linefeeds
+ */
+ void
+ setOutputLinefeeds(bool b)
{
m_outputLinefeeds = b;
}
- /**
- * Normalize the linefeeds and/or carriage returns to be consistently 0x0D
- * 0x0A.
- *
- * @param tx DOM text node to normalize
- * @return normalized string
- */
- /* This should almost certainly be done somewhere else... like in the XML
+ /**
+ * Normalize the linefeeds and/or carriage returns to be consistently 0x0D
+ * 0x0A.
+ *
+ * @param tx DOM text node to normalize
+ * @return normalized string
+ */
+ /* $$$ ToDo: This should almost certainly be done somewhere else... like in the XML
* parser.
*/
- DOMString getNormalizedText(const DOM_Text& tx) const;
+ const XalanDOMString
+ getNormalizedText(const XalanText& tx) const;
-
/**
* Set the stylesheet root. If this is set, then the process calls that
* take only the input .xml will use this instead of looking for a
@@ -1400,7 +1272,8 @@
*
* @param theStylesheet pointer to root stylesheet
*/
- void setStylesheet(StylesheetRoot *stylesheetRoot)
+ void
+ setStylesheet(StylesheetRoot *stylesheetRoot)
{
m_stylesheetRoot = stylesheetRoot;
}
@@ -1412,7 +1285,8 @@
*
* @return pointer to root stylesheet
*/
- StylesheetRoot *getStylesheet()
+ StylesheetRoot*
+ getStylesheet() const
{
return m_stylesheetRoot;
}
@@ -1424,7 +1298,8 @@
*
* @return name of output document
*/
- DOMString &getOutputFileName()
+ const XalanDOMString&
+ getOutputFileName() const
{
return m_outputFileName;
}
@@ -1436,7 +1311,8 @@
*
* @param filename name of output document
*/
- void setOutputFileName(const DOMString& filename)
+ void
+ setOutputFileName(const XalanDOMString& filename)
{
m_outputFileName = filename;
}
@@ -1446,7 +1322,8 @@
*
* @return XPath factory object
*/
- XPathFactory& getXPathFactory()
+ XPathFactory&
+ getXPathFactory()
{
return m_xpathFactory;
}
@@ -1455,34 +1332,34 @@
* Get the XPath processor object.
*
* @return XPathProcessor interface being used
+ */
+ XPathProcessor&
+ getXPathProcessor()
+ {
+ return *m_xpathProcessor.get();
+ }
+
+ /**
+ * Given a document, get the default stylesheet URI from the xsl:stylesheet
+ * PI. However, this will only get you the first URL, and there may be
+ * many.
+ *
+ * @param sourceTree node for source tree
+ * @deprecated
+ */
+ const XalanDOMString
+ getStyleSheetURIFromDoc(const XalanNode& sourceTree);
+
+ /**
+ * Given a classID and codetype, try to register a code dispatcher.
+ *
+ * @param classid class id for extension
+ * @param codetype type of extension
*/
- XPathProcessor& getXPathProcessor()
- {
- return *m_xpathProcessor.get();
- }
-
-
- /**
- * Given a document, get the default stylesheet URI from the xsl:stylesheet
- * PI. However, this will only get you the first URL, and there may be
- * many.
- *
- * @param sourceTree node for source tree
- * @deprecated
- */
- DOMString getStyleSheetURIfromDoc(const DOM_Node& sourceTree);
-
-
- /**
- * Given a classID and codetype, try to register a code dispatcher.
- *
- * @param classid class id for extension
- * @param codetype type of extension
- */
void
registerExtensionHandlerByName(
- const DOMString& classid,
- const DOMString& codetype);
+ const XalanDOMString& classid,
+ const XalanDOMString& codetype);
/**
* Register the given DispatcherFactory for a given mime type.
@@ -1492,8 +1369,8 @@
*/
void
registerExtensionHandler(
- const DOMString& mimeType,
- DispatcherFactory* factory);
+ const XalanDOMString& mimeType,
+ DispatcherFactory* factory);
/**
* Determine the fully qualified URI for a string.
@@ -1502,7 +1379,7 @@
* @return pointer to fully qualified URI
*/
XMLURL*
- getURLFromString(const DOMString& urlString) const;
+ getURLFromString(const XalanDOMString& urlString) const;
/**
* Determine the fully qualified URI for a string.
@@ -1512,14 +1389,17 @@
* @return pointer to fully qualified URI
*/
XMLURL*
- getURLFromString(const DOMString& urlString, const DOMString& base) const;
+ getURLFromString(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const;
/**
* Retrieve the XPath support object
*
* @return XPath support object
*/
- XPathSupport& getXPathSupport()
+ XPathSupport&
+ getXPathSupport()
{
return m_xpathSupport;
}
@@ -1529,7 +1409,8 @@
*
* @return XPath environment support object
*/
- XPathEnvSupport& getXPathEnvSupport()
+ XPathEnvSupport&
+ getXPathEnvSupport()
{
return m_xpathEnvSupport;
}
@@ -1542,9 +1423,11 @@
* @param formatter pointer to formatter
*/
void
- setFormatter(Formatter* formatter);
+ setFormatter(Formatter* formatter);
- const MutableNodeRefList& getContextNodeList()
+ // $$$ ToDo: why isn't this just a NodeRefListBase?
+ const MutableNodeRefList&
+ getContextNodeList() const
{
return m_contextNodeList;
}
@@ -1554,7 +1437,9 @@
*
* @param ref new node list
*/
- void setContextNodeList(const MutableNodeRefList& ref)
+ // $$$ ToDo: why isn't this just a NodeRefListBase?
+ void
+ setContextNodeList(const MutableNodeRefList& ref)
{
m_contextNodeList = ref;
}
@@ -1566,8 +1451,8 @@
* @param theNode template node
*/
void
- addNamedTemplate(const DOMString& theName,
- const DOM_Node& theNode)
+ addNamedTemplate(const XalanDOMString& theName,
+ const XalanNode* theNode)
{
m_namedTemplates[theName] = theNode;
}
@@ -1578,8 +1463,8 @@
* @param theName name of template
* @return template node if found, empty node otherwise
*/
- DOM_Node
- getNamedTemplate(const DOMString& theName) const
+ const XalanNode*
+ getNamedTemplate(const XalanDOMString& theName) const
{
const NamedTemplatesMapType::const_iterator i =
m_namedTemplates.find(theName);
@@ -1590,7 +1475,7 @@
}
else
{
- return DOM_Node();
+ return 0;
}
}
@@ -1624,10 +1509,10 @@
* An class for exceptions that occur when a given stylesheet goes into an
* infinite loop.
*/
- class XSLInfiniteLoopException : public RuntimeError
+ class XSLInfiniteLoopException : public XSLTProcessorException
{
public:
- XSLInfiniteLoopException() : RuntimeError("XSL infinite loop occurred!")
+ XSLInfiniteLoopException() : XSLTProcessorException("XSLT infinite loop occurred!")
{ }
};
@@ -1661,7 +1546,7 @@
* @param elem element for context
*/
void
- pushElementMarker(const DOM_Node& elem);
+ pushElementMarker(const XalanNode* elem);
/**
* Pop the current context from the current context stack.
@@ -1669,7 +1554,7 @@
* @param elem element for context
*/
void
- popElementMarker(const DOM_Node& elem);
+ popElementMarker(const XalanNode* elem);
/**
* Check to see if an element marker for the particular node has already
@@ -1679,19 +1564,19 @@
* @return true if it has been pushed already
*/
bool
- elementMarkerAlreadyPushed(const DOM_Node& elem) const;
+ elementMarkerAlreadyPushed(const XalanNode* elem) const;
/**
* Push a context marker onto the stack to let us know when to stop
* searching for a var.
*
- * @param caller caller node
+ * @param caller caller node
* @param sourceNode source node
*/
void
pushContextMarker(
- const DOM_Node& caller,
- const DOM_Node& sourceNode);
+ const XalanNode* caller,
+ const XalanNode* sourceNode);
/**
* Pop the current context from the current context stack.
@@ -1704,21 +1589,21 @@
* Also, push default arguments on the stack. You <em>must</em> call
* popContext() when you are done with the arguments.
*
- * @param executionContext execution context
+ * @param executionContext execution context
* @param xslCallTemplateElement "call-template" element
- * @param sourceTree source tree
- * @param sourceNode source node
- * @param mode mode under which the template is operating
- * @param targetTemplate target template
+ * @param sourceTree source tree
+ * @param sourceNode source node
+ * @param mode mode under which the template is operating
+ * @param targetTemplate target template
*/
void
pushParams(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslCallTemplateElement,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode,
- const DOM_Node& targetTemplate);
+ const XalanNode* targetTemplate);
/**
* Given a name, return a string representing the value, but don't look
@@ -1739,7 +1624,8 @@
* @param qname name of variable
* @return true if variable is on stack
*/
- bool hasParamVariable(QName& qname);
+ bool
+ hasParamVariable(const QName& qname) const;
/**
* Given a name, find the corresponding XObject.
@@ -1748,7 +1634,7 @@
* @return pointer to the corresponding XObject
*/
XObject*
- getXObjectVariable(const QName& name) const
+ getXObjectVariable(const QName& name) const
{
return findXObject(name, true);
}
@@ -1758,15 +1644,15 @@
* to call startContext before pushing a series of arguments for a given
* macro call.
*
- * @param name name of variable
- * @param val pointer to XObject value
- * @param e element marker for variable
+ * @param name name of variable
+ * @param val pointer to XObject value
+ * @param e element marker for variable
*/
void
pushVariable(
const QName& name,
XObject* val,
- const DOM_Node& e);
+ const XalanNode* e);
private:
@@ -1785,12 +1671,12 @@
* Holds caller, so that it may be searched for
* xsl:params, in order to resolve xsl:param-arg.
*/
- DOM_Element m_caller;
+ const XalanElement* m_caller;
VariableStackStackType m_stack;
- XSLTEngineImpl& m_processor;
+ XSLTEngineImpl& m_processor;
}; // end VariableStack
// Give VariableStack access to stuff.
@@ -1808,7 +1694,7 @@
}
/**
- * Create a document fragment. This function may return null.
+ * Create a document fragment. This function may return null.
*
* @return pointer to new document fragment
*/
@@ -1820,28 +1706,32 @@
*
* @return attribute list
*/
- AttributeListImpl& getPendingAttributes();
-
+ AttributeListImpl&
+ getPendingAttributes();
+
/**
* Retrieve name of the pending element currently being processed.
*
* @return element name
*/
- DOMString getPendingElementName() const;
-
+ const XalanDOMString
+ getPendingElementName() const;
+
/**
* Sets a list of attributes yet to be processed.
*
* @param pendingAttributes attribute list
*/
- void setPendingAttributes(const AttributeList& pendingAttributes);
-
+ void
+ setPendingAttributes(const AttributeList& pendingAttributes);
+
/**
* Changes the currently pending element name.
*
* @param elementName new name of element
*/
- void setPendingElementName(const DOMString& elementName);
+ void
+ setPendingElementName(const XalanDOMString& elementName);
/**
* Accessor method for stack that keeps track of the attribute elements.
@@ -1890,14 +1780,15 @@
// These methods are inherited from DocumentHandler ...
- virtual void setDocumentLocator(const Locator* const locator);
+ virtual void
+ setDocumentLocator(const Locator* const locator);
virtual void
startDocument();
virtual void
endDocument();
-
+
virtual void
startElement(
const XMLCh* const name,
@@ -1907,9 +1798,9 @@
endElement(
const XMLCh* const name);
- virtual void characters (
- const XMLCh* const chars,
- const unsigned int length);
+ virtual void characters (
+ const XMLCh* const chars,
+ const unsigned int length);
virtual void
ignorableWhitespace(
@@ -1928,56 +1819,51 @@
/*
* The current input element that is being processed.
*/
- DOM_Node m_currentNode;
+ XalanNode* m_currentNode;
/**
* Given a tag name, an attribute name, and
* an attribute value, do a very crude recursive
* search and locate the first match.
*/
- static DOM_Element
+ static XalanElement*
findElementByAttribute(
- const DOM_Element& elem,
- const DOMString& targetElementName,
- const DOMString& targetAttributeName,
- const DOMString& targetAttributeValue);
+ XalanElement& elem,
+ const XalanDOMString& targetElementName,
+ const XalanDOMString& targetAttributeName,
+ const XalanDOMString& targetAttributeValue);
- /**
- * Returns whether or not an attribute key
- * is a CSS2 attribute.
- * @deprecated
- */
+ /**
+ * Returns whether or not an attribute key
+ * is a CSS2 attribute.
+ * @deprecated
+ */
bool
- isCSSAttribute(
- const DOMString& name) const;
+ isCSSAttribute(const XalanDOMString& name) const;
- /**
- * Stuff a hash table with CSS2 keys & dummy values
- * in order to quickly look up if a template child
- * attribute is a CSS attribute or not.
- * Note: This has something in it to screw up the
- * Dev Studio code format command, so that the
- * last curly bracket goes all the way to the
- * left.
- * @deprecated
- */
+ /**
+ * Stuff a hash table with CSS2 keys & dummy values
+ * in order to quickly look up if a template child
+ * attribute is a CSS attribute or not.
+ * @deprecated
+ */
void
initCSS2Table();
- /**
- * Copy the attributes from the XSL element to the created
- * output element, executing attribute templates and
- * processing the xsl:use attribute as need be.
- * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
- * the error condition is severe enough to halt processing.
- */
+ /**
+ * Copy the attributes from the XSL element to the created
+ * output element, executing attribute templates and
+ * processing the xsl:use attribute as need be.
+ * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
+ * the error condition is severe enough to halt processing.
+ */
void
copyAttributesToAttList(
- const DOM_Node& contextNode,
- const Stylesheet* stylesheetTree,
- const DOM_Element& templateChild,
- AttributeListImpl& attList);
+ XalanNode* contextNode,
+ const Stylesheet* stylesheetTree,
+ const XalanElement& templateChild,
+ AttributeListImpl& attList);
/**
* Keyed on CSS2 property names, and holding dummy
@@ -1985,7 +1871,7 @@
* attribute is a CSS attribute or not.
* @deprecated
*/
- TranslateCSSSetType m_cssKeys;
+ TranslateCSSSetType m_cssKeys;
/*
* If this is true, translate CSS attributes on the output to a "style"
@@ -1993,25 +1879,30 @@
*/
bool m_translateCSS;
+public:
+
/**
* Reset the state. This needs to be called after a process() call
* is invoked, if the processor is to be used again.
*/
- virtual void reset();
-
+ virtual void
+ reset();
+
+protected:
+
/**
* The pending element. We have to delay the call to
* m_flistener.startElement(name, atts) because of the
- * xsl:attribute and xsl:copy calls. In other words,
+ * xsl:attribute and xsl:copy calls. In other words,
* the attributes have to be fully collected before you
* can call startElement.
*/
- DOMString m_pendingElementName;
+ XalanDOMString m_pendingElementName;
/**
- * The pending attributes. We have to delay the call to
- * m_flistener.startElement(name, atts) because of the
+ * The pending attributes. We have to delay the call to
+ * m_flistener.startElement(name, atts) because of the
* xsl:attribute and xsl:copy calls. In other words,
* the attributes have to be fully collected before you
* can call startElement.
@@ -2026,7 +1917,7 @@
/**
* A stack to keep track of the result tree namespaces.
*/
- NamespacesStackType m_resultNameSpaces;
+ NamespacesStackType m_resultNameSpaces;
/**
* This is pushed on the m_resultNameSpaces stack until a
@@ -2045,7 +1936,7 @@
XPath* const m_xpath;
// Factory for creating xobjects
- XObjectFactory& m_xobjectFactory;
+ XObjectFactory& m_xobjectFactory;
// The query/pattern-matcher object.
XPathProcessorPtrType m_xpathProcessor;
@@ -2085,7 +1976,7 @@
*/
void
traceTemplate(
- const DOM_Element& theTemplate) const;
+ const XalanElement& theTemplate) const;
/**
* Print some diagnostics about the current
@@ -2093,42 +1984,42 @@
*/
void
diagnoseTemplateChildren(
- const DOM_Node& templateChild,
- const DOM_Node& sourceNode) const;
+ const XalanNode& templateChild,
+ const XalanNode& sourceNode) const;
/**
* The root of a linked set of stylesheets.
*/
- StylesheetRoot* m_stylesheetRoot;
+ StylesheetRoot* m_stylesheetRoot;
- StylesheetExecutionContext* m_stylesheetExecutionContext;
+ StylesheetExecutionContext* m_stylesheetExecutionContext;
/**
* The full XSLT Namespace URL. To be replaced by the one actually
* found.
*/
- DOMString m_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform/1.0"
+ XalanDOMString m_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform/1.0"
/**
* The minimum version of XSLT supported.
*/
- static const double s_XSLTVerSupported; // 1.0
+ static const double s_XSLTVerSupported; // 1.0
/**
* Out version of XSLT
*/
- static const DOMString s_DefaultXSLNameSpaceURL;
+ static const XalanDOMString s_DefaultXSLNameSpaceURL;
/**
* The namespace that we must match as a minimum for XSLT.
*/
- static const DOMString s_XSLNameSpaceURLPre; // "http://www.w3.org/1999/XSL/Transform"
+ static const XalanDOMString s_XSLNameSpaceURLPre; // "http://www.w3.org/1999/XSL/Transform"
/**
* Special Xalan namespace for built-in extensions.
*/
- static const DOMString s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt"
+ static const XalanDOMString s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt"
/**
@@ -2145,7 +2036,7 @@
/**
* Hash table of XSLT IDs for attribute names.
*/
- static AttributeKeysMapType s_attributeKeys;
+ static AttributeKeysMapType s_attributeKeys;
/**
* Hash table of XSLT element IDs for element names.
@@ -2159,22 +2050,7 @@
* benifit, but is used because of the cost of getExpandedElementName.
*/
// Create a hash table that can look up xsl element IDs via name.
- mutable XSLDirectiveMapType m_XSLDirectiveLookup;
-
- /**
- * If the template element is in the xsl:namespace, process the
- * element.
- * @return true if the given XSL template child is an XSL directive.
- * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide
- * the error condition is severe enough to halt processing.
- */
- bool
- processXSLTemplateInstruction(
- const Stylesheet* stylesheetTree,
- DOM_Element xslInstruction,
- DOM_Document sourceTree,
- const DOM_Node& sourceNode,
- const DOMString& mode);
+ mutable XSLDirectiveMapType m_XSLDirectiveLookup;
/**
* In response to 'xsl:import', call transformChild, or, if that
@@ -2219,19 +2095,22 @@
* List of listeners who are interested in tracing what's
* being generated.
*/
- TraceListenerVectorType m_traceListeners;
+ TraceListenerVectorType m_traceListeners;
// Common processing for errors and warnings
- void problem(const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- ProblemListener::eClassification classification) const;
+ void
+ problem(
+ const XalanDOMString& msg,
+ ProblemListener::eClassification classification,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
+
/**
* This is for use by multiple output documents, to determine
- * the base directory for the output document. It needs to
+ * the base directory for the output document. It needs to
* be set by the caller.
*/
- DOMString m_outputFileName;
+ XalanDOMString m_outputFileName;
/**
* Write the children of a stylesheet element to the given listener.
@@ -2247,10 +2126,10 @@
void
writeChildren(
FormatterListener* flistener,
- StylesheetExecutionContext& executionContext,
- const ElemTemplateElement& templateParent,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ StylesheetExecutionContext& executionContext,
+ const ElemTemplateElement& templateParent,
+ XalanNode& sourceTree,
+ XalanNode& sourceNode,
const QName& mode);
@@ -2266,10 +2145,10 @@
/**
* This should probably be in the XMLParserLiaison interface.
*/
- DOMString
+ XalanDOMString
getPrefixForNamespace(
- const DOMString& theNamespace,
- const DOM_Element& namespaceContext) const;
+ const XalanDOMString& theNamespace,
+ const XalanElement& namespaceContext) const;
bool m_useATVsInSelects;
@@ -2278,16 +2157,15 @@
* @deprecated
*/
void
- translateCSSAttrsToStyleAttr(
- AttributeListImpl& attList);
-
+ translateCSSAttrsToStyleAttr(AttributeListImpl& attList);
+
// $$$ ToDo: This must go!!!!!!
/**
* Evaluate an xpath string and return the result.
*/
virtual XPath*
createXPath(
- const DOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver);
/**
@@ -2297,38 +2175,38 @@
* the error condition is severe enough to halt processing.
*/
XObject*
- getXObjectVariable(const DOMString& name) const;
+ getXObjectVariable(const XalanDOMString& name) const;
/**
- * Get an XLocator provider keyed by node. This gets the association
+ * Get an XLocator provider keyed by node. This gets the association
* based on the root of the tree that is the node's parent.
*
* @param node node for locator
* @return pointer to locator
*/
XLocator*
- getXLocatorFromNode(const DOM_Node& node) const;
+ getXLocatorFromNode(const XalanNode* node) const;
/**
* Associate an XLocator provider to a node. This makes the association
* based on the root of the tree that is the node's parent.
*
- * @param node node for association
+ * @param node node for association
* @param xlocator locator to associate with node
*/
void
associateXLocatorToNode(
- const DOM_Node& node,
+ const XalanNode* node,
XLocator* xlocator);
- /**
- * If this is true, the processor will do the best it can to strip
- * unwanted white space. This is set in the stylesheet via the default-space
- * attribute on xsl:stylesheet.
- */
+ /**
+ * If this is true, the processor will do the best it can to strip
+ * unwanted white space. This is set in the stylesheet via the default-space
+ * attribute on xsl:stylesheet.
+ */
bool m_stripWhiteSpace; // default default-space="preserve"
-// typedef std::set<DOMString> WhitespaceLookupTableType;
+// typedef std::set<XalanDOMString> WhitespaceLookupTableType;
/**
* A lookup table of all space preserving elements.
@@ -2340,19 +2218,19 @@
*/
// WhitespaceLookupTableType m_whitespaceStrippingElements;
- /**
- * Control if the xsl:variable is resolved early or
- * late. Resolving the xsl:variable
- * early is a drag because it means that the fragment
- * must be created into a DocumentFragment, and then
- * cloned each time to the result tree. If we can resolve
- * late, that means we can evaluate directly into the
- * result tree. Right now this must be kept on 'early'
- * because you would need to set the call stack back to
- * the point of xsl:invoke... which I can't quite work out
- * at the moment. I don't think this is worth fixing
- * until NodeList variables are implemented.
- */
+ /**
+ * Control if the xsl:variable is resolved early or
+ * late. Resolving the xsl:variable
+ * early is a drag because it means that the fragment
+ * must be created into a DocumentFragment, and then
+ * cloned each time to the result tree. If we can resolve
+ * late, that means we can evaluate directly into the
+ * result tree. Right now this must be kept on 'early'
+ * because you would need to set the call stack back to
+ * the point of xsl:invoke... which I can't quite work out
+ * at the moment. I don't think this is worth fixing
+ * until NodeList variables are implemented.
+ */
static const bool s_resolveContentsEarly;
/**
@@ -2365,7 +2243,7 @@
* Get a DOM document, primarily for creating result
* tree fragments.
*/
- DOM_Document
+ virtual XalanDocument*
getDOMFactory() const;
/**
@@ -2380,7 +2258,7 @@
return s_resolveContentsEarly;
}
- ParamVectorType m_topLevelParams;
+ ParamVectorType m_topLevelParams;
public:
@@ -2397,7 +2275,7 @@
* Returns the current input node that is being
* processed.
*/
- DOM_Node
+ XalanNode*
getSourceNode() const
{
return m_currentNode;
@@ -2412,10 +2290,10 @@
XPathSupport& m_xpathSupport;
- XPathEnvSupport& m_xpathEnvSupport;
+ XPathEnvSupport& m_xpathEnvSupport;
/**
- * The listener for formatting events. This should be
+ * The listener for formatting events. This should be
* supplied by the Formatter object.
*/
@@ -2452,10 +2330,16 @@
{
public:
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<StackGuard> StackGuardStackType;
+#else
+ typedef std::vector<StackGuard> StackGuardStackType;
+#endif
+
StackGuard(
- XSLTEngineImpl& processor,
- const DOM_Element& xslTemplate = DOM_Element(),
- const DOM_Node& sourceXML = DOM_Node());
+ XSLTEngineImpl& processor,
+ const XalanElement* xslTemplate = 0,
+ const XalanNode* sourceXML = 0);
~StackGuard();
@@ -2465,25 +2349,29 @@
m_sourceXML == theRHS.m_sourceXML;
}
- void print(PrintWriter& pw) const;
+ void print(PrintWriter& pw) const;
void push(
- const DOM_Element& xslTemplate,
- const DOM_Node& sourceXML);
+ const XalanElement* xslTemplate,
+ const XalanNode* sourceXML);
void pop();
- void clear() { m_stack.clear(); }
+ void clear()
+ {
+ m_stack.clear();
+ }
- void checkForInfiniteLoop(const StackGuard& guard) const;
+ void
+ checkForInfiniteLoop(const StackGuard& guard) const;
private:
- XSLTEngineImpl* m_processor;
- DOM_Element m_xslRule;
- DOM_Node m_sourceXML;
+ XSLTEngineImpl* m_processor;
+ const XalanElement* m_xslRule;
+ const XalanNode* m_sourceXML;
- StackGuardStackType m_stack;
+ StackGuardStackType m_stack;
};
@@ -2514,14 +2402,8 @@
static void
InitializeXSLT4JElementKeys();
+};
-}; // end XSLTEngineImpl class
-
#endif // XALAN_XSLTENGINEIMPL_HEADER_GUARD
-
-// $ Log: $
-
-
-
1.4 +75 -71 xml-xalan/c/src/XSLT/XSLTInputSource.cpp
Index: XSLTInputSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInputSource.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSLTInputSource.cpp 2000/03/07 16:16:27 1.3
+++ XSLTInputSource.cpp 2000/04/11 15:09:31 1.4
@@ -60,110 +60,114 @@
#include "XSLTInputSource.hpp"
-// @@ JMD: temporary
+
+
+#include <framework/URLInputSource.hpp>
+
+
+
#include <cassert>
+
+
+
+XSLTInputSource::XSLTInputSource() :
+ InputSource(""),
+ m_node(0)
+{
+}
+
+
+
+
+XSLTInputSource::XSLTInputSource(const XMLCh* systemId) :
+ InputSource(systemId),
+ m_node(0)
+{
+}
+
+
+
+XSLTInputSource::XSLTInputSource(
+ const XMLCh* systemId,
+ const XMLCh* publicId) :
+ InputSource(systemId, publicId),
+ m_node(0)
+{
+}
-XSLTInputSource::XSLTInputSource(const XMLCh* const systemId) :
- InputSource(systemId) { }
-XSLTInputSource::XSLTInputSource(const XMLCh* const systemId, const XMLCh* const publicId) :
- InputSource(systemId, publicId) { }
-XSLTInputSource::XSLTInputSource(const char* const systemId) :
- InputSource(systemId) { }
+XSLTInputSource::XSLTInputSource(const char* systemId) :
+ InputSource(systemId),
+ m_node(0)
+{
+}
+
-XSLTInputSource::XSLTInputSource(const char* const systemId, const char* const publicId) :
- InputSource(systemId, publicId) { }
-
-
-/**
- * Create a new input source with a byte stream.
- *
- * <p>Application writers may use setSystemId to provide a base
- * for resolving relative URIs, setPublicId to include a
- * public identifier, and/or setEncoding to specify the object's
- * character encoding.</p>
- *
- * @param byteStream The raw byte stream containing the document.
- */
-XSLTInputSource::XSLTInputSource (InputStream* /* byteStream */) : InputSource("")
+
+XSLTInputSource::XSLTInputSource(
+ const char* systemId,
+ const char* publicId) :
+ InputSource(systemId,
+ publicId),
+ m_node(0)
{
+}
+
+
+
+XSLTInputSource::XSLTInputSource(InputStream* /* byteStream */) :
+ InputSource(""),
+ m_node(0)
+{
// @@ JMD: These are not in the C++ InputSource class
assert(0); // @@ ??
// java: setByteStream(byteStream);
}
+
+
-/**
- * Create a new input source with a character stream.
- *
- * <p>Application writers may use setSystemId() to provide a base
- * for resolving relative URIs, and setPublicId to include a
- * public identifier.</p>
- */
-XSLTInputSource::XSLTInputSource (Reader* /* characterStream */) : InputSource("")
+XSLTInputSource::XSLTInputSource (Reader* /* characterStream */) :
+ InputSource(""),
+ m_node(0)
{
// @@ JMD: These are not in the C++ InputSource class
assert(0); // @@ ??
// java: setCharacterStream(characterStream);
}
-/**
- * Create a new input source with a DOM node.
- *
- * <p>Application writers may use setSystemId() to provide a base
- * for resolving relative URIs, and setPublicId to include a
- * public identifier.</p>
- *
- * <p>The character stream shall not include a byte order mark.</p>
- */
-XSLTInputSource::XSLTInputSource (const DOM_Node& node) : InputSource("")
+
+
+XSLTInputSource::XSLTInputSource (XalanNode* node) :
+ InputSource(""),
+ m_node(0)
{
setNode(node);
}
+
-/**
- * Makes the byte stream for this input source.
- *
- * <p>The SAX parser will ignore this if there is also a character
- * stream specified, but it will use a byte stream in preference
- * to opening a URI connection itself.</p>
- *
- * @see #getByteStream
- * @see InputStream
- */
+
BinInputStream*
XSLTInputSource::makeStream() const
{
URLInputSource inputSource(getSystemId());
+
+
return inputSource.makeStream();
}
+
+
-/**
- * Set the character stream for this input source.
- *
- * <p>If there is a character stream specified, the SAX parser
- * will ignore any byte stream and will not attempt to open
- * a URI connection to the system identifier.</p>
- *
- * @param characterStream The character stream containing the
- * XML document or other entity.
- * @see #getCharacterStream
- * @see java.io.Reader
- */
void
-XSLTInputSource::setNode (const DOM_Node& node)
+XSLTInputSource::setNode(XalanNode* node)
{
m_node = node;
}
+
+
-/**
- * Get the character stream for this input source.
- *
- * @return The character stream, or null if none was supplied.
- * @see #setCharacterStream
- */
-const DOM_Node&
-XSLTInputSource::getNode()
+XalanNode*
+XSLTInputSource::getNode() const
{
return m_node;
}
1.4 +33 -20 xml-xalan/c/src/XSLT/XSLTInputSource.hpp
Index: XSLTInputSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInputSource.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSLTInputSource.hpp 2000/03/01 20:43:45 1.3
+++ XSLTInputSource.hpp 2000/04/11 15:09:31 1.4
@@ -61,25 +61,31 @@
#if !defined(XALAN_XSLTINPUTSOURCE_HEADER_GUARD)
#define XALAN_XSLTINPUTSOURCE_HEADER_GUARD
+
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
-#include <framework/URLInputSource.hpp>
-#include <dom/DOM_Node.hpp>
#include <sax/InputSource.hpp>
+
class BinInputStream;
class InputStream;
class Reader;
+class XalanNode;
+
+
class XALAN_XSLT_EXPORT XSLTInputSource : public InputSource
{
public:
- XSLTInputSource() : InputSource("")
- { }
+ explicit
+ XSLTInputSource();
/**
* Create a new input source with a system identifier.
@@ -91,7 +97,7 @@
*
* @param systemId system identifier (URI)
*/
- XSLTInputSource(const XMLCh* const systemId);
+ XSLTInputSource(const XMLCh* systemId);
/**
* Create a new input source with a system identifier.
@@ -103,7 +109,7 @@
*
* @param systemId system identifier (URI)
*/
- XSLTInputSource(const char* const systemId);
+ XSLTInputSource(const char* systemId);
/**
* Create a new input source with a system identifier and a public
@@ -114,7 +120,9 @@
* @param systemId system identifier (URI)
* @param publicId public identifier
*/
- XSLTInputSource(const char* const systemId, const char* const publicId);
+ XSLTInputSource(
+ const char* systemId,
+ const char* publicId);
/**
* Create a new input source with a system identifier and a public
@@ -125,7 +133,9 @@
* @param systemId system identifier (URI)
* @param publicId public identifier
*/
- XSLTInputSource(const XMLCh* const systemId, const XMLCh* const publicId);
+ XSLTInputSource(
+ const XMLCh* systemId,
+ const XMLCh* publicId);
/**
* Create a new input source with a byte stream.
@@ -136,7 +146,7 @@
*
* @param byteStream pointer to raw byte stream containing the document
*/
- XSLTInputSource (InputStream* byteStream);
+ XSLTInputSource(InputStream* byteStream);
/**
* Create a new input source with a character stream.
@@ -147,8 +157,8 @@
*
* @param characterStream pointer to character stream containing the document
*/
- XSLTInputSource (Reader* characterStream);
-
+ XSLTInputSource(Reader* characterStream);
+
/**
* Create a new input source with a DOM node.
*
@@ -158,8 +168,8 @@
*
* @param node DOM node that is root of the document
*/
- XSLTInputSource (const DOM_Node& node);
-
+ XSLTInputSource(XalanNode* node);
+
/**
* Makes the byte stream for this input source.
*
@@ -170,27 +180,30 @@
*
* @return pointer to byte stream created
*/
- virtual BinInputStream* makeStream() const;
-
+ virtual BinInputStream*
+ makeStream() const;
+
/**
* Set the DOM node for this input source.
*
* @param node DOM node that is root of the document
*/
- void setNode (const DOM_Node& node);
+ void
+ setNode(XalanNode* node);
/**
* Retrieve the DOM node for this input source.
*
* @return DOM node that is root of the document
*/
- const DOM_Node& getNode ();
+ XalanNode*
+ getNode() const;
private:
- DOM_Node m_node;
+
+ XalanNode* m_node;
};
-#endif // XALAN_XSLTINPUTSOURCE_HEADER_GUARD
-// $ Log: $
+#endif // XALAN_XSLTINPUTSOURCE_HEADER_GUARD
1.6 +162 -106 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTProcessor.hpp 2000/03/03 19:00:34 1.5
+++ XSLTProcessor.hpp 2000/04/11 15:09:31 1.6
@@ -10,33 +10,33 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
@@ -61,12 +61,19 @@
#if !defined(XALAN_XSLTPROCESSOR_HEADER_GUARD)
#define XALAN_XSLTPROCESSOR_HEADER_GUARD
+
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
+
+
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class Arg;
class DispatcherFactory;
-class DOM_Element;
class ElemTemplateElement;
class Formatter;
class FormatterListener;
@@ -85,6 +92,9 @@
class StylesheetExecutionContext;
class StylesheetRoot;
class TraceListener;
+class XalanDocument;
+class XalanElement;
+class XalanNode;
class XMLParserLiaison;
class XObject;
class XObjectFactory;
@@ -96,16 +106,12 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOMString.hpp>
-
-
/**
* This is an interface for an XSLT Processor engine. It's the responsibility
* of the implementation of the XSLTProcessor interface, collaborating with a
* XMLParserLiaison, the DOM, and the XPath engine, to transform a source tree
* of nodes into a result tree according to instructions and templates
- * specified by a stylesheet tree. The methods process(...) are
+ * specified by a stylesheet tree. The methods process(...) are
* the primary public entry points.
*
* If you reuse the processor instance, you should call reset() between calls.
@@ -114,7 +120,7 @@
{
public:
- XSLTProcessor();
+ XSLTProcessor();
virtual
~XSLTProcessor();
@@ -122,12 +128,12 @@
/**
* Transform the source tree to the output in the given result tree target.
*
- * @param inputSource input source, may be null
- * @param stylesheetSource stylesheet source, may be null if source
- * has a xml-stylesheet PI
- * @param outputTarget output source tree
+ * @param inputSource input source, may be null
+ * @param stylesheetSource stylesheet source, may be null if source
+ * has a xml-stylesheet PI
+ * @param outputTarget output source tree
* @param constructionContext context for construction of objects
- * @param executionContext current execution context
+ * @param executionContext current execution context
* @exception XSLProcessorException
*/
virtual void
@@ -136,13 +142,13 @@
XSLTInputSource* stylesheetSource,
XSLTResultTarget& outputTarget,
StylesheetConstructionContext& constructionContext,
- StylesheetExecutionContext& executionContext) = 0;
+ StylesheetExecutionContext& executionContext) = 0;
/**
* Given a stylesheet input source, compile the stylesheet into an internal
* representation. This will delete any existing stylesheet root.
*
- * @param stylesheetSource input source for the stylesheet
+ * @param stylesheetSource input source for the stylesheet
* @param constructionContext context for construction of objects
* @return pointer to the compiled stylesheet object
* @exception XSLProcessorException
@@ -163,32 +169,41 @@
*/
virtual StylesheetRoot*
processStylesheet(
- const DOMString& xsldocURLString,
+ const XalanDOMString& xsldocURLString,
StylesheetConstructionContext& constructionContext) = 0;
/**
* Reset the state. This needs to be called after a process() call
* is invoked, if the processor is to be used again.
*/
- virtual void reset() = 0;
+ virtual void
+ reset() = 0;
/**
+ * Get a factory for creating new target nodes.
+ *
+ * @return The factory
+ */
+ virtual XalanDocument*
+ getDOMFactory() const = 0;
+
+ /**
* Given an input source, get the source tree.
*
* @param inputSource pointer to input source
* @return source tree
*/
- virtual const DOM_Node getSourceTreeFromInput(XSLTInputSource* inputSource) = 0;
+ virtual XalanNode*
+ getSourceTreeFromInput(XSLTInputSource* inputSource) = 0;
/**
- * Output an object to the result tree by doing the right conversions.
- * This is public for access by extensions.
- *
- * @param obj the XObject to output
- */
+ * Output an object to the result tree by doing the right conversions.
+ * This is public for access by extensions.
+ *
+ * @param obj the XObject to output
+ */
virtual void
- outputToResultTree(
- const XObject& xobj) = 0;
+ outputToResultTree(const XObject& xobj) = 0;
/**
* Retrieve a top level variable corresponding to name.
@@ -197,26 +212,26 @@
* @return pointer to XObject for variable
*/
virtual XObject*
- getTopLevelVariable(const DOMString& theName) const = 0;
+ getTopLevelVariable(const XalanDOMString& theName) const = 0;
/**
* Reset the state of execution to node 'xmlNode' in source tree
* 'sourceTree.'
*
* @param sourceTree source tree for execution
- * @param xmlNode node to execute
+ * @param xmlNode node to execute
*/
virtual void
resetCurrentState(
- const DOM_Node& sourceTree,
- const DOM_Node& xmlNode) = 0;
+ XalanNode* sourceTree,
+ XalanNode* xmlNode) = 0;
/**
* Retrieve root document for stylesheet.
*
* @return root document
*/
- virtual DOM_Document
+ virtual XalanDocument*
getRootDoc() const = 0;
/**
@@ -225,26 +240,42 @@
* @param doc root document
*/
virtual void
- setRootDoc(const DOM_Document& doc) = 0;
+ setRootDoc(XalanDocument* doc) = 0;
/**
+ * Retrieve the root stylesheet.
+ *
+ * @return pointer to root stylesheet
+ */
+ virtual StylesheetRoot*
+ getStylesheetRoot() const = 0;
+
+ /**
+ * Set the root stylesheet.
+ *
+ * @param theStylesheet pointer to new root stylesheet
+ */
+ virtual void
+ setStylesheetRoot(StylesheetRoot* theStylesheet) = 0;
+
+ /**
* Evaluates attribute values for attribute templates (Stuff in curly {}
* braces that hold expressions).
*
- * @param contextNode current node in the source tree
+ * @param contextNode current node in the source tree
* @param namespaceContext current namespace context for the
- * pattern-by-example structures when parsing
- * expressions
+ * 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 DOMString
+ virtual XalanDOMString
evaluateAttrVal(
- const DOM_Node& contextNode,
- const DOM_Element& namespaceContext,
- const DOMString& stringedValue,
+ XalanNode* contextNode,
+ const XalanElement& namespaceContext,
+ const XalanDOMString& stringedValue,
XPathExecutionContext& executionContext) = 0;
/**
@@ -252,18 +283,18 @@
* contents. Caller owns the memory.
*
* @param templateChild template element that holds the fragment
- * @param sourceTree source tree document context
- * @param sourceNode current source context node
- * @param mode mode under which the template is operating
+ * @param sourceTree source tree document context
+ * @param sourceNode current source context node
+ * @param mode mode under which the template is operating
* @return pointer to an object that represents the result tree fragment
* @exception XSLProcessorException
*/
virtual ResultTreeFragBase*
createResultTreeFrag(
- StylesheetExecutionContext& executionContext,
+ StylesheetExecutionContext& executionContext,
const ElemTemplateElement& templateChild,
- const DOM_Node& sourceTree,
- const DOM_Node& sourceNode,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode,
const QName& mode) = 0;
/**
@@ -293,7 +324,7 @@
*
* @return unique namespace prefix
*/
- virtual const DOMString
+ virtual const XalanDOMString
getUniqueNSValue() const = 0;
/**
@@ -304,7 +335,7 @@
* @return pointer to XObject
*/
virtual XObject*
- createXResultTreeFrag(const ResultTreeFragBase& r) const = 0;
+ createXResultTreeFrag(const ResultTreeFragBase& r) const = 0;
/**
* Given a name, locate a variable in the current context, and return
@@ -329,15 +360,15 @@
/**
* Push a named variable onto the processor variable stack
*
- * @param name name of variable
- * @param var pointer to XObject value
+ * @param name name of variable
+ * @param var pointer to XObject value
* @param element element marker for variable
*/
virtual void
pushVariable(
const QName& name,
XObject* var,
- const DOM_Node& element) = 0;
+ const XalanNode* element) = 0;
/**
* Push a top-level stylesheet parameter. This value can be evaluated via
@@ -348,8 +379,8 @@
*/
virtual void
setStylesheetParam(
- const DOMString& key,
- XObject* value) = 0;
+ const XalanDOMString& key,
+ XObject* value) = 0;
/**
* Push a top-level stylesheet parameter. This value can be evaluated via
@@ -359,30 +390,8 @@
* @param expression expression that will be evaluated
*/
virtual void setStylesheetParam(
- const DOMString& key,
- const DOMString& expression) = 0;
-
- /**
- * Given a valid element key, return the corresponding node list.
- *
- * @param doc source document
- * @param name name of the key, which must match the 'name'
- * attribute on xsl:key
- * @param ref value that must match the value found by the
- * 'match' attribute on xsl:key
- * @param resolver resolver for namespace resolution
- * @param executionContext current execution context
- * @return if the name was not declared with xsl:key, this will return
- * null, if the identifier is not found, it will return an empty
- * node set, otherwise it will return a nodeset of nodes.
- */
- virtual const NodeRefListBase*
- getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const = 0;
+ const XalanDOMString& key,
+ const XalanDOMString& expression) = 0;
/**
* Tells, through the combination of the default-space attribute on
@@ -395,53 +404,59 @@
* @return true if the text node should be stripped of extra whitespace
*/
virtual bool
- shouldStripSourceNode(const DOM_Node& textNode) const = 0;
+ shouldStripSourceNode(const XalanNode& textNode) const = 0;
/**
* Get the current formatter listener.
*
* @return pointer to formatter listener
*/
- virtual FormatterListener* getFormatterListener() const = 0;
+ virtual FormatterListener*
+ getFormatterListener() const = 0;
/**
* Set the current formatter listener.
*
* @param flistener pointer to new formatter listener
*/
- virtual void setFormatterListener(FormatterListener* flistener) = 0;
+ virtual void
+ setFormatterListener(FormatterListener* flistener) = 0;
/**
* Add a trace listener for the purposes of debugging and diagnosis.
*
* @param tl pointer to listener to add
*/
- virtual void addTraceListener(TraceListener* tl) = 0;
+ virtual void
+ addTraceListener(TraceListener* tl) = 0;
/**
* If this is set to true, simple traces of template calls are made.
*
* @param b true to make traces of template calls
*/
- virtual void setTraceTemplates(bool b) = 0;
+ virtual void
+ setTraceTemplates(bool b) = 0;
/**
* If this is set to true, simple traces of select calls are made.
*
* @param b true to make traces of select calls
*/
- virtual void setTraceSelect(bool b) = 0;
+ virtual void
+ setTraceSelect(bool b) = 0;
/**
* If this is set to true, debug diagnostics about
* template children as they are being constructed
* will be written to the m_diagnosticsPrintWriter
- * stream. diagnoseTemplateChildren is false by
+ * stream. diagnoseTemplateChildren is false by
* default.
*
* @param b true to make traces of template children construction
*/
- virtual void setTraceTemplateChildren(bool b) = 0;
+ virtual void
+ setTraceTemplateChildren(bool b) = 0;
/**
* If the quietConflictWarnings property is set to
@@ -451,15 +466,17 @@
*
* @param b true if conflict warnings should be suppressed.
*/
- virtual void setQuietConflictWarnings(bool b) = 0;
+ virtual void
+ setQuietConflictWarnings(bool b) = 0;
/**
* Remove a trace listener.
*
* @param tl Trace listener to be removed.
*/
- virtual void removeTraceListener(TraceListener* tl) = 0;
-
+ virtual void
+ removeTraceListener(TraceListener* tl) = 0;
+
// @@TODO: what to do about output stream ??
/*
* If this is set, diagnostics will be
@@ -467,7 +484,7 @@
* the value is null, then diagnostics will be turned
* off.
*/
-// virtual void setDiagnosticsOutput(java.io.OutputStream out) = 0;
+// virtual void setDiagnosticsOutput(java.io.OutputStream out) = 0;
/**
* If this is set, diagnostics will be
@@ -476,13 +493,52 @@
* off.
*
* @param pw pointer to print writer
+ */
+ virtual void
+ setDiagnosticsOutput(PrintWriter* pw) = 0;
+
+ /**
+ * Give the user a message.
+ *
+ * @param msg text of message to output
+ * @param sourceNode node in source where message occurred
+ * @param styleNode node in stylesheet where message occurred
*/
- virtual void setDiagnosticsOutput(PrintWriter* pw) = 0;
+ virtual void
+ message(
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const = 0;
+ /**
+ * Tell the user of an warning, and probably throw an exception.
+ *
+ * @param msg text of message to output
+ * @param sourceNode node in source where error occurred
+ * @param styleNode node in stylesheet where error occurred
+ * @exception XSLProcessorException
+ */
+ virtual void
+ warn(
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const = 0;
+
+ /**
+ * Tell the user of an error, and probably throw an exception.
+ *
+ * @param msg text of message to output
+ * @param sourceNode node in source where error occurred
+ * @param styleNode node in stylesheet where error occurred
+ * @exception XSLProcessorException
+ */
+ virtual void
+ error(
+ const XalanDOMString& msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const = 0;
};
-#endif // XALAN_XSLTPROCESSOR_HEADER_GUARD
-/*
- * $ Log: $
- */
+
+#endif // XALAN_XSLTPROCESSOR_HEADER_GUARD
1.6 +257 -60 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp
Index: XSLTProcessorEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTProcessorEnvSupportDefault.cpp 2000/03/22 19:56:27 1.5
+++ XSLTProcessorEnvSupportDefault.cpp 2000/04/11 15:09:31 1.6
@@ -58,21 +58,41 @@
-#include <iostream>
+#include <algorithm>
+
#include <util/XMLURL.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/STLHelper.hpp>
+
+
+
+#include <XPath/ElementPrefixResolverProxy.hpp>
+#include <XPath/XPathExecutionContext.hpp>
+
+
+
#include <XMLSupport/XMLParserLiaison.hpp>
+
+
+#include "KeyTable.hpp"
#include "StylesheetRoot.hpp"
#include "XSLTProcessor.hpp"
#include "XSLTInputSource.hpp"
+
XSLTProcessorEnvSupportDefault::XSLTProcessorEnvSupportDefault(XSLTProcessor* theProcessor) :
- XPathEnvSupportDefault(),
- m_processor(theProcessor)
+ XSLTProcessorEnvSupport(),
+ m_defaultSupport(),
+ m_processor(theProcessor),
+ m_keyTables(),
+ m_xlocatorTable()
{
}
@@ -80,80 +100,259 @@
XSLTProcessorEnvSupportDefault::~XSLTProcessorEnvSupportDefault()
{
+ reset();
+}
+
+
+
+void
+XSLTProcessorEnvSupportDefault::reset()
+{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
+ // Clean up the key table vector
+ for_each(m_keyTables.begin(),
+ m_keyTables.end(),
+ makeMapValueDeleteFunctor(m_keyTables));
+
+ m_keyTables.clear();
+
+ m_xlocatorTable.clear();
}
+KeyTable*
+XSLTProcessorEnvSupportDefault::getKeyTable(const XalanNode* doc) const
+{
+ const KeyTablesTableType::const_iterator i =
+ m_keyTables.find(doc);
+
+ if (i == m_keyTables.end())
+ {
+ return 0;
+ }
+ else
+ {
+ return i->second;
+ }
+}
+
+
+
+void
+XSLTProcessorEnvSupportDefault::setKeyTable(
+ KeyTable* keytable,
+ const XalanNode* doc)
+{
+ // Get rid of any existing keytable
+ delete m_keyTables[doc];
+
+ m_keyTables[doc] = keytable;
+}
+
+
+
const NodeRefListBase*
XSLTProcessorEnvSupportDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver,
XPathExecutionContext& executionContext) const
{
if (m_processor == 0)
{
- return XPathEnvSupportDefault::getNodeSetByKey(doc,
- name,
- ref,
- resolver,
- executionContext);
+ return m_defaultSupport.getNodeSetByKey(doc,
+ name,
+ ref,
+ resolver,
+ executionContext);
}
else
{
- return m_processor->getNodeSetByKey(doc,
- name,
- ref,
- resolver,
- executionContext);
+ const NodeRefListBase* nl = 0;
+
+ const Stylesheet* const theStylesheet =
+ m_processor->getStylesheetRoot();
+
+ if (theStylesheet != 0)
+ {
+ // $$$ ToDo: Figure out this const stuff!!!
+ nl = theStylesheet->getNodeSetByKey(&const_cast<XalanNode&>(doc),
+ name,
+ ref,
+ resolver,
+ executionContext,
+#if defined(XALAN_NO_MUTABLE)
+ (KeysTableType&)m_keyTables);
+#else
+ m_keyTables);
+#endif
+ }
+
+ if(0 == nl)
+ {
+ m_processor->error(XalanDOMString("There is no xsl:key declaration for '") + name + XalanDOMString("'!"));
+ }
+
+ return nl;
}
}
+
+
-DOM_Document
+XObject*
+XSLTProcessorEnvSupportDefault::getVariable(
+ XObjectFactory& factory,
+ const QName& name) const
+{
+ if (m_processor == 0)
+ {
+ return m_defaultSupport.getVariable(factory,
+ name);
+ }
+ else
+ {
+ return m_processor->getVariable(name);
+ }
+}
+
+
+
+XalanDocument*
XSLTProcessorEnvSupportDefault::parseXML(
- const DOMString& urlString,
- const DOMString& base) const
+ const XalanDOMString& urlString,
+ const XalanDOMString& base)
{
if (m_processor == 0)
{
- return XPathEnvSupportDefault::parseXML(urlString, base);
+ return m_defaultSupport.parseXML(urlString, base);
}
else
{
XMLParserLiaison& parserLiaison = m_processor->getXMLParserLiaison();
- XMLURL xslURL(c_wstr(base), c_wstr(urlString));
- XSLTInputSource inputSource(xslURL.getURLText());
- return parserLiaison.parseXMLStream(inputSource);
+
+ const XMLURL xslURL(c_wstr(base), c_wstr(urlString));
+
+ const XMLCh* const urlText = xslURL.getURLText();
+
+ XSLTInputSource inputSource(urlText);
+
+ XalanDocument* theDocument =
+ parserLiaison.parseXMLStream(inputSource);
+
+ setSourceDocument(urlText, theDocument);
+
+ return theDocument;
}
}
-XObject*
-XSLTProcessorEnvSupportDefault::getVariable(
- XObjectFactory& factory,
- const QName& name) const
+XalanDocument*
+XSLTProcessorEnvSupportDefault::getSourceDocument(const XalanDOMString& theURI) const
+{
+ return m_defaultSupport.getSourceDocument(theURI);
+}
+
+
+
+void
+XSLTProcessorEnvSupportDefault::setSourceDocument(
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument)
+{
+ m_defaultSupport.setSourceDocument(theURI, theDocument);
+}
+
+
+
+XalanDOMString
+XSLTProcessorEnvSupportDefault::findURIFromDoc(const XalanDocument* owner) const
{
+ return m_defaultSupport.findURIFromDoc(owner);
+}
+
+
+
+XalanDocument*
+XSLTProcessorEnvSupportDefault::getDOMFactory() const
+{
if (m_processor == 0)
{
- return XPathEnvSupportDefault::getVariable(factory,
- name);
+ return m_defaultSupport.getDOMFactory();
}
else
{
- return m_processor->getVariable(name);
+ return m_processor->getDOMFactory();
}
}
bool
-XSLTProcessorEnvSupportDefault::shouldStripSourceNode(const DOM_Node& node) const
+XSLTProcessorEnvSupportDefault::functionAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const
{
+ return m_defaultSupport.functionAvailable(theNamespace,
+ extensionName);
+}
+
+
+
+XObject*
+XSLTProcessorEnvSupportDefault::extFunction(
+ XPathExecutionContext& executionContext,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec) const
+{
+ return m_defaultSupport.extFunction(executionContext,
+ theNamespace,
+ extensionName,
+ argVec);
+}
+
+
+
+XLocator*
+XSLTProcessorEnvSupportDefault::getXLocatorFromNode(const XalanNode* node) const
+{
+ const XLocatorTableType::const_iterator i =
+ m_xlocatorTable.find(node);
+
+ if (i == m_xlocatorTable.end())
+ {
+ return 0;
+ }
+ else
+ {
+ return i->second;
+ }
+}
+
+
+
+void
+XSLTProcessorEnvSupportDefault::associateXLocatorToNode(
+ const XalanNode* node,
+ XLocator* xlocator)
+{
+ m_xlocatorTable[node] = xlocator;
+}
+
+
+
+bool
+XSLTProcessorEnvSupportDefault::shouldStripSourceNode(const XalanNode& node) const
+{
if (m_processor == 0)
{
- return XPathEnvSupportDefault::shouldStripSourceNode(node);
+ return m_defaultSupport.shouldStripSourceNode(node);
}
else
{
@@ -165,42 +364,40 @@
bool
XSLTProcessorEnvSupportDefault::problem(
- eSource /* where */,
- eClassification classification,
- const DOM_Node& /* styleNode */,
- const DOM_Node& /* sourceNode */,
- const DOMString& msg,
- int lineNo,
- int charOffset) const
-{
- std::cerr << msg
- << ", at line number "
- << static_cast<long>(lineNo)
- << " at offset "
- << static_cast<long>(charOffset)
- << std::endl;
-
- return classification == XPathEnvSupport::eError ? true : false;
+ eSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ int lineNo,
+ int charOffset) const
+{
+ return m_defaultSupport.problem(where,
+ classification,
+ styleNode,
+ sourceNode,
+ msg,
+ lineNo,
+ charOffset);
}
bool
XSLTProcessorEnvSupportDefault::problem(
- eSource /* where */,
+ eSource where,
eClassification classification,
- const PrefixResolver* /* resolver */,
- const DOM_Node& /* sourceNode */,
- const DOMString& msg,
+ const PrefixResolver* resolver,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
int lineNo,
int charOffset) const
{
- std::cerr << msg
- << ", at line number "
- << static_cast<long>(lineNo)
- << " at offset "
- << static_cast<long>(charOffset)
- << std::endl;
-
- return classification == XPathEnvSupport::eError ? true : false;
+ return m_defaultSupport.problem(where,
+ classification,
+ resolver,
+ sourceNode,
+ msg,
+ lineNo,
+ charOffset);
}
1.6 +97 -25 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp
Index: XSLTProcessorEnvSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTProcessorEnvSupportDefault.hpp 2000/03/21 15:38:06 1.5
+++ XSLTProcessorEnvSupportDefault.hpp 2000/04/11 15:09:31 1.6
@@ -64,18 +64,26 @@
+#include <map>
+
+
+
// Base class header file...
+#include <XSLT/XSLTProcessorEnvSupport.hpp>
+#include <XSLT/Stylesheet.hpp>
+
+
+
#include <XPath/XPathEnvSupportDefault.hpp>
+class KeyTable;
class XSLTProcessor;
-// Specializaton of XPathEnvSupportDefault, which implements calls that
-// XPathEnvSupportDefault can't really do.
-class XALAN_XSLT_EXPORT XSLTProcessorEnvSupportDefault : public XPathEnvSupportDefault
+class XALAN_XSLT_EXPORT XSLTProcessorEnvSupportDefault : public XSLTProcessorEnvSupport
{
public:
@@ -94,50 +102,100 @@
{
m_processor = theProcessor;
}
+
+
+ // These interfaces are inherited from XSLTProcessorEnvSupport...
+
+ virtual KeyTable*
+ getKeyTable(const XalanNode* doc) const;
- // These interfaces are inherited from XPathEnvSupportDefault...
+ virtual void
+ setKeyTable(
+ KeyTable* keytable,
+ const XalanNode* doc);
+ // These interfaces are inherited from XPathEnvSupport...
+
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver,
XPathExecutionContext& executionContext) const;
-
- virtual DOM_Document
- parseXML(
- const DOMString& urlString,
- const DOMString& base) const;
- XObject*
+ virtual XObject*
getVariable(
XObjectFactory& factory,
const QName& name) const;
+ virtual XalanDocument*
+ parseXML(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base);
+
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const;
+
+ virtual void
+ setSourceDocument(
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument);
+
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const;
+
+ virtual XalanDocument*
+ getDOMFactory() const;
+
+ virtual bool
+ functionAvailable(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const;
+
+ virtual XObject*
+ extFunction(
+ XPathExecutionContext& executionContext,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec) const;
+
+ virtual XLocator*
+ getXLocatorFromNode(const XalanNode* node) const;
+
+ virtual void
+ associateXLocatorToNode(
+ const XalanNode* node,
+ XLocator* xlocator);
+
+ virtual bool
+ shouldStripSourceNode(const XalanNode& node) const;
+
virtual bool
problem(
- eSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- int lineNo,
- int charOffset) const;
+ eSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ int lineNo,
+ int charOffset) const;
virtual bool
problem(
eSource where,
eClassification classification,
const PrefixResolver* resolver,
- const DOM_Node& sourceNode,
- const DOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
int lineNo,
int charOffset) const;
- virtual bool
- shouldStripSourceNode(const DOM_Node& node) const;
+ // These interfaces are inherited from Resettable...
+ virtual void
+ reset();
+
private:
// These are not implemented...
@@ -149,9 +207,23 @@
bool
operator==(const XSLTProcessorEnvSupportDefault&) const;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef map<const XalanNode*, XLocator*> XLocatorTableType;
+#else
+ typedef std::map<const XalanNode*, XLocator*> XLocatorTableType;
+#endif
+
+ typedef Stylesheet::KeyTablesTableType KeyTablesTableType;
+
// Data members...
+
+ XPathEnvSupportDefault m_defaultSupport;
+
+ XSLTProcessor* m_processor;
+
+ mutable KeyTablesTableType m_keyTables;
- XSLTProcessor* m_processor;
+ XLocatorTableType m_xlocatorTable;
};
1.3 +1 -1 xml-xalan/c/src/XSLT/XSLTProcessorException.hpp
Index: XSLTProcessorException.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorException.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTProcessorException.hpp 2000/03/01 20:43:47 1.2
+++ XSLTProcessorException.hpp 2000/04/11 15:09:31 1.3
@@ -82,7 +82,7 @@
*/
XSLTProcessorException(
const DOMString& theMessage,
- const DOMString& theType = DOMString("XSLTProcessorException"));
+ const DOMString& theType = XalanDOMString(XALAN_STATIC_UCODE_STRING("XSLTProcessorException")));
virtual
~XSLTProcessorException();
1.3 +31 -17 xml-xalan/c/src/XSLT/XSLTResultTarget.cpp
Index: XSLTResultTarget.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTResultTarget.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTResultTarget.cpp 2000/03/01 20:43:47 1.2
+++ XSLTResultTarget.cpp 2000/04/11 15:09:31 1.3
@@ -61,9 +61,12 @@
// Base include file. Must be first.
#include "XSLTResultTarget.hpp"
-/**
- * Zero-argument default constructor.
- */
+
+
+#include <cassert>
+
+
+
XSLTResultTarget::XSLTResultTarget() :
m_fileName(),
m_byteStream(0),
@@ -71,45 +74,56 @@
m_characterStream(0),
m_node(),
m_formatterListener(0)
-{ }
+{
+}
+
+
-/**
- * Create a new output target with a file name.
- *
- * @param fileName Must be a valid system file name.
- */
-XSLTResultTarget::XSLTResultTarget (DOMString& fileName) :
+XSLTResultTarget::XSLTResultTarget(const XalanDOMString& fileName) :
m_fileName(fileName),
m_byteStream(0),
m_encoding(),
m_characterStream(0),
m_node(),
m_formatterListener(0)
-{ }
+{
+}
-XSLTResultTarget::XSLTResultTarget (OutputStream* byteStream) :
+
+
+XSLTResultTarget::XSLTResultTarget(OutputStream* byteStream) :
m_fileName(),
m_byteStream(byteStream),
m_encoding(),
m_characterStream(0),
m_node(),
m_formatterListener(0)
-{ }
+{
+ assert(byteStream != 0);
+}
+
-XSLTResultTarget::XSLTResultTarget (Writer* characterStream) :
+
+XSLTResultTarget::XSLTResultTarget(Writer* characterStream) :
m_fileName(),
m_byteStream(0),
m_encoding(),
m_characterStream(characterStream),
m_node(),
m_formatterListener(0)
-{ }
+{
+ assert(characterStream != 0);
+}
+
+
-XSLTResultTarget::XSLTResultTarget (DOM_Node& n) :
+XSLTResultTarget::XSLTResultTarget(XalanNode* n) :
m_fileName(),
m_byteStream(0),
m_encoding(),
m_characterStream(0),
m_node(n),
m_formatterListener(0)
-{ }
+{
+ assert(n != 0);
+}
1.4 +54 -35 xml-xalan/c/src/XSLT/XSLTResultTarget.hpp
Index: XSLTResultTarget.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTResultTarget.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSLTResultTarget.hpp 2000/03/01 20:43:47 1.3
+++ XSLTResultTarget.hpp 2000/04/11 15:09:31 1.4
@@ -64,19 +64,24 @@
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
-#include <sax/DocumentHandler.hpp>
+
+
+#include <XalanDOM/XalanDOMString.hpp>
#include <XMLSupport/FormatterListener.hpp>
+
+
class OutputStream;
+class XalanNode;
class Writer;
+
class XALAN_XSLT_EXPORT XSLTResultTarget
{
public:
+ explicit
XSLTResultTarget();
/**
@@ -84,7 +89,7 @@
*
* @param fileName valid system file name
*/
- XSLTResultTarget (DOMString& fileName);
+ XSLTResultTarget(const XalanDOMString& fileName);
/**
* Create a new output target with a byte stream.
@@ -92,7 +97,7 @@
* @param byteStream pointer to raw byte stream that will contain the
* document
*/
- XSLTResultTarget (OutputStream* byteStream);
+ XSLTResultTarget(OutputStream* byteStream);
/**
* Create a new output target with a character stream.
@@ -100,21 +105,22 @@
* @param characterStream pointer to character stream where the results
* will be written
*/
- XSLTResultTarget (Writer* characterStream);
+ XSLTResultTarget(Writer* characterStream);
/**
* Create a new output target with a DOM node.
*
* @param n root of DOM node tree that holds results
*/
- XSLTResultTarget (DOM_Node& n);
+ XSLTResultTarget(XalanNode* n);
/**
* Set the file name where the results will be written.
*
* @param fileName system identifier as a string
*/
- void setFileName (DOMString& fileName)
+ void
+ setFileName(const XalanDOMString& fileName)
{
m_fileName = fileName;
}
@@ -124,7 +130,8 @@
*
* @return file name string
*/
- DOMString& getFileName ()
+ const XalanDOMString&
+ getFileName() const
{
return m_fileName;
}
@@ -135,7 +142,8 @@
* @param byteStream pointer to byte stream that will contain the result
* document
*/
- void setByteStream (OutputStream* byteStream)
+ void
+ setByteStream(OutputStream* byteStream)
{
m_byteStream = byteStream;
}
@@ -145,7 +153,8 @@
*
* @return pointer to byte stream, or null if none was supplied.
*/
- OutputStream* getByteStream ()
+ OutputStream*
+ getByteStream() const
{
return m_byteStream;
}
@@ -155,7 +164,8 @@
*
* @param encoding new encoding string
*/
- void setEncoding (DOMString& encoding)
+ void
+ setEncoding(const XalanDOMString& encoding)
{
m_encoding = encoding;
}
@@ -165,7 +175,8 @@
*
* @return encoding string, or empty string if none was supplied.
*/
- DOMString& getEncoding ()
+ const XalanDOMString&
+ getEncoding() const
{
return m_encoding;
}
@@ -176,18 +187,19 @@
* @param characterStream pointer to character stream that will contain
* the result document
*/
- void setCharacterStream (Writer* characterStream)
+ void
+ setCharacterStream(Writer* characterStream)
{
m_characterStream = characterStream;
}
-
/**
* Get the character stream for this output target.
*
* @return pointer to character stream, or null if none was supplied.
*/
- Writer* getCharacterStream ()
+ Writer*
+ getCharacterStream()
{
return m_characterStream;
}
@@ -197,7 +209,8 @@
*
* @param node DOM node to contain results
*/
- void setNode (const DOM_Node& node)
+ void
+ setNode(XalanNode* node)
{
m_node = node;
}
@@ -207,7 +220,8 @@
*
* @return DOM node containing results
*/
- DOM_Node& getNode ()
+ XalanNode*
+ getNode() const
{
return m_node;
}
@@ -217,7 +231,8 @@
*
* @param handler pointer to new handler
*/
- void setDocumentHandler (DocumentHandler* handler)
+ void
+ setDocumentHandler(FormatterListener* handler)
{
m_formatterListener = handler;
}
@@ -227,7 +242,8 @@
*
* @return pointer to current handler
*/
- DocumentHandler* getDocumentHandler ()
+ DocumentHandler*
+ getDocumentHandler() const
{
return m_formatterListener;
}
@@ -237,9 +253,10 @@
*
* @param handler pointer to new listener
*/
- void setFormatterListener (FormatterListener* handler)
+ void
+ setFormatterListener(FormatterListener* handler)
{
- m_formatterListener = static_cast<DocumentHandler*>(handler);
+ m_formatterListener = handler;
}
/**
@@ -247,25 +264,27 @@
*
* @return pointer to new listener
*/
- FormatterListener* getFormatterListener ()
+ FormatterListener*
+ getFormatterListener() const
{
- return static_cast<FormatterListener*>(m_formatterListener);
+ return m_formatterListener;
}
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
private:
+
+ XalanDOMString m_fileName;
+
+ OutputStream* m_byteStream;
- DOMString m_fileName;
- OutputStream* m_byteStream;
- DOMString m_encoding;
- Writer* m_characterStream;
- DOM_Node m_node;
- DocumentHandler* m_formatterListener;
+ XalanDOMString m_encoding;
+ Writer* m_characterStream;
+
+ XalanNode* m_node;
+
+ FormatterListener* m_formatterListener;
};
+
+
#endif // XALAN_XSLTRESULTTARGET_HEADER_GUARD