From: Stefano Zacchiroli Date: Fri, 10 Jan 2003 11:35:12 +0000 (+0000) Subject: added debugging code (disabled by default) that saves transformations X-Git-Tag: v0_3_99~39 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=00bcf4e9f02d1f456b3468eba3de21c1309e5796;p=helm.git added debugging code (disabled by default) that saves transformations intermediate results in /tmp --- diff --git a/helm/uwobo/src/ocaml/uwobo_engine.ml b/helm/uwobo/src/ocaml/uwobo_engine.ml index 75e4669bf..0bc5afcba 100644 --- a/helm/uwobo/src/ocaml/uwobo_engine.ml +++ b/helm/uwobo/src/ocaml/uwobo_engine.ml @@ -27,6 +27,10 @@ open Printf;; open Uwobo_common;; + (** set this to true and uwobo will save transformation's intermediate results + in /tmp/uwobo_intermediate__.xml *) +let save_intermediate_results = false;; + exception Unsupported_property of string;; let xslNS = Gdome.domString "http://www.w3.org/1999/XSL/Transform" @@ -86,6 +90,7 @@ let apply (* "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) -> @@ -100,6 +105,16 @@ let apply "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