From 266b408ee53b9bc7db2b1a5c92e62adfd2af6def Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 26 Jun 2014 20:26:32 +0200 Subject: Implemented basic external "write-file" function * accepts a path parameter and the content to be written * removed target parameter form FunctionTransform ** transformation result is now returned as a string *** nodeset return value is planned ** e.g. writing the result to the fs is optional and has to be achieved using FunctionWriteFile * changed "transform" test case accordingly * this marks a paradigm shift and is the continuation of the changes described in 741a70f ** InputXSLT now also implements a output function * added basic io error handling to FunctionReadFile --- src/function/transform.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/function/transform.cc') diff --git a/src/function/transform.cc b/src/function/transform.cc index 3ab6475..9cf806f 100644 --- a/src/function/transform.cc +++ b/src/function/transform.cc @@ -4,6 +4,8 @@ #include #include +#include + #include "transformation_facade.h" #include "support/xerces_string_guard.h" #include "support/dom/result_node_facade.h" @@ -30,7 +32,6 @@ namespace InputXSLT { xercesc::DOMDocument* FunctionTransform::constructDocument( xalan::XSLTInputSource transformationSource, - boost::filesystem::path targetPath, xalan::XObjectPtr parameterObject ) { xercesc::DOMDocument* const domDocument( @@ -47,22 +48,23 @@ xercesc::DOMDocument* FunctionTransform::constructDocument( ResultNodeFacade result(domDocument, rootNode, "transformation"); - result.setAttribute( - "target", - targetPath.filename().string() - ); - if ( auto transformation = TransformationFacade::try_create( handleErrors(result), transformationSource, this->include_resolver_ ) ) { try { + std::stringstream targetStream; + transformation->generate( - targetPath.string(), + targetStream, parameterObject ); + result.setContent( + targetStream.str() + ); + result.setAttribute("result", "success"); } catch (const ErrorCapacitor::exception& exception) { -- cgit v1.2.3