* For more information, please send an email to <sacerdot@cs.unibo.it>
*)
+let (output_file,
+ correct_output_file,
+ input_file,
+ stylesheet_file) =
+ ("../../test_files/output.xml",
+ "../../test_files/output.xml.correct",
+ "../../test_files/input.xml",
+ "../../test_files/stylesheet.xsl")
+in
let domImpl = Gdome.domImplementation () in
let input =
- domImpl#createDocumentFromURI ~uri:"../../test_files/input.xml" ()
+ domImpl#createDocumentFromURI ~uri:input_file ()
and style =
- domImpl#createDocumentFromURI ~uri:"../../test_files/stylesheet.xsl" ()
+ domImpl#createDocumentFromURI ~uri:stylesheet_file ()
in
(* First of all, let's try the exception handling machinery *)
let _ =
try
- ignore (Gdome_xslt.processStylesheet input) ;
+ ignore (Gdome_xslt.processStylesheet input);
assert false (* previous line should rise an exception *)
with
Gdome_xslt_init.ProcessStylesheetException -> ()
"parameter3","'value3'"
]
in
+(* (* old version: use gdome serialization functions *)
let res =
- domImpl#saveDocumentToFile ~doc:output ~name:"../../test_files/output.xml"
- ()
+ domImpl#saveDocumentToFile ~doc:output ~name:output_file ()
in
if not res then
- prerr_endline "Error saving to document ../../test_files/output.xml"
+ prerr_endline ("Error saving to document " ^ output_file)
else
begin
- print_endline
- "The test was successful iff ../../test_files/output.xml.correct is" ;
- print_endline "equal to ../../test_files/output.xml"
+ Printf.printf
+ "The test was successful iff %s is equal to %s\n"
+ output_file
+ correct_output_file
end
+*)
+ (* new version: use libxslt serialization functions *)
+ let outchan = open_out output_file in
+ Gdome_xslt.saveResultToChannel ~outchan ~result:output ~stylesheet:pstyle;
+ close_out outchan;
+ Printf.printf
+ "The test was successful iff %s is equal to %s\n"
+ output_file
+ correct_output_file
;;