arabica/include/XSLT/impl/xslt_if.hpp

38 lines
816 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-02 23:56:14 +01:00
template<class string_type, class string_adaptor>
2007-07-19 19:01:42 +02:00
class If : public ItemContainer
{
public:
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,
ExecutionContext& context) const
2007-07-19 19:01:42 +02:00
{
ChainStackFrame 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