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

Invalid octal numbers #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Transform <x>089</x>

What is the expected output? What do you see instead?
You see x:089.
But 089 is an invalid octal number in Javascript.

Replacing

<xsl:template match="text()[not(string(number())='NaN')]">

with 

<xsl:template match="text()[not(string(number())='NaN') and
not(starts-with(.,'0') and (contains(.,'8') or contains(.,'9')))]">

solves the problem.

I'm attaching the revised scripts (including Mat Perrin's correction of
handing null elements).

Original issue reported on code.google.com by root.n...@gmail.com on 30 Oct 2007 at 7:07

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r23

Original comment by docw...@gmail.com on 31 Mar 2008 at 4:43

GoogleCodeExporter commented 9 years ago
Actually, this wasn't fixed because JSON doesn't allow for OCTAL numbers.  See 
issue 8.

Original comment by docw...@gmail.com on 31 Mar 2008 at 8:01