diff --git a/include/XSLT/impl/xslt_param.hpp b/include/XSLT/impl/xslt_param.hpp index a7edadbf..71bbc4e7 100644 --- a/include/XSLT/impl/xslt_param.hpp +++ b/include/XSLT/impl/xslt_param.hpp @@ -9,7 +9,7 @@ namespace XSLT { template -class Param : public Variable_impl +class Param : public Variable_impl { public: typedef stringT string_type; diff --git a/include/XSLT/impl/xslt_variable.hpp b/include/XSLT/impl/xslt_variable.hpp index 651da041..6f131e1c 100644 --- a/include/XSLT/impl/xslt_variable.hpp +++ b/include/XSLT/impl/xslt_variable.hpp @@ -9,7 +9,7 @@ namespace XSLT { template -class Variable : public Variable_impl +class Variable : public Variable_impl { public: typedef stringT string_type; diff --git a/include/XSLT/impl/xslt_variable_impl.hpp b/include/XSLT/impl/xslt_variable_impl.hpp index 4ce74729..0d864977 100644 --- a/include/XSLT/impl/xslt_variable_impl.hpp +++ b/include/XSLT/impl/xslt_variable_impl.hpp @@ -11,11 +11,19 @@ namespace Arabica namespace XSLT { +template class Variable_impl : public ItemContainer, public Variable_declaration { protected: - Variable_impl(const std::string& name, - const Arabica::XPath::XPathExpressionPtr& select, + typedef Arabica::XPath::XPathExpressionPtr XPathExpressionPtr; + typedef Arabica::XPath::XPathValue XPathValue; + typedef Arabica::XPath::StringValue StringValue; + typedef Arabica::XPath::NodeSetValue NodeSetValue; + typedef Arabica::XPath::NodeSet NodeSet; + typedef DOM::Node DOMNode; + + Variable_impl(const string_type& name, + const XPathExpressionPtr& select, const Precedence& precedence) : name_(name), select_(select), @@ -26,11 +34,11 @@ protected: virtual ~Variable_impl() { } public: - virtual const std::string& name() const { return name_; } + virtual const string_type& name() const { return name_; } - virtual Arabica::XPath::XPathValue value(const DOM::Node& node, - ExecutionContext& context, - DOMSink& sink) const + virtual XPathValue value(const DOMNode& node, + ExecutionContext& context, + DOMSink& sink) const { if(select_) return select_->evaluate(node, context.xpathContext()); @@ -38,20 +46,20 @@ public: execute_children(node, context); if(sink.node() == 0) - return Arabica::XPath::StringValue >::createValue(""); + return StringValue::createValue(""); - Arabica::XPath::NodeSet nodeset; - for(DOM::Node n = sink.node().getFirstChild(); n != 0; n = n.getNextSibling()) + NodeSet nodeset; + for(DOMNode n = sink.node().getFirstChild(); n != 0; n = n.getNextSibling()) nodeset.push_back(n); - return Arabica::XPath::NodeSetValue >::createValue(nodeset); + return NodeSetValue::createValue(nodeset); } // value virtual const Precedence& precedence() const { return precedence_; } private: - std::string name_; - Arabica::XPath::XPathExpressionPtr select_; + string_type name_; + XPathExpressionPtr select_; Precedence precedence_; }; // Variable_impl diff --git a/include/XSLT/impl/xslt_with_param.hpp b/include/XSLT/impl/xslt_with_param.hpp index c117dffa..bac2f401 100644 --- a/include/XSLT/impl/xslt_with_param.hpp +++ b/include/XSLT/impl/xslt_with_param.hpp @@ -9,7 +9,7 @@ namespace XSLT { template -class WithParam : public Variable_impl +class WithParam : public Variable_impl { public: typedef stringT string_type;