]> matita.cs.unibo.it Git - helm.git/commitdiff
Bug fixed: the value of parameters must be valid XPath string literals ==>
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 11 Jul 2003 10:01:05 +0000 (10:01 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 11 Jul 2003 10:01:05 +0000 (10:01 +0000)
they can not contain both ' and " (at least in Veillard interpretation, of
course ;-)

The fix applied consist in accepting parameters with only ' or only " inside
by quoting them using the opposite quote. As a consequence, variable
values with just 's inside are now handled correctly.

helm/uwobo/uwobo_engine.ml

index f8be17806310755f6c5b4f1ba4ea2f9be976f411..03a3b424d726f1c65faa2693529fc06b9415dd41 100644 (file)
@@ -208,7 +208,23 @@ let apply
         logger#log `Debug (sprintf "Applying stylesheet %s ..." key);
         try
           let params =
-            List.map (fun (key,value) -> (key, "'" ^ value ^ "'")) (params key)
+            List.map
+             (fun (key,value) ->
+               let quoted_value =
+                if String.contains value '\'' then
+                 if String.contains value '"' then
+                  raise
+                   (Failure
+                     ("A parameter value can not contain both single and " ^
+                      "double quotes, since it must be a valid XPath string " ^
+                      "literal"))
+                 else
+                  "\"" ^ value ^ "\""
+                else
+                 "'" ^ value ^ "'"
+               in
+                (key,quoted_value)
+             ) (params key)
           in
           logger#log `Debug
             (sprintf "Gdome_xslt.applyStylesheet params=%s"