diff options
Diffstat (limited to 'src/transformation_facade.cc')
-rw-r--r-- | src/transformation_facade.cc | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/src/transformation_facade.cc b/src/transformation_facade.cc index 16872c7..93d14ea 100644 --- a/src/transformation_facade.cc +++ b/src/transformation_facade.cc @@ -7,21 +7,41 @@ #include <sstream> +#include "support/xerces_string_guard.h" + namespace InputXSLT { TransformationFacade::TransformationFacade( - const std::string& transformation, + xalan::XSLTInputSource transformation, IncludeEntityResolver* resolver ): - TransformationFacade( - std::string{}, + input_{}, + transformation_{}, + transformer_(), + error_multiplexer_(&transformer_), + warning_capacitor_(&error_multiplexer_) { + this->transformer_.setEntityResolver(resolver); + + ErrorCapacitor errorCapacitor(&this->error_multiplexer_); + + std::stringstream dummyStream("<dummy/>"); + + this->transformer_.parseSource( + xalan::XSLTInputSource(dummyStream), + this->input_ + ); + + this->transformer_.compileStylesheet( transformation, - resolver - ) { } + this->transformation_ + ); + + errorCapacitor.discharge(); +} TransformationFacade::TransformationFacade( - const std::string& input, - const std::string& transformation, + xalan::XSLTInputSource input, + xalan::XSLTInputSource transformation, IncludeEntityResolver* resolver ): input_{}, @@ -33,22 +53,13 @@ TransformationFacade::TransformationFacade( ErrorCapacitor errorCapacitor(&this->error_multiplexer_); - if ( input.empty() ) { - std::stringstream dummyStream("<dummy/>"); - - this->transformer_.parseSource( - xalan::XSLTInputSource(dummyStream), - this->input_ - ); - } else { - this->transformer_.parseSource( - xalan::XSLTInputSource(input.data()), - this->input_ - ); - } + this->transformer_.parseSource( + input, + this->input_ + ); this->transformer_.compileStylesheet( - xalan::XSLTInputSource(transformation.data()), + transformation, this->transformation_ ); |