#ifndef ARABICA_XSLT_ELEMENT_HANDLER_HPP #define ARABICA_XSLT_ELEMENT_HANDLER_HPP #include "../xslt_element.hpp" #include "xslt_item_container_handler.hpp" namespace Arabica { namespace XSLT { template class ElementHandler : public ItemContainerHandler > { typedef ItemContainerHandler > baseT; typedef StylesheetConstant SC; public: ElementHandler(CompilationContext& context) : ItemContainerHandler >(context) { } // ElementHandler protected: virtual Element* createContainer(const string_type& /* namespaceURI */, const string_type& /* localName */, const string_type& qName, const SAX::Attributes& atts) { static const ValueRule rules[] = { { SC::name, true, 0, 0 }, { SC::namespace_, false, string_adaptor::empty_string(), 0 }, { SC::use_attribute_sets, false, 0, 0 }, { string_adaptor::empty_string(), false, 0, 0 } }; std::map attrs = gatherAttributes(qName, atts, rules); Arabica::XPath::XPathExpressionPtr name = baseT::context().xpath_attribute_value_template(attrs[SC::name]); if(attrs[SC::use_attribute_sets] != string_adaptor::empty_string()) throw SAX::SAXException("don't understand use-attribute-sets yet"); if(attrs[SC::namespace_] == string_adaptor::empty_string()) return new Element(name, baseT::context().inScopeNamespaces(), attrs[SC::use_attribute_sets]); return new Element(name, baseT::context().xpath_attribute_value_template(attrs[SC::namespace_]), attrs[SC::use_attribute_sets]); } // createContainer }; // class ElementHandler } // namespace XSLT } // namespace Arabica #endif