]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/uwobo/src/ocaml/uwobo_styles.ml
- shows also version in usage string
[helm.git] / helm / uwobo / src / ocaml / uwobo_styles.ml
index 93fdb8e6330263c9d45618da314bf10dab63caf5..218da17868260b195946d676ca9c9051ae8c6f76 100644 (file)
@@ -40,16 +40,28 @@ class styles =
     val domImpl = Gdome.domImplementation ()
 
       (** process an XSLT stylesheet *)
-    method private process uri =
-      Gdome_xslt.processStylesheet (domImpl#createDocumentFromURI ~uri ())
+    method private process uri = domImpl#createDocumentFromURI ~uri ()
 
     method get keys =
       self#doReader (lazy (
-        List.fold_left
-          (fun collected_styles key ->
-            (List.find (fun (k, _) -> k = key) stylesheets)::collected_styles)
-          []
-          (List.rev keys)
+        let rev_keys = List.rev keys in
+        let last_key = List.hd rev_keys in
+        let p_stylesheets =
+          List.fold_left
+            (fun collected_styles key ->
+              let (key, stylesheet) =
+                try
+                  List.find (fun (k, _) -> k = key) stylesheets
+                with Not_found -> raise (Stylesheet_not_found key)
+              in
+              (key, Gdome_xslt.processStylesheet stylesheet)::collected_styles)
+            []
+            rev_keys
+        in
+        let last_stylesheet =
+          snd (List.find (fun (k, _) -> k = last_key) stylesheets)
+        in
+        (p_stylesheets, last_stylesheet)
       ))
 
     method add key uri =