summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-09-14 13:23:51 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-09-14 13:23:51 +0000
commitcc975baab0ba187951fe4101f6b4f742b6554392 (patch)
tree3bb594b015adad901abd23cd1cb28bca6aeabba3
parent91d231d6d9ec659bdb25f795b116df089f8dabdd (diff)
downloadlibxslt-cc975baab0ba187951fe4101f6b4f742b6554392.tar.gz
libxslt-cc975baab0ba187951fe4101f6b4f742b6554392.tar.bz2
libxslt-cc975baab0ba187951fe4101f6b4f742b6554392.zip
Fixing bug #60415 added a specific example in the regression tests Daniel
* libxslt/numbers.c: Fixing bug #60415 * tests/docs/Makefile.am tests/docs/bug-61.xml tests/general/Makefile.am tests/general/bug-61.*: added a specific example in the regression tests Daniel
-rw-r--r--ChangeLog7
-rw-r--r--libxslt/numbers.c14
-rw-r--r--tests/docs/Makefile.am1
-rw-r--r--tests/docs/bug-61.xml1
-rw-r--r--tests/general/Makefile.am1
-rw-r--r--tests/general/bug-61.out10
-rw-r--r--tests/general/bug-61.xsl14
7 files changed, 48 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d2384bcd..7945737d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Sep 14 15:22:30 CEST 2001 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/numbers.c: Fixing bug #60415
+ * tests/docs/Makefile.am tests/docs/bug-61.xml
+ tests/general/Makefile.am tests/general/bug-61.*: added a
+ specific example in the regression tests
+
Fri Sep 14 12:42:22 CEST 2001 Daniel Veillard <daniel@veillard.com>
* tests/docbook/result/*: the change in libxml to output
diff --git a/libxslt/numbers.c b/libxslt/numbers.c
index 920ef615..2f6a9705 100644
--- a/libxslt/numbers.c
+++ b/libxslt/numbers.c
@@ -774,6 +774,20 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
/* flag to show error found, should use default format */
char found_error = 0;
+ switch (xmlXPathIsInf(number)) {
+ case -1:
+ *result = xmlStrdup(BAD_CAST "-Infinity");
+ return(status);
+ case 1:
+ *result = xmlStrdup(BAD_CAST "Infinity");
+ return(status);
+ default:
+ if (xmlXPathIsNaN(number)) {
+ *result = xmlStrdup(BAD_CAST "NaN");
+ return(status);
+ }
+ }
+
buffer = xmlBufferCreate();
if (buffer == NULL) {
return XPATH_MEMORY_ERROR;
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index 6de218bf..045170ec 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -62,6 +62,7 @@ EXTRA_DIST = \
bug-57.xml \
bug-59.xml \
bug-60.xml \
+ bug-61.xml \
character.xml \
array.xml \
items.xml
diff --git a/tests/docs/bug-61.xml b/tests/docs/bug-61.xml
new file mode 100644
index 00000000..69d62f2c
--- /dev/null
+++ b/tests/docs/bug-61.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 8e9a4dec..58902be0 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -64,6 +64,7 @@ EXTRA_DIST = \
bug-57.out bug-57.xsl \
bug-59.out bug-59.xsl \
bug-60.out bug-60.xsl \
+ bug-61.out bug-61.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-61.out b/tests/general/bug-61.out
new file mode 100644
index 00000000..5ac0a079
--- /dev/null
+++ b/tests/general/bug-61.out
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+case 1:
+NaN
+case 2:
+NaN
+case 3:
+NaN
+case 4:
+NaN
diff --git a/tests/general/bug-61.xsl b/tests/general/bug-61.xsl
new file mode 100644
index 00000000..2070df49
--- /dev/null
+++ b/tests/general/bug-61.xsl
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+version="1.0">
+<xsl:template match="/">
+case 1:
+<xsl:value-of select="format-number('', '#.#')"/>
+case 2:
+<xsl:value-of select="number('')"/>
+case 3:
+<xsl:value-of select="format-number(non/existing/path, '#.#')"/>
+case 4:
+<xsl:value-of select="number(non/existing/path)"/>
+</xsl:template>
+</xsl:stylesheet>