diff options
-rw-r--r-- | project2/cgi/cgiStageDefaultError.cpp | 6 | ||||
-rw-r--r-- | project2/xml/transformHtml.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/project2/cgi/cgiStageDefaultError.cpp b/project2/cgi/cgiStageDefaultError.cpp index c5642d5..b8f0b4b 100644 --- a/project2/cgi/cgiStageDefaultError.cpp +++ b/project2/cgi/cgiStageDefaultError.cpp @@ -13,6 +13,12 @@ CgiApplicationEngine::DefaultErrorStage::DefaultErrorStage(const std::exception what(ex.what()), pres(new XmlPresenter(DefaultErrorStageResp, env()->errorTransformStyle, env()->errorContentType)) { + auto xp = dynamic_cast<TransformSource *>(pres.get()); + auto cp = dynamic_cast<ContentPresenter *>(pres.get()); + if (xp && cp && cp->contentType == this->env()->transformContentType) { + auto h = TransformTargetLoader::getFor(this->env()->transformTargetType)->create(root, Default); + xp->addTarget(h, root); + } } CgiApplicationEngine::DefaultErrorStage::~DefaultErrorStage() diff --git a/project2/xml/transformHtml.cpp b/project2/xml/transformHtml.cpp index 0348c87..f6a0431 100644 --- a/project2/xml/transformHtml.cpp +++ b/project2/xml/transformHtml.cpp @@ -59,7 +59,7 @@ class TransformXmlToHtml : public TransformImpl<xmlpp::Document, HtmlDocument> { { xmlpp::Document * data = const_cast<xmlpp::Document *>(cdata); typedef boost::shared_ptr<xsltStylesheet> XsltStyleSheetPtr; - XsltStyleSheetPtr cur = XsltStyleSheetPtr(xsltParseStylesheetFile(BAD_CAST stylesheet.c_str()), xsltFreeStylesheet); + XsltStyleSheetPtr cur = XsltStyleSheetPtr(xsltLoadStylesheetPI(data->cobj()), xsltFreeStylesheet); if (!cur) { throw xmlpp::exception("Failed to load stylesheet"); } @@ -73,12 +73,6 @@ class TransformXmlToHtml : public TransformImpl<xmlpp::Document, HtmlDocument> { } result->contentType = (char*)(cur.get()->mediaType); } - void configure(ScriptNodePtr e) - { - stylesheet = e->value("style").as<Glib::ustring>(); - } - private: - Glib::ustring stylesheet; }; class XmlTransformLoader : public TransformLoader::For<TransformXmlToHtml> { |