dbertoni 00/06/25 17:21:59
Modified: c/src/XPath FunctionLocalName.hpp
Log:
Allow no arguments.
Revision Changes Path
1.6 +20 -8 xml-xalan/c/src/XPath/FunctionLocalName.hpp
Index: FunctionLocalName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLocalName.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FunctionLocalName.hpp 2000/06/01 15:23:59 1.5
+++ FunctionLocalName.hpp 2000/06/26 00:21:59 1.6
@@ -104,21 +104,33 @@
int
/* opPos */,
const XObjectArgVectorType& args)
{
- if(args.size() != 1)
+ const XObjectArgVectorType::size_type theSize =
+ args.size();
+
+ if(theSize > 1)
{
- executionContext.error("The local-name() function takes
one argument!",
+ executionContext.error("The local-name() function takes
zero or one arguments!",
context);
}
- assert(args[0] != 0);
-
- const NodeRefListBase& theNodeList = args[0]->nodeset();
-
XalanDOMString theData;
+
+ if (theSize == 0)
+ {
+ assert(context != 0);
- if (theNodeList.getLength() > 0)
+ theData = executionContext.getLocalNameOfNode(*context);
+ }
+ else
{
- theData =
executionContext.getLocalNameOfNode(*theNodeList.item(0));
+ assert(args[0] != 0);
+
+ const NodeRefListBase& theNodeList =
args[0]->nodeset();
+
+ if (theNodeList.getLength() > 0)
+ {
+ theData =
executionContext.getLocalNameOfNode(*theNodeList.item(0));
+ }
}
return
executionContext.getXObjectFactory().createString(theData);