Re: [xslt] format-number



On Wed, 19 Feb 2003, Daniel Veillard wrote:
>   http://www.w3.org/TR/xslt#function-format-number
>
> "It is an error if the stylesheet does not contain a declaration of the
>  decimal-format with the specified expanded-name."
>
> this should turn into a compile-time error IMHO,

Okay, the bug is fixed. The diff follows, risk a short glance and if its
okay, I'll commit.

Ciao,
Igor


Index: libxslt/functions.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/functions.c,v
retrieving revision 1.47
diff -c -r1.47 functions.c
*** libxslt/functions.c	7 Feb 2003 14:52:24 -0000	1.47
--- libxslt/functions.c	19 Feb 2003 17:19:34 -0000
***************
*** 530,535 ****
--- 530,540 ----
  	XP_ERROR(XPATH_INVALID_ARITY);
      }

+     if (formatValues == NULL) {
+ 	XP_ERROR(XPATH_EXPR_ERROR);
+ 	formatValues = sheet->decimalFormat;
+     }
+
      if (xsltFormatNumberConversion(formatValues,
  				   formatObj->stringval,
  				   numberObj->floatval,
Index: libxslt/xslt.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/xslt.c,v
retrieving revision 1.88
diff -c -r1.88 xslt.c
*** libxslt/xslt.c	7 Feb 2003 13:20:49 -0000	1.88
--- libxslt/xslt.c	19 Feb 2003 17:19:34 -0000
***************
*** 264,275 ****

      if (name == NULL)
  	return sheet->decimalFormat;
!
!     for (result = sheet->decimalFormat->next;
! 	 result != NULL;
! 	 result = result->next) {
! 	if (xmlStrEqual(name, result->name))
! 	    break; /* for */
      }
      return result;
  }
--- 264,281 ----

      if (name == NULL)
  	return sheet->decimalFormat;
!
!     while (sheet != NULL) {
! 	for (result = sheet->decimalFormat->next;
! 	     result != NULL;
! 	     result = result->next) {
! 	    if (xmlStrEqual(name, result->name))
! 		return result;
! 	}
! 	if (sheet->next != NULL)
! 	    sheet = sheet->next;
! 	else
! 	    sheet = sheet->imports;
      }
      return result;
  }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]