1 /* This file is a test for the XSLT engine working on Gdome documents.
3 * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
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.
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.
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
19 * For more information, please send an email to <sacerdot@cs.unibo.it>
24 #include "GdomeSmartDOMXSLT.hh"
26 namespace DOM = GdomeSmartDOM;
27 namespace DOMX = GdomeSmartDOMExt;
29 #define OUTPUT_FILE "../../test_files/output.xml"
30 #define CORRECT_OUTPUT_FILE "../../test_files/output.xml.correct"
36 DOM::DOMImplementation di;
37 std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > params;
39 params.push_back(std::make_pair(DOM::GdomeString("parameter1"), DOM::GdomeString("'value1'")));
40 params.push_back(std::make_pair(DOM::GdomeString("parameter2"), DOM::GdomeString("'value2'")));
41 params.push_back(std::make_pair(DOM::GdomeString("parameter3"), DOM::GdomeString("'value3'")));
43 DOM::Document input = di.createDocumentFromURI("../../test_files/input.xml");
44 DOM::Document style = di.createDocumentFromURI("../../test_files/stylesheet.xsl");
46 DOMX::XSLTStylesheet style_libxslt(style);
47 DOM::Document output = style_libxslt.apply(input, params);
48 style_libxslt.save(output, OUTPUT_FILE);
50 std::cout << "The test was successful iff " << OUTPUT_FILE << " is equal to " << CORRECT_OUTPUT_FILE << std::endl;