diff options
author | randomdan <randomdan@localhost> | 2013-01-09 20:30:35 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-01-09 20:30:35 +0000 |
commit | 64826d5da49fe75c99ed77eb8f7ed388bc7bb56a (patch) | |
tree | a27f7a7f201b9ad74cc684fa4462875e7fde79bf | |
parent | Register exslt functions on start up (diff) | |
download | project2-64826d5da49fe75c99ed77eb8f7ed388bc7bb56a.tar.bz2 project2-64826d5da49fe75c99ed77eb8f7ed388bc7bb56a.tar.xz project2-64826d5da49fe75c99ed77eb8f7ed388bc7bb56a.zip |
Add transform code to default error stage
Do xslt transform according to PI, not source value
-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> { |