qbektrix / xml2json-xslt

Automatically exported from code.google.com/p/xml2json-xslt
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Error in decimal conversion #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Decimal numbers between 0 and 1 is not converted into numbers.
Also negative numbers which aren't number! -01 is not converted into strings.

The following code fix the issue:

[not(string(number())='NaN' or 
 (starts-with(.,'0' ) and . != '0' and not(starts-with(.,'0.' ))) or 
 (starts-with(.,'-0' ) and . != '-0' and not(starts-with(.,'-0.' )))
)]

Original issue reported on code.google.com by jonaskro...@gmail.com on 19 Jan 2011 at 11:05

GoogleCodeExporter commented 9 years ago
I found a problem with decimal numbers without fractional digits. 
<value>1.</value> results in "{value: 1.}". This additional line appends a zero 
to such numbers:

<xsl:if test="substring(., string-length(.))='.'">0</xsl:if>

Original comment by goo...@digineo.de on 11 Mar 2013 at 1:59