aboutsummaryrefslogtreecommitdiff
path: root/src/transformation_facade.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-06-16 23:01:23 +0200
committerAdrian Kummerlaender2014-06-16 23:01:23 +0200
commit741a70f5fecc38033832728f4ecc62a6abe328b2 (patch)
tree5cf421ece0eb745a618f654ecbdaeb21587c2875 /src/transformation_facade.cc
parent32c65970263c65022f5278b568c07b63c3d5d64b (diff)
downloadInputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar.gz
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar.bz2
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar.lz
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar.xz
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.tar.zst
InputXSLT-741a70f5fecc38033832728f4ecc62a6abe328b2.zip
Prepared TransformationFacade and FunctionTransform for parameter change
* FunctionTransform was adapted to support passing the transformation as either a string path or directly as a node-set / result-tree ** this in turn required changes to the TransformationFacade ** the implementation of a xalan::XSLTInputSource specialization for the XObjectValue::get template method was also required * changed ixslt executable to match TransformationFacade constructor changes * these changes were implemented in preparation for a restructuring of how the separate external functions provided by InputXSLT operate and work together ** the approach up until now was to provide non-combinable external functions for distinct task such as "read a file" and "transform that transformation using these parameters into that file" ** if you think about the areas of operations of these functions are overlapping quite a bit *** e.g. FunctionTransform reads files, transforms DOM structures and writes files instead of only transforming things ** the new approach will be to limit the feature set of each function in the attempt of making the clearer and increasing their combinability *** e.g. FunctionTransform won't read or write files but expect both the input-DOM and the transformation-DOM as node-sets or result trees and return the transformed document as a node-set to be written using FunctionWriteFile (to be implemented)
Diffstat (limited to 'src/transformation_facade.cc')
-rw-r--r--src/transformation_facade.cc53
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_
);