From 3383e24e396431eed7d4ab9f69ff8ffaf12d4925 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 19 Apr 2014 18:31:15 +0200 Subject: Implemented transformation execution function * InputXSLT::PlattformGuard handles xerces and xalan construction and lifetime * InputXSLT::TransformerGuard instantiates PlattformGuard, configurates external functions ** offers execute method for "executing" a XSL tranformation with empty input --- test.cc | 44 +++++--------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index cfcf632..09325f7 100644 --- a/test.cc +++ b/test.cc @@ -1,44 +1,10 @@ -#include -#include -#include -#include - -#include "function/read_file.h" -#include "function/read_xml_file.h" +#include "transformer_guard.h" int main() { - xercesc::XMLPlatformUtils::Initialize(); - xalan::XalanTransformer::initialize(); - - const xalan::XalanDOMString customNamespace( - "http://ExternalFunction.xalan-c++.xml.apache.org" - ); - - xalan::XalanTransformer transformer; - - transformer.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-file"), - InputXSLT::FunctionReadFile() - ); + InputXSLT::TransformerGuard guard; - transformer.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-xml-file"), - InputXSLT::FunctionReadXmlFile() + return guard.execute( + "../dummy/transform.xsl", + "out.xml" ); - - xalan::XSLTInputSource input("../dummy/in.xml"); - xalan::XSLTInputSource tranformation("../dummy/transform.xsl"); - xalan::XSLTResultTarget output("out.xml"); - - int result(transformer.transform( - input, - tranformation, - output - )); - - xalan::XalanTransformer::terminate(); - - return result; } -- cgit v1.2.3