arabica/include/XSLT/impl/xslt_text.hpp

49 lines
954 B
C++
Raw Normal View History

2007-07-19 19:01:42 +02:00
#ifndef ARABICA_XSLT_TEXT_HPP
#define ARABICA_XSLT_TEXT_HPP
#include "xslt_item.hpp"
namespace Arabica
{
namespace XSLT
{
2012-11-03 00:00:31 +01:00
template<class string_type, class string_adaptor>
2007-07-19 19:01:42 +02:00
class Text : public Item
{
public:
Text(bool disable_output_escaping) :
disable_(disable_output_escaping)
{
} // Text
2012-11-03 00:00:31 +01:00
Text(const string_type& text) :
2007-07-19 19:01:42 +02:00
text_(text),
disable_(false)
{
} // Text
2012-11-03 00:00:31 +01:00
void set(const string_type& text) { text_ = text; }
2007-07-19 19:01:42 +02:00
2012-11-03 00:00:31 +01:00
virtual void execute(const DOM::Node<string_type, string_adaptor>& /* node */,
ExecutionContext& context) const
2007-07-19 19:01:42 +02:00
{
if(disable_)
context.sink().disableOutputEscaping(true);
context.sink().characters(text_);
if(disable_)
context.sink().disableOutputEscaping(false);
} // execute
private:
2012-11-03 00:00:31 +01:00
string_type text_;
const bool disable_;
2007-07-19 19:01:42 +02:00
}; // class Text
} // namespace XSLT
} // namespace Arabica
#endif