fixed a regression for AVT found in global variable content. added test to
authorDaniel Veillard <veillard@src.gnome.org>
Thu, 26 Feb 2004 12:19:15 +0000 (12:19 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Thu, 26 Feb 2004 12:19:15 +0000 (12:19 +0000)
* libxslt/attrvt.c libxslt/variables.c: fixed a regression for
  AVT found in global variable content.
* tests/docs/Makefile.am tests/docs/bug-143.xml
  tests/general/Makefile.am tests/docs/bug-143*: added test
  to the regression suite.
Daniel

ChangeLog
libxslt/attrvt.c
libxslt/variables.c
tests/docs/Makefile.am
tests/docs/bug-143.xml [new file with mode: 0644]
tests/general/Makefile.am
tests/general/bug-143.out [new file with mode: 0644]
tests/general/bug-143.xsl [new file with mode: 0644]

index adcd5be..ca2f29a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Feb 26 13:16:33 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/attrvt.c libxslt/variables.c: fixed a regression for
+         AVT found in global variable content.
+       * tests/docs/Makefile.am tests/docs/bug-143.xml
+         tests/general/Makefile.am tests/docs/bug-143*: added test
+         to the regression suite.
+
 Wed Feb 25 16:35:01 CET 2004 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/attributes.c libxslt/keys.h libxslt/preproc.c 
index 5be2a9b..54500a1 100644 (file)
@@ -29,7 +29,6 @@
 
 #ifdef WITH_XSLT_DEBUG
 #define WITH_XSLT_DEBUG_AVT
-#define WITH_XSLT_DEBUG_AVT
 #endif
 
 #define MAX_AVT_SEG 10
@@ -158,6 +157,17 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) {
     if ((xmlStrchr(str, '{') == NULL) &&
         (xmlStrchr(str, '}') == NULL)) return;
 
+#ifdef WITH_XSLT_DEBUG_AVT
+    xsltGenericDebug(xsltGenericDebugContext,
+                   "Found AVT %s: %s\n", attr->name, str);
+#endif
+    if (attr->_private != NULL) {
+#ifdef WITH_XSLT_DEBUG_AVT
+       xsltGenericDebug(xsltGenericDebugContext,
+                       "AVT %s: already compiled\n");
+#endif
+        return;
+    }
     avt = xsltNewAttrVT(style);
     if (avt == NULL) return;
     attr->_private = avt;
index 3938eb4..7531473 100644 (file)
@@ -1405,6 +1405,9 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur) {
        return;
     }
 
+    if (cur->children != NULL) {
+        xsltParseTemplateContent(style, cur);
+    }
 #ifdef WITH_XSLT_DEBUG_VARIABLE
     xsltGenericDebug(xsltGenericDebugContext,
        "Registering global variable %s\n", comp->name);
@@ -1444,6 +1447,10 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
        return;
     }
 
+    if (cur->children != NULL) {
+        xsltParseTemplateContent(style, cur);
+    }
+
 #ifdef WITH_XSLT_DEBUG_VARIABLE
     xsltGenericDebug(xsltGenericDebugContext,
        "Registering global param %s\n", comp->name);
index cabb007..8a32866 100644 (file)
@@ -142,6 +142,7 @@ EXTRA_DIST =        \
        bug-140.xml \
        bug-141.xml \
        bug-142.xml \
+       bug-143.xml \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-143.xml b/tests/docs/bug-143.xml
new file mode 100644 (file)
index 0000000..69d62f2
--- /dev/null
@@ -0,0 +1 @@
+<doc/>
index 6199da9..534ae09 100644 (file)
@@ -148,6 +148,7 @@ EXTRA_DIST = \
     bug-140.out bug-140.xsl \
     bug-141.out bug-141.xsl \
     bug-142.out bug-142.xsl \
+    bug-143.out bug-143.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-143.out b/tests/general/bug-143.out
new file mode 100644 (file)
index 0000000..61380a1
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<foo bar="0foo1">foo1</foo>
diff --git a/tests/general/bug-143.xsl b/tests/general/bug-143.xsl
new file mode 100644 (file)
index 0000000..a8bf5a9
--- /dev/null
@@ -0,0 +1,10 @@
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:variable name="foo">foo</xsl:variable>
+<xsl:variable name="bar">
+  <foo bar="0{$foo}1">foo1</foo>
+</xsl:variable>
+<xsl:template match="/">
+  <xsl:copy-of select="$bar"/>
+</xsl:template>
+</xsl:stylesheet>