From c27c94f1a36338dce45563c800eb739ba8157979 Mon Sep 17 00:00:00 2001 From: randomdan Date: Wed, 16 Jan 2013 00:24:35 +0000 Subject: Use the method attribute from the XSLT document to determine the output method --- project2/xml/transformHtml.cpp | 8 +++++++- project2/xml/transformHtml.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/project2/xml/transformHtml.cpp b/project2/xml/transformHtml.cpp index f6a0431..7c784bd 100644 --- a/project2/xml/transformHtml.cpp +++ b/project2/xml/transformHtml.cpp @@ -38,7 +38,12 @@ void HtmlDocument::writeTo(std::ostream & o, const std::string & encoding) const { xmlOutputBufferPtr buf = xmlOutputBufferCreateIO(xmlstrmwritecallback, xmlstrmclosecallback, &o, NULL); - htmlDocContentDumpFormatOutput(buf, doc, encoding.c_str(), 0); + if (method == "html") { + htmlDocContentDumpFormatOutput(buf, doc, encoding.c_str(), 0); + } + else { + xmlNodeDumpOutput(buf, doc, doc->children, 0, 0, encoding.c_str()); + } xmlOutputBufferClose(buf); } @@ -72,6 +77,7 @@ class TransformXmlToHtml : public TransformImpl { throw xmlpp::exception("Failed to perform transformation"); } result->contentType = (char*)(cur.get()->mediaType); + result->method = (char*)(cur.get()->method); } }; diff --git a/project2/xml/transformHtml.h b/project2/xml/transformHtml.h index 0a6c432..cdc8906 100644 --- a/project2/xml/transformHtml.h +++ b/project2/xml/transformHtml.h @@ -15,6 +15,7 @@ class HtmlDocument : public SourceOf, public WritableContent, publ Glib::ustring getContentType() const; void writeTo(std::ostream &, const std::string & encoding) const; Glib::ustring contentType; + Glib::ustring method; }; #endif -- cgit v1.2.3