mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-28 22:23:21 +01:00
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#ifndef ARABICA_XSLT_MESSAGE_HPP
|
|
#define ARABICA_XSLT_MESSAGE_HPP
|
|
|
|
#include "xslt_item.hpp"
|
|
|
|
namespace Arabica
|
|
{
|
|
namespace XSLT
|
|
{
|
|
|
|
class Message : public ItemContainer
|
|
{
|
|
public:
|
|
Message(bool terminate) :
|
|
terminate_(terminate)
|
|
{
|
|
} // Message
|
|
|
|
virtual ~Message() { }
|
|
|
|
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
|
{
|
|
RedirectionFrame toMessageSink(context);
|
|
execute_children(node, context);
|
|
|
|
if(terminate_)
|
|
throw SAX::SAXException("Stylesheet terminated by xsl:message");
|
|
} // execute
|
|
|
|
private:
|
|
bool terminate_;
|
|
|
|
class RedirectionFrame
|
|
{
|
|
public:
|
|
RedirectionFrame(ExecutionContext& context) : context_(context) { context_.redirectToMessageSink(); }
|
|
~RedirectionFrame() { context_.revertFromMessageSink(); }
|
|
|
|
private:
|
|
ExecutionContext& context_;
|
|
|
|
RedirectionFrame();
|
|
RedirectionFrame(const RedirectionFrame&);
|
|
bool operator=(const RedirectionFrame&);
|
|
}; // class RedirectionFrame
|
|
|
|
|
|
|
|
}; // class Message
|
|
|
|
} // namespace XSLT
|
|
} // namespace Arabica
|
|
|
|
#endif
|
|
|