1 (* This file is part of an ocaml binding of an XSLT engine working on Gdome
4 * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
5 * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
7 * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * For more information, please send an email to <sacerdot@cs.unibo.it>
30 ("../../test_files/output.xml",
31 "../../test_files/output.xml.correct",
32 "../../test_files/input.xml",
33 "../../test_files/stylesheet.xsl")
35 let domImpl = Gdome.domImplementation () in
37 domImpl#createDocumentFromURI ~uri:input_file ()
39 domImpl#createDocumentFromURI ~uri:stylesheet_file ()
41 (* First of all, let's try the exception handling machinery *)
44 ignore (Gdome_xslt.processStylesheet input);
45 assert false (* previous line should rise an exception *)
47 Gdome_xslt_init.ProcessStylesheetException -> ()
49 let pstyle = Gdome_xslt.processStylesheet style in
51 Gdome_xslt.applyStylesheet input pstyle
52 ["parameter1","'value1'" ;
53 "parameter2","'value2'" ;
54 "parameter3","'value3'"
57 (* (* old version: use gdome serialization functions *)
59 domImpl#saveDocumentToFile ~doc:output ~name:output_file ()
62 prerr_endline ("Error saving to document " ^ output_file)
66 "The test was successful iff %s is equal to %s\n"
71 (* new version: use libxslt serialization functions *)
72 let outchan = open_out output_file in
73 Gdome_xslt.saveResultToChannel ~outchan ~result:output ~stylesheet:pstyle;
76 "The test was successful iff %s is equal to %s\n"