I reported your issue to our github repository:

https://github.com/BaseXdb/basex/issues#issue/23

The issue tracker is open for everybody. Don't hesitate to report
future issues directly in the github tracker.

-- Andreas

Am 22.02.2011 um 12:33 schrieb Andreas Weiler:

Hi Artur,

your mentioned bug should be fixed soon.

-- Andreas

Am 22.02.2011 um 12:31 schrieb Artur Moor:

Hi Andreas,

have you tried your example with 1234.567?

As I mentioned in post
(https://mailman.uni-konstanz.de/pipermail/basex-talk/2011-February/001225.html)
there is a bug in format-number funtion!

Regards, Artur

2011/2/22 Andreas Weiler <andreas.weiler@uni-konstanz.de>:
Hi Artur,

maybe the following code can help you:

declare function local:clean($n as xs:string) as xs:string
{
      let $tmp1 := replace($n, "\.", "#")
      let $tmp2 := replace($tmp1, ",", ".")
      return replace($tmp2, "#", ",")
};

declare function local:de($n as xs:decimal) as xs:string
{
let $nn := format-number($n, '#,####,##.##')
return local:clean($nn)
};

declare function local:en($n as xs:decimal) as xs:string
{
let $nn := format-number($n, '#,####,##.##')
return $nn
};

let $numbers := (1234567.765)
return (
      (: numbers in english localization :)
      for $i in $numbers return local:de($i),
      (: numbers in german localization :)
      for $i in $numbers return local:en($i)
)

-- Andreas

Am 22.02.2011 um 11:25 schrieb Artur Moor:

Hi, Andreas!

thank you for reply, but your suggested functions do the same, they do
not format a number in locale sensitive manner.

For example: given a number 1234567.765
Task: Format a number for given locale with two fraction digits!
Result:
Invocation of format number function for 'de' locale should result in:
"1.234.567,76"
Invocation of format number function for 'en' locale should result in:
"1,234,567.76"

Please note the "decimal-separator"s and the "grouping-separator"s!

Regards, Artur

2011/2/22 Andreas Weiler <andreas.weiler@uni-konstanz.de>:
I dont know about the XQuery 3.0 specification but i would do something like that:

declare function local:de($n as xs:decimal) as xs:string
{
let $nn := format-number($n, "#,###.##")
return $nn
};

declare function local:en($n as xs:decimal) as xs:string
{
let $nn := format-number($n, "#,###.##")
return $nn
};

let $numbers := (1234.567, 789, 1234567.765)
return (
      (: numbers in english localization :)
      for $i in $numbers return local:de($i),
      (: numbers in german localization :)
      for $i in $numbers return local:en($i)
)

-- Andreas

Am 22.02.2011 um 10:56 schrieb Artur Moor:

My intention is to format numbers in locale sensetive manner using the
XQuery 3.0 specification.

For example:
declare decimal-format local:de (decimal-separator = ",",
grouping-separator = ".");
declare decimal-format local:en (decimal-separator = ".",
grouping-separator = ",");

let $numbers := (1234.567, 789, 1234567.765)
return (
     (: numbers in english localization :)
     for $i in $numbers return format-number($i, "#,###.##", local:de),
     (: numbers in german localization :)
     for $i in $numbers return format-number($i, "#,###.##", local:en)
)

Regards, Artur

2011/2/22 Andreas Weiler <andreas.weiler@uni-konstanz.de>:
Hi Artur,

if you just want to declare the output of the numbers, you could do something like:

for $i in 1 to 10
return format-number($i, "000,00")

-- Andreas

Am 22.02.2011 um 09:35 schrieb Artur Moor:

Hi all,

Does anybody know, if it possible to declare the decimal-format as it
defined in in XQuery 3.0:

declare default decimal-format decimal-separator = ','

Thanks, Artur
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk







_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk