Sorin Marian Nasoi has proposed merging 
lp:~zorba-coders/zorba/partial_fix_bug_1167641 into lp:zorba.

Commit message:
Re-added changes that were wrongfully reverted in r11402.1.5.

Requested reviews:
  Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
  Bug #1167641 in Zorba: "Can not expand NS prefix to URI for decimal-format #2"
  https://bugs.launchpad.net/zorba/+bug/1167641

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/partial_fix_bug_1167641/+merge/179741
-- 
https://code.launchpad.net/~zorba-coders/zorba/partial_fix_bug_1167641/+merge/179741
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq	2013-08-09 08:27:30 +0000
+++ test/fots_driver/environment.xq	2013-08-12 16:14:43 +0000
@@ -181,10 +181,12 @@
  : to a test-case query.
  :
  : @param $decimal-formats decimal formats.
+ : @param $namespaces the declared environment namespaces.
  : @return the decimal formats declarations.
  :)
 declare function env:decl-decimal-formats(
-  $decimal-formats as element(fots:decimal-format)*
+  $decimal-formats as element(fots:decimal-format)*,
+  $namespaces      as element(fots:namespace)*
 ) as xs:string*
 {
   if (empty($decimal-formats))
@@ -194,9 +196,10 @@
     let $default := if ($tmp/@name)
                     then ()
                     else "default"
-    let $name := if ($tmp/@name)
-                 then data($tmp/@name)
-                 else ()
+    let $name := xs:string($tmp/@name)
+    let $eqName := fn:resolve-QName(xs:string($tmp/@name), $tmp)
+    let $prefix := fn:prefix-from-QName($eqName)
+    let $namespace := $namespaces/following-sibling::*[@uri=fn:namespace-uri-from-QName($eqName)]
     return
       string-join
       (
@@ -204,7 +207,9 @@
         "declare",
         $default,
         "decimal-format",
-        $name,
+        if(exists($prefix) and empty($namespace))
+        then concat("%Q{", namespace-uri-from-QName($eqName), "}", local-name-from-QName($eqName))
+        else $name,
         env:set-properties($tmp),
         ";"
       ),

=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq	2013-08-09 08:27:30 +0000
+++ test/fots_driver/fots-driver.xq	2013-08-12 16:14:43 +0000
@@ -875,7 +875,9 @@
         env:decl-namespaces($env, $envCase, $test),
 
         env:decl-decimal-formats(($env/fots:decimal-format,
-                                  $envCase/fots:decimal-format)),
+                                  $envCase/fots:decimal-format),
+                                 ($env/fots:namespace,
+                                  $envCase/fots:namespace)),
 
         env:add-var-decl($env, $envCase, $envBaseURI, $testSetURI),
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to