Skip to content

Commit

Permalink
Merge pull request #8 from RickSBrown/master
Browse files Browse the repository at this point in the history
Fixed numbers starting with + symbol
  • Loading branch information
bramstein committed Mar 12, 2014
2 parents ba59abd + b29cc5f commit 6d80efe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,4 @@ XSLTJSON is licensed under the new BSD License (see the header comment.)

## Credits

Thanks to: Chick Markley (Octal number & numbers with terminating period fix), Torben Schreiter (Suggestions for skip root, and newline entities bug fix), Michael Nilsson (Bug report & text cases for json:force-array.)
Thanks to: Chick Markley (Octal number & numbers with terminating period fix), Torben Schreiter (Suggestions for skip root, and newline entities bug fix), Michael Nilsson (Bug report & text cases for json:force-array), Rick Brown (bug report and fix for numbers starting with '+' symbol).
4 changes: 2 additions & 2 deletions conf/xml-to-json.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@
<!--
A value is considered a string if the following conditions are met:
* There is whitespace/formatting around the value of the node.
* The value is not a valid JSON number (i.e. '01', '1.', and '.5' are not valid JSON numbers.)
* The value is not a valid JSON number (i.e. '01', '+1', '1.', and '.5' are not valid JSON numbers.)
* The value does not equal the any of the following strings: 'false', 'true', 'null'.
-->
<xsl:when test="normalize-space(.) ne . or not((string(.) castable as xs:integer and not(starts-with(string(.),'0') and not(. = '0'))) or (string(.) castable as xs:decimal and not(starts-with(.,'-.')) and not(starts-with(.,'.')) and not(starts-with(.,'-0') and not(starts-with(.,'-0.'))) and not(ends-with(.,'.')) and not(starts-with(.,'0') and not(starts-with(.,'0.'))) )) and not(. = 'false') and not(. = 'true') and not(. = 'null')">
<xsl:when test="normalize-space(.) ne . or not((string(.) castable as xs:integer and not(starts-with(string(.),'+')) and not(starts-with(string(.),'0') and not(. = '0'))) or (string(.) castable as xs:decimal and not(starts-with(string(.),'+')) and not(starts-with(.,'-.')) and not(starts-with(.,'.')) and not(starts-with(.,'-0') and not(starts-with(.,'-0.'))) and not(ends-with(.,'.')) and not(starts-with(.,'0') and not(starts-with(.,'0.'))) )) and not(. = 'false') and not(. = 'true') and not(. = 'null')">
<xsl:text/>"<xsl:value-of select="json:encode-string(.)"/>"<xsl:text/>
</xsl:when>
<xsl:otherwise>
Expand Down

0 comments on commit 6d80efe

Please sign in to comment.