#ifndef ARABICA_XSLT_ATTRIBUTE_HANDLER_HPP #define ARABICA_XSLT_ATTRIBUTE_HANDLER_HPP #include "../xslt_attribute.hpp" #include "xslt_item_container_handler.hpp" namespace Arabica { namespace XSLT { template class AttributeHandler : public ItemContainerHandler > { typedef ItemContainerHandler > baseT; typedef StylesheetConstant SC; typedef AttributeValidators AV; public: AttributeHandler(CompilationContext& context) : baseT(context) { } // AttributeHandler protected: virtual Attribute* createContainer(const string_type& /* namespaceURI */, const string_type& /* localName */, const string_type& qName, const SAX::Attributes& atts) { static const AV rules = AV::rule(SC::name, true) .rule(SC::namespace_, false, string_adaptor::empty_string()); std::map attrs = rules.gather(qName, atts); Arabica::XPath::XPathExpressionPtr name = baseT::context().xpath_attribute_value_template(attrs[SC::name]); if(attrs[SC::namespace_] == string_adaptor::empty_string()) return new Attribute(name, baseT::context().inScopeNamespaces()); return new Attribute(name, baseT::context().xpath_attribute_value_template(attrs[SC::namespace_])); } // createContainer }; // class AttributeHandler } // namespace XSLT } // namespace Arabica #endif