diff options
author | Adrian Kummerländer | 2014-06-10 22:27:24 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-06-10 22:27:24 +0200 |
commit | e805000b1841691cd58930e80bd896a4f7611fd0 (patch) | |
tree | 35e4ff32f4aa0856b657abe789e396cb8531ff50 /ixslt.cc | |
parent | 516ff636f760458c33676458fc88892faab9d376 (diff) | |
download | InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar.gz InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar.bz2 InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar.lz InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar.xz InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.tar.zst InputXSLT-e805000b1841691cd58930e80bd896a4f7611fd0.zip |
Added input file support to ixslt
* a single file may be passed to the XSLT processor as input
** the file is read once and stored within a xalan::XalanParsedSource to be reused by all calls to "TransformationFacade::generate"
* added appropriate TranformationFacade constructor overload
** this new constructor overload which is taking a path to both the transformation and the input file is the main constructor
*** the old constructor is now only a alias for this new constructor
* adapted static "try_create" TransformationFacade factory method into variadic template factory method
* added optional "--input" argument to ixslt
** expanded option handling accordingly
Diffstat (limited to 'ixslt.cc')
-rw-r--r-- | ixslt.cc | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -43,6 +43,11 @@ boost::optional<boost::program_options::variables_map> input( "transformation file" ) ( + "input", + boost::program_options::value<std::string>(), + "input file" + ) + ( "target", boost::program_options::value<std::string>(), "target file" @@ -90,12 +95,24 @@ bool process(const boost::program_options::variables_map& variables) { }; InputXSLT::PlattformGuard plattform(includePath); + InputXSLT::TransformationFacade::ptr transformation{}; + + if ( variables.count("input") ) { + transformation = InputXSLT::TransformationFacade::try_create( + handleErrors, + variables["input"].as<std::string>(), + variables["transformation"].as<std::string>(), + plattform.getEntityResolver() + ); + } else { + transformation = InputXSLT::TransformationFacade::try_create( + handleErrors, + variables["transformation"].as<std::string>(), + plattform.getEntityResolver() + ); + } - if ( auto transformation = InputXSLT::TransformationFacade::try_create( - variables["transformation"].as<std::string>(), - plattform.getEntityResolver(), - handleErrors - ) ) { + if ( transformation ) { WarningGuard guard(transformation.get()); try { |