You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by au...@locus.apache.org on 2000/11/06 20:22:53 UTC

cvs commit: xml-xalan/c/src/XSLT FunctionDocument.cpp FunctionCurrent.cpp FunctionCurrent.hpp FunctionDocument.hpp FunctionElementAvailable.cpp FunctionElementAvailable.hpp FunctionFormatNumber.cpp FunctionFormatNumber.hpp FunctionFunctionAvailable.cpp FunctionFunctionAvailable.hpp FunctionGenerateID.cpp FunctionGenerateID.hpp FunctionKey.cpp FunctionKey.hpp FunctionSystemProperty.cpp FunctionSystemProperty.hpp FunctionUnparsedEntityURI.cpp FunctionUnparsedEntityURI.hpp

auriemma    00/11/06 11:22:44

  Modified:    c/src/XSLT FunctionDocument.cpp FunctionCurrent.cpp
                        FunctionCurrent.hpp FunctionDocument.hpp
                        FunctionElementAvailable.cpp
                        FunctionElementAvailable.hpp
                        FunctionFormatNumber.cpp FunctionFormatNumber.hpp
                        FunctionFunctionAvailable.cpp
                        FunctionFunctionAvailable.hpp
                        FunctionGenerateID.cpp FunctionGenerateID.hpp
                        FunctionKey.cpp FunctionKey.hpp
                        FunctionSystemProperty.cpp
                        FunctionSystemProperty.hpp
                        FunctionUnparsedEntityURI.cpp
                        FunctionUnparsedEntityURI.hpp
  Log:
  Modified XSLT Functions so they are called with a specific number of arguments.
  
  Revision  Changes    Path
  1.17      +135 -110  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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FunctionDocument.cpp	2000/11/02 01:46:27	1.16
  +++ FunctionDocument.cpp	2000/11/06 19:21:16	1.17
  @@ -72,9 +72,6 @@
   
   
   #include <XPath/PrefixResolver.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
  @@ -143,19 +140,16 @@
   
   XObject*
   FunctionDocument::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1,
  +		const XObject*					arg2)
   {
  -	if (args.size() == 0)
  -	{
  -		executionContext.error("The document() function requires at least one argument!",
  -							   context);
  +	assert(arg1 != 0 || arg2 != 0);	
   
  -		return 0;
  -	}
  -	else if (context == 0)
  +	XalanDOMString				base;
  +
  +	if (context == 0)
   	{
   		executionContext.error("The document() function requires a non-null context node!",
   							   context);
  @@ -164,139 +158,162 @@
   	}
   	else
   	{
  -		XalanDocument* const	docContext = XalanNode::DOCUMENT_NODE == context->getNodeType() ?
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -										(XalanDocument*)context :
  -#else
  -										static_cast<XalanDocument*>(context) :
  -#endif
  -											context->getOwnerDocument();
  +		if(XObject::eTypeNodeSet == arg2->getType())
  +		{
  +			const NodeRefListBase&	nodeset = arg2->nodeset();
   
  -		const XObject* const		arg = args[0];
  -		assert(arg != 0);
  +			if (nodeset.getLength() == 0)
  +			{
  +				executionContext.warn("Ignoring the empty node-set provided as the second argument to the function document().",
  +									  context);
   
  -		const XObject::eObjectType	theType = arg->getType();
  +				assert(executionContext.getPrefixResolver() != 0);
   
  -		XalanDOMString				base;
  +				base = executionContext.getPrefixResolver()->getURI();
  +			}
  +			else
  +			{
  +				XalanNode* const	baseNode =	nodeset.item(0);
  +				assert(baseNode != 0);
   
  -		if(args.size() == 1)
  -		{
  -			assert(executionContext.getPrefixResolver() != 0);
  +				XalanDocument* const	baseDoc = XalanNode::DOCUMENT_NODE == baseNode->getNodeType() ?
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +					(XalanDocument*)baseNode :
  +#else
  +					static_cast<XalanDocument*>(baseNode) :
  +#endif
  +					baseNode->getOwnerDocument();
   
  -			base = executionContext.getPrefixResolver()->getURI();
  +				base = executionContext.findURIFromDoc(baseDoc);
  +			}
   		}
   		else
   		{
  -			const XObject* const	arg2 = args[1];
  -			assert(arg2 != 0);
  +			base = arg2->str();
  +		}
  +	}
   
  -			if(XObject::eTypeNodeSet == arg2->getType())
  -			{
  -				const NodeRefListBase&	nodeset = arg2->nodeset();
  +	return execute(executionContext, context, arg1, &base, 2);
  +}
  +
  +
  +
  +XObject*
  +FunctionDocument::execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1)
  +{
  +	assert(arg1 != 0);	
  +
  +	if (context == 0)
  +	{
  +		executionContext.error("The document() function requires a non-null context node!",
  +							   context);
  +
  +		return 0;
  +	}
  +
  +	XalanDOMString				base;
  +
  +	assert(executionContext.getPrefixResolver() != 0);
   
  -				if (nodeset.getLength() == 0)
  -				{
  -					executionContext.warn("Ignoring the empty node-set provided as the second argument to the function document().",
  -										  context);
  +	base = executionContext.getPrefixResolver()->getURI();
  +
  +	return execute(executionContext, context, arg1, &base, 1);
  +}
  +
  +
  +
  +XObject*
  +FunctionDocument::execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg,
  +		XalanDOMString*					base,
  +		int								argCount)
  +{
  +	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
   
  -					assert(executionContext.getPrefixResolver() != 0);
  +	// This list will hold the nodes...
  +	BorrowReturnMutableNodeRefList	mnl(executionContext);
   
  -					base = executionContext.getPrefixResolver()->getURI();
  -				}
  -				else
  -				{
  -					XalanNode* const		baseNode =
  -								nodeset.item(0);
  -					assert(baseNode != 0);
  +	const XObject::eObjectType	theType = arg->getType();
   
  -					XalanDocument* const	baseDoc = XalanNode::DOCUMENT_NODE == baseNode->getNodeType() ?
  +	XalanDocument* const	docContext = XalanNode::DOCUMENT_NODE == context->getNodeType() ?
   #if defined(XALAN_OLD_STYLE_CASTS)
  -													(XalanDocument*)baseNode :
  +			(XalanDocument*)context :
   #else
  -													static_cast<XalanDocument*>(baseNode) :
  +			static_cast<XalanDocument*>(context) :
   #endif
  -														baseNode->getOwnerDocument();
  -
  -					base = executionContext.findURIFromDoc(baseDoc);
  -				}
  -			}
  -			else
  -			{
  -				base = arg2->str();
  -			}
  -		}
  -
  -		typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
  +			context->getOwnerDocument();
   
  -		// This list will hold the nodes...
  -		BorrowReturnMutableNodeRefList	mnl(executionContext);
  +	const unsigned int		nRefs = XObject::eTypeNodeSet == theType ?
  +												arg->nodeset().getLength()
  +												: 1;
   
  -		const unsigned int		nRefs = XObject::eTypeNodeSet == theType ?
  -													arg->nodeset().getLength()
  -													: 1;
  +	for(unsigned int i = 0; i < nRefs; i++)
  +	{
  +		assert(XObject::eTypeNodeSet != theType ||
  +							arg->nodeset().item(i) != 0);
   
  -		for(unsigned int i = 0; i < nRefs; i++)
  +		XalanDOMString	ref = XObject::eTypeNodeSet == theType ?
  +												DOMServices::getNodeData(*arg->nodeset().item(i)) :
  +												arg->str();	
  +
  +		// This is the case where the function was called with
  +		// an empty string, which refers to the stylesheet itself.
  +		if (nRefs == 1 && isEmpty(ref) == true && argCount == 1)
   		{
  -			assert(XObject::eTypeNodeSet != theType ||
  -								arg->nodeset().item(i) != 0);
  +			ref = *base;
  +		}
   
  -			XalanDOMString	ref = XObject::eTypeNodeSet == theType ?
  -													DOMServices::getNodeData(*arg->nodeset().item(i)) :
  -													arg->str();
  +		if(!isEmpty(ref))
  +		{
   
  -			// This is the case where the function was called with
  -			// an empty string, which refers to the stylesheet itself.
  -			if (nRefs == 1 && isEmpty(ref) == true && args.size() == 1)
  +			if(docContext == 0)
   			{
  -				ref = base;
  +				executionContext.error("The context node does not have an owner document!");
   			}
  -
  -			if(!isEmpty(ref))
  -			{
  -				if(docContext == 0)
  -				{
  -					executionContext.error("The context node does not have an owner document!");
  -				}
   
  -				// From http://www.ics.uci.edu/pub/ietf/uri/rfc1630.txt
  -				// A partial form can be distinguished from an absolute form in that the
  -				// latter must have a colon and that colon must occur before any slash
  -				// 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 unsigned int	theLength = length(ref);
  +			// From http://www.ics.uci.edu/pub/ietf/uri/rfc1630.txt
  +			// A partial form can be distinguished from an absolute form in that the
  +			// latter must have a colon and that colon must occur before any slash
  +			// 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 unsigned int	theLength = length(ref);
   
  -				const unsigned int	indexOfColon = indexOf(ref, XalanUnicode::charColon);
  -				unsigned int		indexOfSlash = indexOf(ref, XalanUnicode::charSolidus);
  +			const unsigned int	indexOfColon = indexOf(ref, XalanUnicode::charColon);
  +			unsigned int		indexOfSlash = indexOf(ref, XalanUnicode::charSolidus);
   
   #if defined(WIN32)				
  -				const unsigned int	indexOfBackSlash = indexOf(ref, XalanUnicode::charReverseSolidus);
  +			const unsigned int	indexOfBackSlash = indexOf(ref, XalanUnicode::charReverseSolidus);
   
  -				if(indexOfBackSlash > indexOfSlash && indexOfBackSlash < theLength)
  -				{
  -					indexOfSlash = indexOfBackSlash;
  -				}
  +			if(indexOfBackSlash > indexOfSlash && indexOfBackSlash < theLength)
  +			{
  +				indexOfSlash = indexOfBackSlash;
  +			}
   #endif				
   
  -				if(indexOfColon < theLength && indexOfSlash < theLength && indexOfColon < indexOfSlash)
  -				{
  -					// The url (or filename, for that matter) is absolute.
  -					clear(base);
  -				}
  +			if(indexOfColon < theLength && indexOfSlash < theLength && indexOfColon < indexOfSlash)
  +			{
  +				// The url (or filename, for that matter) is absolute.
  +				clear(*base);
  +			}
   
  -				XalanDocument* const	newDoc = getDoc(executionContext, ref, base);
  +			XalanDocument* const	newDoc = getDoc(executionContext, ref, *base);
   
  -				if(newDoc != 0)
  -				{
  -					mnl->addNodeInDocOrder(newDoc, executionContext);
  -				}
  +			if(newDoc != 0)
  +			{
  +				mnl->addNodeInDocOrder(newDoc, executionContext);
   			}
   		}
  +	}
   
  -		assert(mnl->checkForDuplicates() == false);
  +	assert(mnl->checkForDuplicates() == false);
   
  -		return executionContext.getXObjectFactory().createNodeSet(mnl);
  -	}
  +	return executionContext.getXObjectFactory().createNodeSet(mnl);
   }
   
   
  @@ -309,4 +326,12 @@
   FunctionDocument::clone() const
   {
   	return new FunctionDocument(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionDocument::getError() const
  +{
  +	return "The document() function requires at least one argument!";
   }
  
  
  
  1.6       +11 -19    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionCurrent.cpp	2000/08/14 16:34:43	1.5
  +++ FunctionCurrent.cpp	2000/11/06 19:21:19	1.6
  @@ -58,13 +58,6 @@
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
  -
   FunctionCurrent::FunctionCurrent()
   {
   }
  @@ -79,21 +72,12 @@
   
   XObject*
   FunctionCurrent::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context)
   {
   	assert(executionContext.getCurrentNode() != 0);
  -
  -	if (args.size() != 0)
  -	{
  -		executionContext.error("The current() function does not take any arguments!",
  -							   context);
   
  -		return 0;
  -	}
  -	else if (context == 0)
  +	if (context == 0)
   	{
   		executionContext.error("The current() function is not allowed in patterns!",
   							   context);
  @@ -116,4 +100,12 @@
   FunctionCurrent::clone() const
   {
   	return new FunctionCurrent(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionCurrent::getError() const
  +{
  +	return "The current() function does not take any arguments!";
   }
  
  
  
  1.5       +5 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FunctionCurrent.hpp	2000/04/18 15:28:47	1.4
  +++ FunctionCurrent.hpp	2000/11/06 19:21:22	1.5
  @@ -78,7 +78,7 @@
   
   
   
  -// Implements the XSLT current() function.
  +// Implementation of the XSLT function current().
   //
   class XALAN_XSLT_EXPORT FunctionCurrent : public Function
   {
  @@ -94,9 +94,7 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -106,6 +104,9 @@
   	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionCurrent&
  
  
  
  1.4       +23 -6     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FunctionDocument.hpp	2000/04/11 15:09:27	1.3
  +++ FunctionDocument.hpp	2000/11/06 19:21:25	1.4
  @@ -68,7 +68,7 @@
   
   
   
  -// Implements the XSLT current() function.
  +// Implementation of the XSLT function document().
   //
   class XALAN_XSLT_EXPORT FunctionDocument : public Function
   {
  @@ -80,13 +80,19 @@
   	~FunctionDocument();
   
   	// These methods are inherited from XPath/Function ...
  -	
  +
   	virtual XObject*
   	execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1);
  +
  +	virtual XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,
  +		const XObject*					arg1,		
  +		const XObject*					arg2);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -96,6 +102,17 @@
   	clone() const;
   
   private:
  +
  +	XObject*
  +	execute(
  +			XPathExecutionContext&			executionContext,
  +			XalanNode*						context,			
  +			const XObject*					arg,
  +			XalanDOMString*					base,
  +			int								argCount);
  +
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionDocument&
  
  
  
  1.6       +13 -19    xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp
  
  Index: FunctionElementAvailable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionElementAvailable.cpp	2000/09/19 15:11:53	1.5
  +++ FunctionElementAvailable.cpp	2000/11/06 19:21:27	1.6
  @@ -62,13 +62,6 @@
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
  -
   FunctionElementAvailable::FunctionElementAvailable()
   {
   }
  @@ -83,20 +76,13 @@
   
   XObject*
   FunctionElementAvailable::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						/* context */,			
  +		const XObject*					arg1)
   {
  -	if (args.size() != 1)
  -	{
  -		executionContext.error("The function-available() function takes one argument!",
  -							   context);
  -
  -		return 0;
  -	}
  +	assert(arg1 != 0);
   
  -	const XalanDOMString&	fullName = args[0]->str();
  +	const XalanDOMString&	fullName = arg1->str();
   
   	const unsigned int		nameLength = length(fullName);
   	const unsigned int		indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
  @@ -120,4 +106,12 @@
   FunctionElementAvailable::clone() const
   {
   	return new FunctionElementAvailable(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionElementAvailable::getError() const
  +{
  +	return "The function-available() function takes one argument!";
   }
  
  
  
  1.2       +7 -4      xml-xalan/c/src/XSLT/FunctionElementAvailable.hpp
  
  Index: FunctionElementAvailable.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionElementAvailable.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FunctionElementAvailable.hpp	2000/04/12 22:18:22	1.1
  +++ FunctionElementAvailable.hpp	2000/11/06 19:21:28	1.2
  @@ -78,7 +78,7 @@
   
   
   
  -// Implements the XSLT current() function.
  +// Implementation of the XSLT function element-available.
   //
   class XALAN_XSLT_EXPORT FunctionElementAvailable : public Function
   {
  @@ -94,9 +94,8 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -106,6 +105,10 @@
   	clone() const;
   
   private:
  +	
  +	virtual const XalanDOMString
  +	getError() const;
  +
   
   	// Not implemented...
   	FunctionElementAvailable&
  
  
  
  1.6       +75 -62    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionFormatNumber.cpp	2000/11/02 01:46:27	1.5
  +++ FunctionFormatNumber.cpp	2000/11/06 19:21:30	1.6
  @@ -65,12 +65,6 @@
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   #include "Constants.hpp"
   
   
  @@ -89,72 +83,71 @@
   
   XObject*
   FunctionFormatNumber::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1,
  +		const XObject*					arg2)
   {
  -	const XObjectArgVectorType::size_type	theSize =
  -		args.size();
  +	assert(arg1 != 0 || arg2 != 0);	
  +	
  +	const double						theNumber = arg1->num();
  +	const XalanDOMString&				thePattern = arg2->str();
  +	
  +	const XalanDecimalFormatSymbols*	theDFS = 0;
   
  -	if (theSize < 2 || theSize > 3)
  +	if (theDFS == 0)
   	{
  -		executionContext.error("The format-number() function takes two or three arguments!",
  -							   context);
  -
  -		return 0;
  +		theDFS = executionContext.getDecimalFormatSymbols(Constants::DEFAULT_DECIMAL_FORMAT);
   	}
  -	else
  -	{
  -		assert(args[0] != 0);
  -		assert(args[1] != 0);
  -		assert(theSize == 2 || args[2] != 0);
  -
  -		const double						theNumber = args[0]->num();
  -		const XalanDOMString&				thePattern = args[1]->str();
  -
  -		const XalanDecimalFormatSymbols*	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);
  -		}
  -
  -		const XalanDOMString	theString = doFormat(
  -						executionContext,
  -						context,
  -						theNumber,
  -						thePattern,
  -						theDFS);
   
  -		return executionContext.getXObjectFactory().createString(theString);
  -	}
  +	const XalanDOMString	theString = doFormat(
  +					executionContext,
  +					context,
  +					theNumber,
  +					thePattern,
  +					theDFS);
  +
  +	return executionContext.getXObjectFactory().createString(theString);
   }
   
   
   
  -#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  -Function*
  -#else
  -FunctionFormatNumber*
  -#endif
  -FunctionFormatNumber::clone() const
  +XObject*
  +FunctionFormatNumber::execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1, 
  +		const XObject*					arg2,
  +		const XObject*					arg3)
   {
  -	return new FunctionFormatNumber(*this);
  +	assert(arg1 != 0 || arg2 != 0 || arg3 != 0);
  +	
  +	const double						theNumber = arg1->num();
  +	const XalanDOMString&				thePattern = arg2->str();
  +
  +	const XalanDecimalFormatSymbols*	theDFS = 0;
  +	
  +	const XalanDOMString&				theDecimalFormatName = arg3->str();
  +	assert(length(theDecimalFormatName) != 0);
  +
  +	theDFS = executionContext.getDecimalFormatSymbols(theDecimalFormatName);
  +
  +	if (theDFS == 0)
  +	{
  +		executionContext.warn("format-number:  Specified decimal-format element not found!!!",
  +							  context);		
  +		theDFS = executionContext.getDecimalFormatSymbols(Constants::DEFAULT_DECIMAL_FORMAT);
  +	
  +	}	
  +
  +	const XalanDOMString	theString = doFormat(
  +					executionContext,
  +					context,
  +					theNumber,
  +					thePattern,
  +					theDFS);
  +
  +	return executionContext.getXObjectFactory().createString(theString);
   }
   
   
  @@ -187,4 +180,24 @@
   
   		return theFormatter.format(theNumber);
   	}
  +}
  +
  +
  +
  +#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  +Function*
  +#else
  +FunctionFormatNumber*
  +#endif
  +FunctionFormatNumber::clone() const
  +{
  +	return new FunctionFormatNumber(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionFormatNumber::getError() const
  +{
  +	return "The format-number() function takes two or three arguments!";
   }
  
  
  
  1.6       +15 -4     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionFormatNumber.hpp	2000/05/08 17:29:35	1.5
  +++ FunctionFormatNumber.hpp	2000/11/06 19:21:31	1.6
  @@ -82,7 +82,7 @@
   
   
   
  -// Class that implements the XSLT function format-number.
  +// Implementation of the XSLT function format-number.
   //
   class XALAN_XSLT_EXPORT FunctionFormatNumber : public Function
   {
  @@ -98,10 +98,18 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context,			
  +			const XObject*					arg1,
  +			const XObject*					arg2);
   
  +	virtual XObject*
  +	execute(
  +			XPathExecutionContext&			executionContext,
  +			XalanNode*						context,			
  +			const XObject*					arg1, 
  +			const XObject*					arg2,
  +			const XObject*					arg3);
  +
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
  @@ -120,6 +128,9 @@
   			const XalanDecimalFormatSymbols*	theDFS);
   
   private:
  +
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionFormatNumber&
  
  
  
  1.6       +13 -17    xml-xalan/c/src/XSLT/FunctionFunctionAvailable.cpp
  
  Index: FunctionFunctionAvailable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFunctionAvailable.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionFunctionAvailable.cpp	2000/09/19 15:11:56	1.5
  +++ FunctionFunctionAvailable.cpp	2000/11/06 19:21:33	1.6
  @@ -62,13 +62,6 @@
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
  -
   FunctionFunctionAvailable::FunctionFunctionAvailable()
   {
   }
  @@ -83,18 +76,13 @@
   
   XObject*
   FunctionFunctionAvailable::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						/* context */,			
  +		const XObject*					arg1)
   {
  -	if (args.size() != 1)
  -	{
  -		executionContext.error("The function-available() function takes one argument!",
  -							   context);
  -	}
  +	assert(arg1 != 0);
   
  -	const XalanDOMString&	fullName = args[0]->str();
  +	const XalanDOMString&	fullName = arg1->str();
   
   	const unsigned int		nameLength = length(fullName);
   	const unsigned int		indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
  @@ -118,4 +106,12 @@
   FunctionFunctionAvailable::clone() const
   {
   	return new FunctionFunctionAvailable(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionFunctionAvailable::getError() const
  +{
  +	return "The function-available() function takes one argument!";
   }
  
  
  
  1.2       +6 -4      xml-xalan/c/src/XSLT/FunctionFunctionAvailable.hpp
  
  Index: FunctionFunctionAvailable.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFunctionAvailable.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FunctionFunctionAvailable.hpp	2000/04/12 22:18:22	1.1
  +++ FunctionFunctionAvailable.hpp	2000/11/06 19:21:34	1.2
  @@ -78,7 +78,7 @@
   
   
   
  -// Implements the XSLT current() function.
  +// Implementation of the XSLT function function-available(). 
   //
   class XALAN_XSLT_EXPORT FunctionFunctionAvailable : public Function
   {
  @@ -94,9 +94,8 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -106,6 +105,9 @@
   	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionFunctionAvailable&
  
  
  
  1.5       +40 -17    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FunctionGenerateID.cpp	2000/08/22 20:21:22	1.4
  +++ FunctionGenerateID.cpp	2000/11/06 19:21:36	1.5
  @@ -67,9 +67,6 @@
   
   
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
  @@ -113,28 +110,45 @@
   
   XObject*
   FunctionGenerateID::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1)
   {
  -	XalanNode*	theContext = context;
  +	assert(arg1 != 0);	
   
  -	if (args.size() > 0)
  -	{
  -		const NodeRefListBase&	nl = args[0]->nodeset();
  +	const NodeRefListBase&	theNodeList = arg1->nodeset();
   
  -		if (nl.getLength() > 0)
  -			theContext = nl.item(0);
  -		else
  -			theContext = 0;
  +	if (theNodeList.getLength() > 0)
  +	{
  +		context = theNodeList.item(0);
  +	}
  +	else
  +	{	
  +		context = 0;
   	}
   
  +
  +	return execute(executionContext, context);
  +}
  +
  +
  +
  +XObject*
  +FunctionGenerateID::execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context)
  +{
  +
   	XalanDOMString id;
  +
  +	//if (context == 0)
  +	//{
  +	//	executionContext.error("The generate-id function requires a non-null context node!");
  +	//}
   
  -	if (0 != theContext)
  +	if (context != 0)
   	{
  -		const XalanDOMString	theSuffix = getSuffix(theContext);
  +		const XalanDOMString	theSuffix = getSuffix(context);
   		assert(length(theSuffix) != 0);
   
   		reserve(id, m_prefixLength + length(theSuffix) + 1);
  @@ -157,3 +171,12 @@
   {
   	return new FunctionGenerateID(*this);
   }
  +
  +
  +
  +const XalanDOMString
  +FunctionGenerateID::getError() const
  +{
  +	return "The generate-id function takes zero or one arguments!";
  +}
  +
  
  
  
  1.5       +12 -5     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FunctionGenerateID.hpp	2000/08/10 18:43:06	1.4
  +++ FunctionGenerateID.hpp	2000/11/06 19:21:37	1.5
  @@ -82,14 +82,18 @@
   	~FunctionGenerateID();
   
   	// These methods are inherited from XPath/Function ...
  -	
  +
   	virtual XObject*
   	execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1);
   
  +	virtual XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context);
  +
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
  @@ -98,6 +102,9 @@
   	clone() const;
   
   private:
  +
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionGenerateID&	operator=(const FunctionGenerateID&);
  
  
  
  1.14      +20 -20    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- FunctionKey.cpp	2000/11/02 01:46:27	1.13
  +++ FunctionKey.cpp	2000/11/06 19:21:39	1.14
  @@ -78,11 +78,9 @@
   
   #include <XPath/MutableNodeRefList.hpp>
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
  +
   #if !defined(XALAN_NO_NAMESPACES)
   	using std::set;
   #endif 
  @@ -104,19 +102,14 @@
   
   XObject*
   FunctionKey::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1,
  +		const XObject*					arg2)
   {
  -	if (args.size() != 2)
  -	{
  -		executionContext.error("The key() function takes two arguments!",
  -							   context);
  +	assert(arg1 != 0 || arg2 != 0);	
   
  -		return 0;
  -	}
  -	else if (context == 0)
  +	if (context == 0)
   	{
   		executionContext.error("The key() function requires a non-null context node!",
   							   context);
  @@ -142,13 +135,12 @@
   
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		const XalanDOMString	keyname = args[0]->str();
  +		const XalanDOMString	keyname = arg1->str();
   
  -		const XObject* const	arg = args[1];
  -		assert(arg != 0);
  +		assert(arg2 != 0);
   
   		const bool				argIsNodeSet =
  -				XObject::eTypeNodeSet == arg->getType() ? true : false;
  +				XObject::eTypeNodeSet == arg2->getType() ? true : false;
   
   		typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
   
  @@ -157,7 +149,7 @@
   
   		if(argIsNodeSet == true)
   		{
  -			const NodeRefListBase&	theNodeSet = arg->nodeset();
  +			const NodeRefListBase&	theNodeSet = arg2->nodeset();
   
   			const unsigned int		nRefs = theNodeSet.getLength();
   
  @@ -197,7 +189,7 @@
   		}
   		else
   		{
  -			const XalanDOMString			ref = arg->str();
  +			const XalanDOMString			ref = arg2->str();
   
   					executionContext.getNodeSetByKey(docContext,
   											keyname,
  @@ -220,4 +212,12 @@
   FunctionKey::clone() const
   {
   	return new FunctionKey(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionKey::getError() const
  +{
  +	return "The key() function takes two arguments!";
   }
  
  
  
  1.6       +7 -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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionKey.hpp	2000/04/18 15:28:14	1.5
  +++ FunctionKey.hpp	2000/11/06 19:21:41	1.6
  @@ -92,10 +92,10 @@
   
   	virtual XObject*
   	execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1,
  +		const XObject*					arg2);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -105,6 +105,9 @@
   	clone() const;
   
   private:
  +
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionKey&
  
  
  
  1.12      +13 -14    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FunctionSystemProperty.cpp	2000/11/02 01:46:27	1.11
  +++ FunctionSystemProperty.cpp	2000/11/06 19:21:42	1.12
  @@ -69,9 +69,6 @@
   
   #include <XPath/MutableNodeRefList.hpp>
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
  @@ -90,19 +87,13 @@
   
   XObject*
   FunctionSystemProperty::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						/* context */,			
  +		const XObject*					arg1)
   {
  -	if (args.size() != 1)
  -	{
  -		executionContext.error("The system-property() function takes a single argument!", context);
  -
  -		return 0;
  -	}
  +	assert(arg1 != 0);
   
  -	const XalanDOMString&	fullName = args[0]->str();
  +	const XalanDOMString&	fullName = arg1->str();
   	const unsigned int		fullNameLength = length(fullName);
   	const unsigned int		indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
   
  @@ -173,4 +164,12 @@
   FunctionSystemProperty::clone() const
   {
   	return new FunctionSystemProperty(*this);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionSystemProperty::getError() const
  +{
  +	return "The system-property() function takes a single argument!";
   }
  
  
  
  1.4       +5 -3      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FunctionSystemProperty.hpp	2000/04/11 15:09:27	1.3
  +++ FunctionSystemProperty.hpp	2000/11/06 19:21:44	1.4
  @@ -84,9 +84,8 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -96,6 +95,9 @@
   	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionSystemProperty&
  
  
  
  1.7       +17 -28    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FunctionUnparsedEntityURI.cpp	2000/09/19 15:11:58	1.6
  +++ FunctionUnparsedEntityURI.cpp	2000/11/06 19:21:46	1.7
  @@ -63,12 +63,6 @@
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   FunctionUnparsedEntityURI::FunctionUnparsedEntityURI()
   {
   }
  @@ -81,36 +75,23 @@
   
   
   
  -
  -/**
  - * Execute an XPath function object.  The function must return 
  - * a valid object.
  - * @param path The executing xpath.
  - * @param context The current context.
  - * @param opPos The current op position.
  - * @param args A list of XObject arguments.
  - * @return A valid XObject.
  - */
   XObject*
   FunctionUnparsedEntityURI::execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -{    
  -	if(args.size() != 1)
  -	{
  -		executionContext.error("The unparsed-entity-uri function should take one argument!");
  -	}
  -	else if (context == 0)
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1)
  +{
  +	assert(arg1 != 0);
  +
  +	if (context == 0)
   	{
  -		executionContext.error("The unparser-entity-URI() function requires a non-null context node!",
  +		executionContext.error("The unparsed-entity-uri() function requires a non-null context node!",
   							   context);
   
   		return 0;
   	}
   
  -	const XalanDOMString&	name = (args[0])->str();
  +	const XalanDOMString&	name = arg1->str();
   
   	XalanDocument* const	doc =
   			XalanNode::DOCUMENT_NODE == context->getNodeType() ?
  @@ -125,4 +106,12 @@
   	const XalanDOMString	uri = executionContext.getUnparsedEntityURI(name, *doc);
   
   	return executionContext.getXObjectFactory().createString(uri);
  +}
  +
  +
  +
  +const XalanDOMString
  +FunctionUnparsedEntityURI::getError() const
  +{
  +	return "The unparsed-entity-uri function should take one argument!";
   }
  
  
  
  1.4       +6 -7      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FunctionUnparsedEntityURI.hpp	2000/04/11 15:09:28	1.3
  +++ FunctionUnparsedEntityURI.hpp	2000/11/06 19:21:48	1.4
  @@ -75,11 +75,8 @@
   
   
   
  -// XPath FunctionUnparsedEntityURI implementation.
  +// Implementation of the XSLT function UnparsedEntityURI.
   //
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XSLT_EXPORT FunctionUnparsedEntityURI : public Function
   {
   public:
  @@ -94,9 +91,8 @@
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								opPos,
  -			const XObjectArgVectorType&		args);
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
  @@ -109,6 +105,9 @@
   	}
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionUnparsedEntityURI&