From 29a9fb20b4c8414f2590886e43ae86794a53db89 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sun, 20 Apr 2014 13:09:32 +0200 Subject: Implemented support for modifying external function base path * one expects a read-file function to work relative to the directory the transformation is located and not to the executable's location ** from the perspective of the user the transformation is the application, not the actual executable * removed PlattformGuard struct from TransformerGuard (now TransformerFacade) * TransformerFacade is instatiated with the appropriate relative working path ** i.e. it will have to be instantiated for every directory containing one or more transformations --- src/transformer_guard.cc | 67 ------------------------------------------------ 1 file changed, 67 deletions(-) delete mode 100644 src/transformer_guard.cc (limited to 'src/transformer_guard.cc') diff --git a/src/transformer_guard.cc b/src/transformer_guard.cc deleted file mode 100644 index 73bcea2..0000000 --- a/src/transformer_guard.cc +++ /dev/null @@ -1,67 +0,0 @@ -#include "transformer_guard.h" - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include "function/read_file.h" -#include "function/read_xml_file.h" - -namespace InputXSLT { - -TransformerGuard::TransformerGuard(): - plattform_(), - parser_(), - transformer_() { - const xalan::XalanDOMString customNamespace( - "http://ExternalFunction.xalan-c++.xml.apache.org" - ); - - this->transformer_.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-file"), - InputXSLT::FunctionReadFile() - ); - - this->transformer_.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-xml-file"), - InputXSLT::FunctionReadXmlFile() - ); - -} - -int TransformerGuard::execute( - const std::string& transformation, - const std::string& target -) { - xercesc::DOMDocument* inputDom( - xercesc::DOMImplementation::getImplementation()->createDocument() - ); - xalan::XercesDOMSupport domSupport(this->parser_); - - xalan::XercesDOMWrapperParsedSource parsedInput( - inputDom, - this->parser_, - domSupport, - xalan::XalanDOMString("") - ); - - xalan::XSLTInputSource transform(transformation.data()); - xalan::XSLTResultTarget output(target.data()); - - return this->transformer_.transform( - parsedInput, - transform, - output - ); -} - -} -- cgit v1.2.3