From a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 5 Jul 2014 21:55:48 +0200 Subject: Revamped implementation to support FunctionTransform XalanNode input * FunctionTransform now accepts xalan::XalanNode base xalan::XSLTInputSource instances as input parameter ** such xalan::XSLTInputSource instances were already supported for the stylesheet parameter but not for the input parameter ** e.g. it is now possible to generate a DOM inside a transformation, pass the DOM into a embedded transformation as input, modifiy the output of that transformation, pass this modified DOM into another transformation and so on... you get the point * this required a revamp of TransformationFacade ** it is now a transformation independent wrapper for xalan::XalanTransformer *** as such is was renamed to TransformerFacade ** removed error catching template factory method "try_create" as it is not needed anymore ** "std::basic_ostream&" taking "generate" member method overloads were removed ** the set of "generate" member overloads was reduced to two methods accepting xalan::XSLTInputSource and xalan::FormatterListener as parameters * the core problem first documented in 299d0f6 was solved by transforming the input parameter into a xerces DOM and wrapping this DOM inside a xalan::XercesDOMWrapperParsedSource instance * serialization of the transformation result for file / std::cout output is now performed directly by the ixslt frontend * removed 'stylesheet parameter' parameter from FunctionTransform ** the functionality provided by this is easily replicated using the now possible DOM input parameter ** this was done to simplify the interface and reduce unnecessary feature duplication * updated FunctionTransform test case accordingly * added "generate" template function to ixslt frontend ** wraps TransformerFacade and manages ist input arguments ** handles serialization to stream * this commit marks a important milestone towards the goals defined in 741a70f --- src/support/stylesheet_parameter_guard.cc | 46 ------------------------------- src/support/stylesheet_parameter_guard.h | 37 ------------------------- 2 files changed, 83 deletions(-) delete mode 100644 src/support/stylesheet_parameter_guard.cc delete mode 100644 src/support/stylesheet_parameter_guard.h (limited to 'src/support') diff --git a/src/support/stylesheet_parameter_guard.cc b/src/support/stylesheet_parameter_guard.cc deleted file mode 100644 index 399bccb..0000000 --- a/src/support/stylesheet_parameter_guard.cc +++ /dev/null @@ -1,46 +0,0 @@ -#include "stylesheet_parameter_guard.h" - -namespace InputXSLT { - -StylesheetParameterGuard::StylesheetParameterGuard( - xalan::XalanTransformer& transformer -): transformer_(transformer) { } - -StylesheetParameterGuard::StylesheetParameterGuard( - xalan::XalanTransformer& transformer, - const map& parameters -): transformer_(transformer) { - this->set(parameters); -} - -StylesheetParameterGuard::~StylesheetParameterGuard() { - this->transformer_.clearStylesheetParams(); -} - -void StylesheetParameterGuard::set(const map& parameters) { - for ( auto&& parameter : parameters ) { - this->set(parameter.first, parameter.second); - } -} - -void StylesheetParameterGuard::set( - const std::string& key, - const std::string& value -) { - this->transformer_.setStylesheetParam( - key.data(), - std::string("'" + value + "'").data() - ); -} - -void StylesheetParameterGuard::set( - const std::string& key, - const xalan::XObjectPtr& value -) { - this->transformer_.setStylesheetParam( - key.data(), - value - ); -} - -} diff --git a/src/support/stylesheet_parameter_guard.h b/src/support/stylesheet_parameter_guard.h deleted file mode 100644 index 7fa425e..0000000 --- a/src/support/stylesheet_parameter_guard.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef INPUTXSLT_SRC_SUPPORT_STYLESHEET_PARAMETER_GUARD_H_ -#define INPUTXSLT_SRC_SUPPORT_STYLESHEET_PARAMETER_GUARD_H_ - -#include -#include - -#include -#include - -#include "common.h" - -namespace InputXSLT { - -class StylesheetParameterGuard { - public: - typedef std::unordered_map map; - - explicit StylesheetParameterGuard(xalan::XalanTransformer&); - StylesheetParameterGuard( - xalan::XalanTransformer&, - const map& - ); - - ~StylesheetParameterGuard(); - - void set(const map&); - void set(const std::string&, const std::string&); - void set(const std::string&, const xalan::XObjectPtr&); - - private: - xalan::XalanTransformer& transformer_; - -}; - -} - -#endif // INPUTXSLT_SRC_SUPPORT_STYLESHEET_PARAMETER_GUARD_H_ -- cgit v1.2.3