summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-01-16 00:24:35 +0000
committerrandomdan <randomdan@localhost>2013-01-16 00:24:35 +0000
commitc27c94f1a36338dce45563c800eb739ba8157979 (patch)
tree5cbf56c12f07bd68b1a1d9d0d34530cce6d887c4
parentAdd transform code to default error stage (diff)
downloadproject2-c27c94f1a36338dce45563c800eb739ba8157979.tar.bz2
project2-c27c94f1a36338dce45563c800eb739ba8157979.tar.xz
project2-c27c94f1a36338dce45563c800eb739ba8157979.zip
Use the method attribute from the XSLT document to determine the output method
-rw-r--r--project2/xml/transformHtml.cpp8
-rw-r--r--project2/xml/transformHtml.h1
2 files changed, 8 insertions, 1 deletions
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<xmlpp::Document, HtmlDocument> {
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<HtmlDocument>, public WritableContent, publ
Glib::ustring getContentType() const;
void writeTo(std::ostream &, const std::string & encoding) const;
Glib::ustring contentType;
+ Glib::ustring method;
};
#endif