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)
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