2007-07-19 19:01:42 +02:00
|
|
|
#ifndef ARABICA_XSLT_MESSAGE_HPP
|
|
|
|
#define ARABICA_XSLT_MESSAGE_HPP
|
|
|
|
|
|
|
|
#include "xslt_item.hpp"
|
|
|
|
|
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
namespace XSLT
|
|
|
|
{
|
|
|
|
|
2012-11-04 23:34:40 +01:00
|
|
|
template<class stringT, class adaptorT>
|
2012-11-08 17:18:49 +01:00
|
|
|
class Message : public ItemContainer<stringT, adaptorT>
|
2007-07-19 19:01:42 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-11-04 23:34:40 +01:00
|
|
|
typedef stringT string_type;
|
|
|
|
typedef adaptorT string_adaptor;
|
|
|
|
|
2007-07-19 19:01:42 +02:00
|
|
|
Message(bool terminate) :
|
|
|
|
terminate_(terminate)
|
|
|
|
{
|
|
|
|
} // Message
|
|
|
|
|
|
|
|
virtual ~Message() { }
|
|
|
|
|
2012-11-08 18:13:33 +01:00
|
|
|
virtual void execute(const DOM::Node<string_type, string_adaptor>& node, ExecutionContext<string_type, string_adaptor>& context) const
|
2007-07-19 19:01:42 +02:00
|
|
|
{
|
2009-12-15 00:55:56 +01:00
|
|
|
RedirectionFrame toMessageSink(context);
|
2013-01-05 22:26:35 +01:00
|
|
|
this->execute_children(node, context);
|
2007-07-19 19:01:42 +02:00
|
|
|
|
|
|
|
if(terminate_)
|
|
|
|
throw SAX::SAXException("Stylesheet terminated by xsl:message");
|
|
|
|
} // execute
|
|
|
|
|
|
|
|
private:
|
2012-11-04 18:07:41 +01:00
|
|
|
const bool terminate_;
|
2007-11-11 22:31:10 +01:00
|
|
|
|
2009-12-15 00:55:56 +01:00
|
|
|
class RedirectionFrame
|
2007-11-11 22:31:10 +01:00
|
|
|
{
|
|
|
|
public:
|
2012-11-08 18:13:33 +01:00
|
|
|
RedirectionFrame(ExecutionContext<string_type, string_adaptor>& context) : context_(context) { context_.redirectToMessageSink(); }
|
2009-12-15 00:55:56 +01:00
|
|
|
~RedirectionFrame() { context_.revertFromMessageSink(); }
|
2007-11-11 22:31:10 +01:00
|
|
|
|
|
|
|
private:
|
2012-11-08 18:13:33 +01:00
|
|
|
ExecutionContext<string_type, string_adaptor>& context_;
|
2007-11-11 22:31:10 +01:00
|
|
|
|
2009-12-15 00:55:56 +01:00
|
|
|
RedirectionFrame();
|
|
|
|
RedirectionFrame(const RedirectionFrame&);
|
|
|
|
bool operator=(const RedirectionFrame&);
|
|
|
|
}; // class RedirectionFrame
|
2007-07-19 19:01:42 +02:00
|
|
|
}; // class Message
|
|
|
|
|
|
|
|
} // namespace XSLT
|
|
|
|
} // namespace Arabica
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|