comment handler

This commit is contained in:
Jez Higgins 2012-11-02 22:37:46 +00:00
parent 6c8f6246bf
commit 52f9db8061
3 changed files with 12 additions and 10 deletions

View file

@ -9,23 +9,24 @@ namespace Arabica
namespace XSLT
{
class CommentHandler : public ItemContainerHandler<Comment>
template<class string_type, class string_adaptor>
class CommentHandler : public ItemContainerHandler<Comment<string_type, string_adaptor> >
{
public:
CommentHandler(CompilationContext<std::string>& context) :
ItemContainerHandler<Comment>(context)
CommentHandler(CompilationContext<string_type, string_adaptor>& context) :
ItemContainerHandler<Comment<string_type, string_adaptor> >(context)
{
} // CommentHandler
virtual Comment* createContainer(const std::string& /* namespaceURI */,
const std::string& /* localName */,
const std::string& /* qName */,
const SAX::Attributes<std::string>& atts)
virtual Comment<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)
{
if(atts.getLength() != 0)
throw SAX::SAXException("xsl:comment can not have attributes");
return new Comment();
return new Comment<string_type, string_adaptor>();
} // createContainer
}; // class CommentHandler

View file

@ -143,7 +143,7 @@ const ChildElement* AllowedChildren()
{ "attribute", CreateHandler<AttributeHandler> },
{ "call-template", CreateHandler<CallTemplateHandler> },
{ "choose", CreateHandler<ChooseHandler> },
{ "comment", CreateHandler<CommentHandler> },
{ "comment", CreateHandler<CommentHandler<std::string, Arabica::default_string_adaptor<std::string> > > },
{ "copy", CreateHandler<CopyHandler> },
{ "copy-of", CreateHandler<CopyOfHandler> },
{ "element", CreateHandler<ElementHandler> },

View file

@ -8,13 +8,14 @@ namespace Arabica
namespace XSLT
{
template<class string_type, class string_adaptor>
class Comment : public ItemContainer
{
public:
Comment() { }
virtual ~Comment() { }
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
{
context.sink().start_comment();