GNOME Bugzilla – Bug 60415
format-number() of an empty string does not output NaN
Last modified: 2009-08-15 18:40:50 UTC
Stylesheet: =========== <?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('', '#.#')"/> <!-- outputs NOT "NaN" as expected --> case 2: <xsl:value-of select="number('')"/> <!-- outputs NaN, ok --> case 3: <xsl:value-of select="format-number(non/existing/path, '#.#')"/> <!-- outputs NOT "NaN" as expected --> case 4: <xsl:value-of select="number(non/existing/path)"/> <!-- outputs NaN, ok --> </xsl:template> </xsl:stylesheet> ==================================================== Output is: <?xml version="1.0"?> case 1: 0000000000000000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000000000 case 2: NaN case 3: 0000000000000000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000000000 case 4: NaN =================================================================== Cases 2 and 4 (number) are correct. Cases 1 and 3 (format-number) should also output NaN! Versioninfo: Using libxml 20403, libxslt 10003 and libexslt 301 xsltproc was compiled against libxml 20403, libxslt 10003 and libexslt 301 libxslt 10003 was compiled against libxml 20403 libexslt 301 was compiled against libxml 20403 Stephan
Created attachment 5587 [details] testcases
Thanks for the very good bug report and example ! I fixed it in CVS: http://cvs.gnome.org/bonsai/cvsquery.cgi?module=libxslt&branch=HEAD&branchtype=match&dir=libxslt&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=09%2F14%2F01+09%3A22&maxdate=09%2F14%2F01+09%3A24&cvsroot=%2Fcvs%2Fgnome will be in the next release Daniel
I think this is fixed in the last 2 releases, Daniel