trying to accept AVT for "format" in xsl:number Daniel
authorDaniel Veillard <veillard@src.gnome.org>
Sat, 14 Jul 2001 20:01:17 +0000 (20:01 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Sat, 14 Jul 2001 20:01:17 +0000 (20:01 +0000)
* libxslt/numbers.c libxslt/numbersInternals.h libxslt/preproc.c:
  trying to accept AVT for "format" in xsl:number
Daniel

ChangeLog
libxslt/numbers.c
libxslt/numbersInternals.h
libxslt/preproc.c

index 42c1d2b..bef1758 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jul 15 16:01:55 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+       * libxslt/numbers.c libxslt/numbersInternals.h libxslt/preproc.c:
+         trying to accept AVT for "format" in xsl:number
+
 Fri Jul 13 16:57:08 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
        * win32/libxslt/libxslt.defs: trying to close #57460 by adding
index 9fea063..3ea233c 100644 (file)
@@ -29,6 +29,7 @@
 #include <libxml/xpathInternals.h>
 #include "xsltutils.h"
 #include "pattern.h"
+#include "templates.h"
 #include "numbersInternals.h"
 
 #ifndef FALSE
@@ -600,6 +601,15 @@ xsltNumberFormat(xsltTransformContextPtr ctxt,
     double number;
     xsltNumberFormatToken array[1024];
 
+    if ((data->format == NULL) && (data->has_format != 0)) {
+       data->format = xsltEvalAttrValueTemplate(ctxt, data->node,
+                                            (const xmlChar *) "format",
+                                            XSLT_NAMESPACE);
+    }
+    if (data->format == NULL) {
+       return;
+    }
+
     output = xmlBufferCreate();
     if (output == NULL)
        goto XSLT_NUMBER_FORMAT_END;
index f6fd7aa..0cb7df4 100644 (file)
@@ -27,6 +27,7 @@ typedef struct _xsltNumberData {
     xmlChar *from;
     xmlChar *value;
     xmlChar *format;
+    int has_format;
     int digitsPerGroup;
     xmlChar groupingCharacter;
     xmlDocPtr doc;
index 9772feb..7170cc6 100644 (file)
@@ -717,13 +717,15 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
     comp->numdata.value = xsltGetNsProp(cur, (const xmlChar *)"value",
                                        XSLT_NAMESPACE);
     
-    prop = xsltGetNsProp(cur, (const xmlChar *)"format", XSLT_NAMESPACE);
-    if (prop != NULL) {
-       comp->numdata.format = prop;
-    } else {
+    prop = xsltEvalStaticAttrValueTemplate(style, cur,
+                        (const xmlChar *)"format",
+                        XSLT_NAMESPACE, &comp->numdata.has_format);
+    if (comp->numdata.has_format == 0) {
        comp->numdata.format = xmlStrdup(BAD_CAST(""));
+    } else {
+       comp->numdata.format = prop;
     }
-    
+
     comp->numdata.count = xsltGetNsProp(cur, (const xmlChar *)"count",
                                        XSLT_NAMESPACE);
     comp->numdata.from = xsltGetNsProp(cur, (const xmlChar *)"from",