XObjectPtr FunctionGenerateID::execute( XPathExecutionContext& executionContext, XalanNode* context, const LocatorType* locator) const { if (context == 0) { executionContext.error( XalanMessageLoader::getMessage(XalanMessages::FunctionRequiresNonNullContextNode_1Param,"generate-id()"), context, locator); return XObjectPtr(); } else { XPathExecutionContext::GetAndReleaseCachedString theID(executionContext); theID.get() = XalanUnicode::charLetter_N; getSuffix(context, theID.get()); return executionContext.getXObjectFactory().createString(theID); } }
XObjectPtr Function::execute( XPathExecutionContext& executionContext, XalanNode* context, const XObjectArgVectorType& args, const Locator* locator) const { const XObjectArgVectorType::size_type theArgCount = args.size(); if (theArgCount == 0) { return execute(executionContext, context, locator); } else if (theArgCount == 1) { return execute(executionContext, context, args[0], locator); } else if (theArgCount == 2) { return execute(executionContext, context, args[0], args[1], locator); } else if (theArgCount == 3) { return execute(executionContext, context, args[0], args[1], args[2], locator); } else { generalError( executionContext, context, locator); return XObjectPtr(0); } }
XObjectPtr Function::execute( XPathExecutionContext& executionContext, XalanNode* context, const Locator* locator) const { generalError( executionContext, context, locator); return XObjectPtr(0); }
XObjectPtr FunctionString::execute( XPathExecutionContext& executionContext, XalanNode* context, const LocatorType* locator) const { if (context == 0) { XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext); XalanDOMString& theResult = theGuard.get(); executionContext.error( XalanMessageLoader::getMessage( theResult, XalanMessages::FunctionRequiresNonNullContextNode_1Param, "string"), context, locator); // Dummy return value... return XObjectPtr(); } else { // The XPath standard says that if there are no arguments, // the argument defaults to a node set with the context node // as the only member. The string value of a node set is the // string value of the first node in the node set. // DOMServices::getNodeData() will give us the data. // Get a cached string... XPathExecutionContext::GetAndReleaseCachedString theData(executionContext); XalanDOMString& theString = theData.get(); DOMServices::getNodeData(*context, theString); return executionContext.getXObjectFactory().createString(theData); } }
const XObjectPtr VariablesStack::findXObject( const XalanQName& name, StylesheetExecutionContext& executionContext, bool fIsParam, bool fSearchGlobalSpace, bool& fNameFound) { typedef VariableStackStackType::size_type size_type; // findEntry() returns an index into the stack. We should // _never_ take the address of anything in the stack, since // the address could change at unexpected times. const size_type theEntryIndex = findEntry(name, fIsParam, fSearchGlobalSpace); if (theEntryIndex == m_stack.size()) { fNameFound = false; return XObjectPtr(); } else { assert(theEntryIndex < m_stack.size()); fNameFound = true; assert(m_stack[theEntryIndex].getType() == StackEntry::eVariable || m_stack[theEntryIndex].getType() == StackEntry::eParam || m_stack[theEntryIndex].getType() == StackEntry::eActiveParam); const XObjectPtr& theValue = m_stack[theEntryIndex].getValue(); if (theValue.null() == false) { return theValue; } else { const ElemVariable* const var = m_stack[theEntryIndex].getVariable(); XObjectPtr theNewValue; if (var != 0) { XalanNode* const doc = executionContext.getRootDocument(); assert(doc != 0); XALAN_USING_STD(find) // See if the ElemVariable instance is already being evaluated... if (find(m_guardStack.begin(), m_guardStack.end(), var) != m_guardStack.end()) { const StylesheetExecutionContext::GetCachedString theGuard(executionContext); executionContext.error( XalanMessageLoader::getMessage( theGuard.get(), XalanMessages::CircularVariableDefWasDetected), doc, var->getLocator()); } m_guardStack.push_back(var); #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) executionContext.pushContextMarker(); #else // We need to set up a stack frame for the variable's execution... typedef StylesheetExecutionContext::PushAndPopContextMarker PushAndPopContextMarker; const PushAndPopContextMarker theContextMarkerPushPop(executionContext); #endif theNewValue = var->getValue(executionContext, doc); assert(theNewValue.null() == false); #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) executionContext.popContextMarker(); #endif assert(m_guardStack.empty() == false); m_guardStack.pop_back(); m_stack[theEntryIndex].setValue(theNewValue); m_stack[theEntryIndex].activate(); } return theNewValue; } }
* @param name name of argument * @param expr expression argument represents */ TopLevelArg( const XalanQName& name, const XalanDOMString& expr); /** * Construct an argument object from an XObject instance. * * @param name name of argument * @param variable the XObject instance. */ TopLevelArg( const XalanQName& name = XalanQNameByValue(), const XObjectPtr variable = XObjectPtr()); /** * Copy constructor * * @param theSource the TopLevelArg to copy. */ TopLevelArg(const TopLevelArg& theSource); /** * Destructor */ ~TopLevelArg(); /** * Retrieve object name