X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fuwobo%2Fsrc%2Focaml%2Fuwobo_engine.ml;h=9d5b4670ee5d9ac9968245f5b74a453f718fa080;hb=de8b8a901f012fb57268e71758e3e36aaee919c8;hp=0bc5afcba4522a38abac2f0590a3acecee502ab3;hpb=54bf1b633cd8d2876dc7162d77f9f5a93d327368;p=helm.git diff --git a/helm/uwobo/src/ocaml/uwobo_engine.ml b/helm/uwobo/src/ocaml/uwobo_engine.ml index 0bc5afcba..9d5b4670e 100644 --- a/helm/uwobo/src/ocaml/uwobo_engine.ml +++ b/helm/uwobo/src/ocaml/uwobo_engine.ml @@ -37,9 +37,22 @@ let xslNS = Gdome.domString "http://www.w3.org/1999/XSL/Transform" let outputS = Gdome.domString "output" let q_outputS = Gdome.domString "xsl:output" +let default_properties = [ "method", "xml" ] + + (** apply an output property to an xslt stylesheet *) +let apply_property logger (element: Gdome.element) (name, value) = + if Uwobo_common.is_supported_property name then begin + logger#log `Debug (sprintf "Setting property: %s = %s" name value); + element#setAttribute (Gdome.domString name) (Gdome.domString value) + end + else + raise (Unsupported_property name) + (** set a list of output properties in an xslt stylesheet, return a copy of the given stylesheet modified as needed, given stylesheet wont be changed by - this operation *) + this operation. + Before applying "props" properties applies a set of default properties as + defined in "default_properties" *) let apply_properties logger last_stylesheet props = let last_stylesheet = new Gdome.document_of_node (last_stylesheet#cloneNode ~deep:true) @@ -55,17 +68,9 @@ let apply_properties logger last_stylesheet props = elt | Some node -> new Gdome.element_of_node node) in - let apply_property (name, value) = - if Uwobo_common.is_supported_property name then begin - logger#log `Debug (sprintf "Setting property: %s = %s" name value); - output_element#setAttribute - (Gdome.domString name) - (Gdome.domString value) - end - else - raise (Unsupported_property name) - in - List.iter apply_property props; + List.iter + (apply_property logger (output_element :> Gdome.element)) + (default_properties @ props); last_stylesheet (** given a Gdome.document representing an XSLT stylesheet and an output