#ifndef ARABICA_XSLT_INLINE_ELEMENT_HPP #define ARABICA_XSLT_INLINE_ELEMENT_HPP #include "xslt_item.hpp" #include namespace Arabica { namespace XSLT { template class InlineAttribute { public: InlineAttribute(const string_type& name, const string_type& name_space, Arabica::XPath::XPathExpressionPtr value) : name_(name), namespace_(name_space), value_(value) { } // InlineAttribute InlineAttribute(const InlineAttribute& rhs) : name_(rhs.name_), namespace_(rhs.namespace_), value_(rhs.value_) { } // InlineAttribute InlineAttribute& operator==(const InlineAttribute& rhs) { name_ = rhs.name_; namespace_ = rhs.namespace_; value_ = rhs.value_; return *this; } // operator== void execute(const DOM::Node& node, ExecutionContext& context) const { context.sink().start_attribute(name_, namespace_); context.sink().characters(value_->evaluateAsString(node, context.xpathContext())); context.sink().end_attribute(); } // execute private: string_type name_; string_type namespace_; Arabica::XPath::XPathExpressionPtr value_; }; // class InlineAttribute template class InlineElement : public ItemContainer { public: typedef stringT string_type; typedef adaptorT string_adaptor; InlineElement(const string_type& name, const string_type& name_space, const std::vector >& attrs) : name_(name), namespace_(name_space), attrs_(attrs) { } // InlineElement virtual ~InlineElement() { } virtual void execute(const DOM::Node& node, ExecutionContext& context) const { if(context.sink().start_element(name_, namespace_)) { for(typename std::vector >::const_iterator a = attrs_.begin(), ae = attrs_.end(); a != ae; ++a) a->execute(node, context); ChainStackFrame frame(context); execute_children(node, context); context.sink().end_element(name_, namespace_); } } // execute private: string_type name_; string_type namespace_; std::vector > attrs_; }; // class InlineElement } // namespace XSLT } // namespace Arabica #endif