This commit is contained in:
Jez Higgins 2012-11-04 17:07:41 +00:00
parent 769a5b98a3
commit fc91f0329a
3 changed files with 14 additions and 11 deletions

View file

@ -150,7 +150,7 @@ const ChildElement* AllowedChildren()
{ "fallback", CreateHandler<NotImplementedYetHandler<std::string, Arabica::default_string_adaptor<std::string> > >},
{ "for-each", CreateHandler<ForEachHandler<std::string, Arabica::default_string_adaptor<std::string> > > },
{ "if", CreateHandler<IfHandler<std::string, Arabica::default_string_adaptor<std::string> > > },
{ "message", CreateHandler<MessageHandler>},
{ "message", CreateHandler<MessageHandler<std::string, Arabica::default_string_adaptor<std::string> > >},
{ "number", CreateHandler<NotImplementedYetHandler<std::string, Arabica::default_string_adaptor<std::string> > >},
{ "processing-instruction", CreateHandler<ProcessingInstructionHandler<std::string, Arabica::default_string_adaptor<std::string> > > },
{ "text", CreateHandler<TextHandler<std::string, Arabica::default_string_adaptor<std::string> > > },

View file

@ -9,23 +9,25 @@ namespace Arabica
namespace XSLT
{
class MessageHandler : public ItemContainerHandler<Message>
template<class string_type, class string_adaptor>
class MessageHandler : public ItemContainerHandler<Message<string_type, string_adaptor> >
{
typedef ItemContainerHandler<Message<string_type, string_adaptor> > baseT;
public:
MessageHandler(CompilationContext<std::string>& context) :
ItemContainerHandler<Message>(context)
MessageHandler(CompilationContext<string_type, string_adaptor>& context) :
baseT(context)
{
} // MessageHandler
protected:
virtual Message* createContainer(const std::string& /* namespaceURI */,
const std::string& /* localName */,
const std::string& qName,
const SAX::Attributes<std::string>& atts)
virtual Message<string_type, string_adaptor>* createContainer(const string_type& /* namespaceURI */,
const string_type& /* localName */,
const string_type& qName,
const SAX::Attributes<string_type, string_adaptor>& atts)
{
static const ValueRule rules[] = { { "terminate", false, No, AllowedYesNo },
{ 0, false, 0, 0 } };
return new Message(gatherAttributes(qName, atts, rules)["terminate"] == Yes);
return new Message<string_type, string_adaptor>(gatherAttributes(qName, atts, rules)["terminate"] == Yes);
} // createContainer
}; // class MessageHandler

View file

@ -8,6 +8,7 @@ namespace Arabica
namespace XSLT
{
template<class string_type, class string_adaptor>
class Message : public ItemContainer
{
public:
@ -18,7 +19,7 @@ public:
virtual ~Message() { }
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
virtual void execute(const DOM::Node<string_type, string_adaptor>& node, ExecutionContext& context) const
{
RedirectionFrame toMessageSink(context);
execute_children(node, context);
@ -28,7 +29,7 @@ public:
} // execute
private:
bool terminate_;
const bool terminate_;
class RedirectionFrame
{