arabica/include/XSLT/impl/xslt_if.hpp

41 lines
954 B
C++
Raw Normal View History

2007-07-19 19:01:42 +02:00
#ifndef ARABICA_XSLT_IF_HPP
#define ARABICA_XSLT_IF_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 If : 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;
2012-11-02 23:56:14 +01:00
If(Arabica::XPath::XPathExpressionPtr<string_type, string_adaptor> test) :
2007-07-19 19:01:42 +02:00
test_(test)
{
} // If
virtual ~If() { }
2012-11-02 23:56:14 +01:00
virtual void execute(const DOM::Node<string_type, string_adaptor>& node,
2012-11-08 18:13:33 +01:00
ExecutionContext<string_type, string_adaptor>& context) const
2007-07-19 19:01:42 +02:00
{
2012-11-08 18:13:33 +01:00
ChainStackFrame<string_type, string_adaptor> frame(context);
2007-07-19 19:01:42 +02:00
if(test_->evaluateAsBool(node, context.xpathContext()))
execute_children(node, context);
} // execute
private:
2012-11-02 23:56:14 +01:00
Arabica::XPath::XPathExpressionPtr<string_type, string_adaptor> test_;
2007-07-19 19:01:42 +02:00
}; // class If
} // namespace XSLT
} // namespace Arabica
#endif