arabica/include/XSLT/impl/handler/xslt_if_handler.hpp
Jez Higgins 0d3a91876a if
2012-11-02 22:56:14 +00:00

38 lines
1.2 KiB
C++

#ifndef ARABICA_XSLT_IF_HANDLER_HPP
#define ARABICA_XSLT_IF_HANDLER_HPP
#include "../xslt_if.hpp"
#include "xslt_item_container_handler.hpp"
namespace Arabica
{
namespace XSLT
{
template<class string_type, class string_adaptor>
class IfHandler : public ItemContainerHandler<If<string_type, string_adaptor> >
{
public:
IfHandler(CompilationContext<string_type, string_adaptor>& context) :
ItemContainerHandler<If<string_type, string_adaptor> >(context)
{
} // IfHandler
virtual If<string_type, string_adaptor>* createContainer(const string_type& /* namespaceURI */,
const string_type& /* localName */,
const string_type& qName,
const SAX::Attributes<string_type, string_adaptor>& atts)
{
static const ValueRule rules[] = { { "test", true, 0, 0 },
{ 0, false, 0, 0 } };
std::string test = gatherAttributes(qName, atts, rules)["test"];
return new If<string_type, string_adaptor>(ItemContainerHandler<If<string_type, string_adaptor> >::context().xpath_expression(test));
} // startElement
}; // class IfHandler
} // namespace XSLT
} // namespace Arabica
#endif