On Mon, 2014-02-03 at 15:40 +0000, James Morris wrote:
On Mon, 03 Feb 2014 01:12:23 -0500
David Robillard <d(a)drobilla.net> wrote:
On Sun, 2014-02-02 at 16:07 +0100, Thomas Mayer
wrote:
Hi,
I have just finished two XSL stylesheets for converting specimen
banks to the save format used by petri-foo, so a user can easily
switch to petri-foo:
https://github.com/residuum/specimen2petri-foo
There are two stylesheets, depending on your locale settings, i.e.
if your locale uses comma or dot as decimal separator (if 1/2 is
saved as 0.5 or 0,5 on your system).
Eeck. XML documents should really be using the standard XSD types for
numeric literals, e.g. xsd:decimal[1], which are not locale dependent
(they use "." for a decimal separator).
[1]
http://www.w3.org/TR/xmlschema-2#decimal
Thanks for pointing this out. I've filed a bug report so will be fixed
next time I'm working on it.
https://github.com/jwm-art-net/Petri-Foo/issues/19
You're welcome. I'd assume that most XML APIs would have the stuff you
need (or you can just change the locale temporarily, but this is
sketchy), which would be best, but if not, I've done a straight C
implementation of both directions you can steal if you like.
serd_strtod in
http://svn.drobilla.net/serd/trunk/src/string.c
and serd_node_new_decimal in
http://svn.drobilla.net/serd/trunk/src/node.c
The former is just a portable strtod, the latter would need a bit of
tinkering to not return the result as a SerdNode. The latter is
designed to hack off useless strings of trailing zeros (i.e. be pretty
and terse), but can't do the scientific notation format.
--
dr