]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/gdome_xslt/C++/test/main.cc
Initial revision
[helm.git] / helm / DEVEL / gdome_xslt / C++ / test / main.cc
1 /* This file is a test for the XSLT engine working on Gdome documents.
2  *
3  * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
4  * 
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * 
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  * 
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * For more information, please send an email to <sacerdot@cs.unibo.it>
20  */
21
22 #include <string>
23 #include <iostream>
24 #include "GdomeSmartDOMXSLT.hh"
25
26 namespace DOM = GdomeSmartDOM;
27
28 #define OUTPUT_FILE             "../../test_files/output.xml"
29 #define CORRECT_OUTPUT_FILE     "../../test_files/output.xml.correct"
30
31 int
32 main(void)
33 {
34    int bytes;
35    DOM::DOMImplementation di;
36    std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > params;
37
38    params.push_back(make_pair(DOM::GdomeString("parameter1"), DOM::GdomeString("'value1'")));
39    params.push_back(make_pair(DOM::GdomeString("parameter2"), DOM::GdomeString("'value2'")));
40    params.push_back(make_pair(DOM::GdomeString("parameter3"), DOM::GdomeString("'value3'")));
41
42    DOM::Document input = di.createDocumentFromURI("../../test_files/input.xml");
43    DOM::Document style = di.createDocumentFromURI("../../test_files/stylesheet.xsl");
44
45    DOM::XSLTStylesheet style_libxslt(style);
46    DOM::Document output = style_libxslt.apply(input, params);
47    style_libxslt.save(output, OUTPUT_FILE);
48
49    cout << "The test was successful iff " << OUTPUT_FILE << " is equal to " << CORRECT_OUTPUT_FILE << endl;
50
51    return 0;
52 }