mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Essential part of upstream pull req No. 20
https://github.com/doekman/xml2json-xslt/pull/20 Some numeric values would not get formatted to valid JSON. This incorporates the suggestions from issue #15. Also fixed whitespace of original patch. Additional fix for related issue will follow.
This commit is contained in:
parent
3d2ab9aec2
commit
0b1ac3e9d5
@ -125,8 +125,22 @@
|
||||
|
||||
<!-- number (no support for javascript mantissa) -->
|
||||
<xsl:template match="text()[not(string(number())='NaN' or
|
||||
(starts-with(.,'0' ) and . != '0'))]">
|
||||
<xsl:value-of select="."/>
|
||||
(starts-with(.,'0' ) and . != '0' and not(starts-with(.,'0.' ))) or
|
||||
(starts-with(.,'-0' ) and . != '-0' and not(starts-with(.,'-0.' ))))]">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(.,'.')">
|
||||
<xsl:value-of select="concat('0',.)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with(.,'-.')">
|
||||
<xsl:value-of select="concat('-0.', substring(.,3))"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="substring(., string-length(.))='.'">
|
||||
<xsl:value-of select="concat(.,0)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- boolean, case-insensitive -->
|
||||
|
Loading…
Reference in New Issue
Block a user