Esempio n. 1
0
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();
    }
}
const ElemTemplateElement*
ElemFallback::startElement(StylesheetExecutionContext&      executionContext) const
{
    ElemTemplateElement::startElement(executionContext);

    return getFirstChildElem();
}
void
ElemFallback::execute(StylesheetExecutionContext&       executionContext) const
{
    ElemTemplateElement::execute(executionContext);

    int     thePreviousToken = StylesheetConstructionContext::ELEMNAME_UNDEFINED;

    for (const ElemTemplateElement* child = getFirstChildElem(); child != 0; child = child->getNextSiblingElem())
    {
        const int   theCurrentToken = child->getXSLToken();

        if(theCurrentToken == StylesheetConstructionContext::ELEMNAME_FALLBACK)
        {
            // Don't execute a fallback if it's preceeded by a forward-compatible
            // element.
            if (thePreviousToken != StylesheetConstructionContext::ELEMNAME_FORWARD_COMPATIBLE)
            {
                child->execute(executionContext);
            }
        }
        else
        {
            child->execute(executionContext);
        }

        thePreviousToken = theCurrentToken;
    }
}
Esempio n. 4
0
void
ElemLiteralResult::postConstruction(
			StylesheetConstructionContext&	constructionContext,
			const NamespacesHandler&		theParentHandler)
{
	if (m_avtsCount != 0 ||
		getNamespacesHandler().getNamespaceDeclarationsCount() != 0)
	{
		canGenerateAttributes(true);
	}
	else
	{
		// OK, let's turn this off and see what our
		// base classes say about it when we chain up...
		canGenerateAttributes(false);
	}

	// OK, now we can chain-up...
	ElemUse::postConstruction(constructionContext, theParentHandler);

	// OK, now let's do some more checking to see if we'll
	// generate attributes...
	if (canGenerateAttributes() == false)
	{
		// If there are no children, we can't generate any attributes...
		if (hasChildren() == true)
		{
			assert(getFirstChildElem() != 0);

			// If there's a single text child, or the first child
			// is another LRE, then we won't generate any attributes.
			// Otherwise, we might...
			if (hasSingleTextChild() == false &&
				getFirstChildElem()->getXSLToken() != StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT)
			{
				canGenerateAttributes(true);
			}
		}
	}
}
Esempio n. 5
0
const XObjectPtr
ElemVariable::getValue(
			StylesheetExecutionContext&		executionContext,
			XalanNode*						sourceNode) const
{
	if(m_selectPattern == 0)
	{
		if (getFirstChildElem() == 0)
		{
			return executionContext.getXObjectFactory().createStringReference(s_emptyString);
		}
		else
		{
			return executionContext.createXResultTreeFrag(*this, sourceNode);
		}
	}
	else
	{
		XObjectPtr	theValue;

		XalanNode* const	theCurrentNode = executionContext.getCurrentNode();
		
		if (theCurrentNode == sourceNode)
		{
			theValue = m_selectPattern->execute(*this, executionContext);
		}
		else
		{
			const XPathExecutionContext::CurrentNodePushAndPop	theCurrentNodePushAndPop(executionContext, sourceNode);

			theValue = m_selectPattern->execute(*this, executionContext);
		}

		if(0 != executionContext.getTraceListeners())
		{
			executionContext.fireSelectEvent(
				SelectionEvent(
					executionContext,
					sourceNode,
					*this,
					StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
					*m_selectPattern,
					theValue));
		}

		return theValue;
	}
}
void
ElemExtensionCall::execute(StylesheetExecutionContext&  executionContext) const
{
    ElemTemplateElement::execute(executionContext);

    warn(
        executionContext,
        XalanMessages::XalanHandleExtensions);

    for (const ElemTemplateElement* child = getFirstChildElem(); child != 0; child = child->getNextSiblingElem())
    {
        if(child->getXSLToken() == StylesheetConstructionContext::ELEMNAME_FALLBACK)
        {
            child->execute(executionContext);
        }
    }
}
Esempio n. 7
0
void
ElemElement::doExecuteChildren(
			StylesheetExecutionContext&		executionContext,			
			bool							skipAttributeChildren) const
{
	if (skipAttributeChildren == false)
	{
		// If we should execute all children, then just call
		// executeChildren()...
		executeChildren(executionContext);
	}
	else
	{
		StylesheetExecutionContext::PushAndPopElementFrame	thePushAndPop(executionContext, this);

		for (ElemTemplateElement* node = getFirstChildElem(); node != 0; node = node->getNextSiblingElem()) 
		{
			if (node->getXSLToken() != StylesheetConstructionContext::ELEMNAME_ATTRIBUTE)
			{
				node->execute(executionContext);
			}
		}
	}
}
Esempio n. 8
0
ElemEmpty::~ElemEmpty()
{
	assert(getNextSiblingElem() == 0 && getFirstChildElem() == 0);
}