exception Unsupported_property of string;;
-let supported_properties = [
- "cdata-section-elements";
- "doctype-public";
- "doctype-system";
- "encoding";
- "indent";
- "media-type";
- "method";
- "omit-xml-declaration";
- "standalone";
- "version"
-]
-
-let dump_args keys params props =
- (sprintf "
-Keys: %s<br />
-Parameters:<br />
-%s
-Props: %s<br />
-"
- (String.concat ", " keys)
- (String.concat
- "<br />\n"
- (List.map
- (fun key ->
- (sprintf
- "Key: %s, Params: %s"
- key
- (String.concat
- ", "
- (List.map
- (fun (key,value) -> sprintf "%s:%s" key value)
- (params key)))))
- keys))
- (String.concat
- ", "
- (List.map (fun (key,value) -> sprintf "%s:%s" key value) props)))
-
let xslNS = Gdome.domString "http://www.w3.org/1999/XSL/Transform"
let outputS = Gdome.domString "output"
let q_outputS = Gdome.domString "xsl:output"
-let is_supported_property name = List.mem name supported_properties
(** 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
logger#log `Debug "Creating xsl:output node ...";
let elt = last_stylesheet#createElementNS (Some xslNS) q_outputS in
let root = last_stylesheet#get_documentElement in
- ignore (root#insertBefore (elt :> Gdome.node) root#get_firstChild);
+ ignore (root#appendChild (elt :> Gdome.node));
elt
| Some node -> new Gdome.element_of_node node)
in
let apply_property (name, value) =
- if is_supported_property name then begin
+ 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)
~keys ~params ~props ~input =
(* "p_" prefix means "processed" *)
let (p_stylesheets, last_stylesheet) = styles#get keys in
- logger#log `Debug (dump_args keys params props);
logger#log `Debug "Creating input document ...";
let result = (* Gdome.document *)
List.fold_left
let params =
List.map (fun (key,value) -> (key, "'" ^ value ^ "'")) (params key)
in
- Gdome_xslt.applyStylesheet ~source ~stylesheet ~params
+ logger#log
+ `Debug
+ (sprintf
+ "Gdome_xslt.applyStylesheet params=%s"
+ (String.concat ", " (List.map (fun (k,v) -> k^": "^v) params)));
+ let res = Gdome_xslt.applyStylesheet ~source ~stylesheet ~params in
+ res
with e -> raise (Uwobo_failure (Printexc.to_string e)))
input
p_stylesheets