void ElemAttributeSet::execute(StylesheetExecutionContext& executionContext) const { typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex SetAndRestoreCurrentStackFrameIndex; typedef StylesheetExecutionContext::ElementRecursionStackPusher ElementRecursionStackPusher; // This will push and pop the stack automatically... ElementRecursionStackPusher thePusher(executionContext, this); // Make sure only global variables are visible during execution... SetAndRestoreCurrentStackFrameIndex theSetAndRestore( executionContext, executionContext.getGlobalStackFrameIndex()); ElemUse::execute(executionContext); const ElemTemplateElement* attr = getFirstChildElem(); while(0 != attr) { attr->execute(executionContext); attr = attr->getNextSiblingElem(); } }
void ElemPI::execute(StylesheetExecutionContext& executionContext) const { ElemTemplateElement::execute(executionContext); const StylesheetExecutionContext::GetCachedString theGuard(executionContext); XalanDOMString& piName = theGuard.get(); m_nameAVT->evaluate(piName, *this, executionContext); if (equalsIgnoreCaseASCII( piName, Constants::ATTRVAL_OUTPUT_METHOD_XML) || isValidNCName(piName) == false) { error( executionContext, XalanMessages::PINameInvalid_1Param, piName); } StylesheetExecutionContext::SetAndRestoreCopyTextNodesOnly theSetAndRestore(executionContext, true); childrenToResultPI( executionContext, piName); }
void ElemComment::execute(StylesheetExecutionContext& executionContext) const { ElemTemplateElement::execute(executionContext); StylesheetExecutionContext::SetAndRestoreCopyTextNodesOnly theSetAndRestore(executionContext, true); childrenToResultComment(executionContext); }
void ElemForEach::selectAndSortChildren( StylesheetExecutionContext& executionContext, const ElemTemplateElement* theTemplate, NodeSorter* sorter, int selectStackFrameIndex) const { typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex SetAndRestoreCurrentStackFrameIndex; assert(m_selectPattern != 0); typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList; BorrowReturnMutableNodeRefList theGuard(executionContext); const NodeRefListBase* sourceNodes = 0; XObjectPtr xobjectResult; { SetAndRestoreCurrentStackFrameIndex theSetAndRestore( executionContext, selectStackFrameIndex); xobjectResult = m_selectPattern->execute( *this, executionContext, *theGuard); if (xobjectResult.null() == true) { sourceNodes = &*theGuard; } else { theGuard.release(); sourceNodes = &xobjectResult->nodeset(); } } if(0 != executionContext.getTraceListeners()) { executionContext.fireSelectEvent( SelectionEvent( executionContext, executionContext.getCurrentNode(), *this, StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_selectPattern, *sourceNodes)); } const NodeRefListBase::size_type nNodes = sourceNodes->getLength(); if (nNodes > 0) { // If there's not NodeSorter, or we've only selected one node, // then just do the transform... if (sorter == 0 || nNodes == 1) { transformSelectedChildren( executionContext, theTemplate, *sourceNodes, nNodes); } else { typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex SetAndRestoreCurrentStackFrameIndex; typedef StylesheetExecutionContext::ContextNodeListPushAndPop ContextNodeListPushAndPop; typedef StylesheetExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList; BorrowReturnMutableNodeRefList sortedSourceNodes(executionContext); *sortedSourceNodes = *sourceNodes; { SetAndRestoreCurrentStackFrameIndex theStackFrameSetAndRestore( executionContext, selectStackFrameIndex); ContextNodeListPushAndPop theContextNodeListPushAndPop( executionContext, *sourceNodes); sorter->sort(executionContext, *sortedSourceNodes); } transformSelectedChildren( executionContext, theTemplate, *sortedSourceNodes, nNodes); } } }