toplevel param

This commit is contained in:
Jez Higgins 2012-11-06 08:20:10 +00:00
parent 25e0671eb2
commit bbafbf4b63
2 changed files with 16 additions and 14 deletions

View file

@ -273,12 +273,12 @@ private:
void set_parameter(const std::string& name, Value value)
{
params_.push_back(new TopLevelParam("", name, value));
params_.push_back(new TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >("", name, value));
} // set_parameter
void set_parameter(const std::string& namespace_uri, const std::string& name, Value value)
{
params_.push_back(new TopLevelParam(namespace_uri, name, value));
params_.push_back(new TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >(namespace_uri, name, value));
} // set_parameter
private:
@ -316,7 +316,7 @@ private:
typedef std::map<std::string, Template<std::string, Arabica::default_string_adaptor<std::string> >*> NamedTemplates;
typedef std::vector<Item*> VariableDeclList;
typedef std::vector<TopLevelParam*> ParamList;
typedef std::vector<TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >*> ParamList;
TemplateList all_templates_;
NamedTemplates named_templates_;

View file

@ -6,12 +6,13 @@ namespace Arabica
namespace XSLT
{
template<class string_type, class string_adaptor>
class TopLevelParam : public Variable_declaration
{
public:
TopLevelParam(const std::string& namespace_uri,
const std::string& name,
Arabica::XPath::XPathValue<std::string> value) :
TopLevelParam(const string_type& namespace_uri,
const string_type& name,
Arabica::XPath::XPathValue<string_type, string_adaptor> value) :
namespace_uri_(namespace_uri),
name_(name),
value_(value)
@ -25,9 +26,9 @@ public:
context.topLevelParam(null_node, *this);
} // declare
virtual const std::string& namespace_uri() const { return namespace_uri_; }
virtual const std::string& name() const { return name_; }
virtual Arabica::XPath::XPathValue<std::string> value(const DOM::Node<std::string>& /* node */,
virtual const string_type& namespace_uri() const { return namespace_uri_; }
virtual const string_type& name() const { return name_; }
virtual Arabica::XPath::XPathValue<string_type, string_adaptor> value(const DOM::Node<string_type, string_adaptor>& /* node */,
ExecutionContext& /* context */,
DOMSink& /* sink */) const
{
@ -36,13 +37,14 @@ public:
virtual const Precedence& precedence() const { return Precedence::InitialPrecedence(); }
private:
static DOM::Node<std::string> null_node;
std::string namespace_uri_;
std::string name_;
Arabica::XPath::XPathValue<std::string> value_;
static DOM::Node<string_type, string_adaptor> null_node;
string_type namespace_uri_;
string_type name_;
Arabica::XPath::XPathValue<string_type, string_adaptor> value_;
}; // class TopLevelParam
DOM::Node<std::string> TopLevelParam::null_node;
template<class string_type, class string_adaptor>
DOM::Node<string_type, string_adaptor> TopLevelParam<string_type, string_adaptor>::null_node;
} // namespace XSLT
} // namespace Arabica