open Printf;;
open Uwobo_common;;
+ (** set this to true and uwobo will save transformation's intermediate results
+ in /tmp/uwobo_intermediate_<seqno>_<pid>.xml *)
+let save_intermediate_results = false;;
+
exception Unsupported_property of string;;
let xslNS = Gdome.domString "http://www.w3.org/1999/XSL/Transform"
(* "p_" prefix means "processed" *)
let (p_stylesheets, last_stylesheet) = styles#get keys in
logger#log `Debug "Creating input document ...";
+ let intermediate_results_seqno = ref 0 in
let result = (* Gdome.document *)
List.fold_left
(fun source (key, stylesheet) ->
"Gdome_xslt.applyStylesheet params=%s"
(String.concat ", " (List.map (fun (k,v) -> k^": "^v) params)));
let res = Gdome_xslt.applyStylesheet ~source ~stylesheet ~params in
+ if save_intermediate_results then begin
+ let domImpl = Gdome.domImplementation () in
+ ignore
+ (domImpl#saveDocumentToFile
+ ~doc:res
+ ~name:(sprintf "/tmp/uwobo_intermediate_%d_%d.xml"
+ !intermediate_results_seqno (Unix.getpid()))
+ ());
+ incr intermediate_results_seqno;
+ end;
res
with e -> raise (Uwobo_failure (Printexc.to_string e)))
input