diff --git a/XPath/impl/xpath_function.hpp b/XPath/impl/xpath_function.hpp index d9f53517..e5ba02b4 100644 --- a/XPath/impl/xpath_function.hpp +++ b/XPath/impl/xpath_function.hpp @@ -395,9 +395,10 @@ public: virtual XPathValue* evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { - string_type value = ((baseT::argCount() > 0) ? baseT::argAsString(0, context, executionContext) : nodeStringValue(context)); - typename string_adaptor::const_iterator i = string_adaptor::begin(value), ie = string_adaptor::end(value); - typename string_adaptor::mutable_iterator p = string_adaptor::begin(value), pe = string_adaptor::end(value); + string_type initial = ((baseT::argCount() > 0) ? baseT::argAsString(0, context, executionContext) : nodeStringValue(context)); + std::string value = string_adaptor::asStdString(initial); + std::string::const_iterator i = value.begin(), ie = value.end(); + std::string::iterator p = value.begin(), pe = value.end(); // string leading space while((i != ie) && (XML::is_space(static_cast(*i)))) @@ -415,7 +416,7 @@ public: if(p != ie) *p++ = 0; - return new StringValue(value); + return new StringValue(string_adaptor::construct_from_utf8(value.c_str())); } // evaluate }; // class NormalizeSpaceFn