xslt: flush xsl:message output as we go

This commit is contained in:
Jez Higgins 2024-09-10 12:09:09 +01:00
parent 8a3ca80b15
commit bbbdcf7593
2 changed files with 8 additions and 2 deletions

View file

@ -72,7 +72,11 @@ public:
return !to_msg_ ? sink_ : message_sink_.asOutput();
} // sink
void redirectToMessageSink() { ++to_msg_; }
void revertFromMessageSink() { --to_msg_; }
void revertFromMessageSink() {
--to_msg_;
if (to_msg_ == 0)
message_sink_.flush();
}
const Arabica::XPath::ExecutionContext<string_type, string_adaptor>& xpathContext() const { return xpathContext_; }

View file

@ -110,11 +110,13 @@ public:
~StreamSink()
{
stream_.flush();
flush();
} // ~StreamSink
virtual Output<string_type, string_adaptor>& asOutput() { return *this; }
void flush() { stream_ << std::endl; }
protected:
typedef typename Output<string_type, string_adaptor>::Settings Settings;