trying to use the fact that names comes from a dictionnary when looking up
authorDaniel Veillard <veillard@src.gnome.org>
Wed, 25 Feb 2004 13:26:22 +0000 (13:26 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Wed, 25 Feb 2004 13:26:22 +0000 (13:26 +0000)
* libxslt/variables.c: trying to use the fact that names comes
  from a dictionnary when looking up for variables.
* tests/documents/Makefile.am: try to fix an error reported on
  the list.
Daniel

ChangeLog
libxslt/variables.c
tests/documents/Makefile.am

index 0bdc6a0..bac92cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Feb 25 14:24:34 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/variables.c: trying to use the fact that names comes
+         from a dictionnary when looking up for variables.
+       * tests/documents/Makefile.am: try to fix an error reported on
+         the list.
+
 Wed Feb 25 17:02:22 HKT 2004 William Brack <wbrack@mmm.com.hk>
 
        * tests/general/Makefile.am, tests/general/bug-142.xsl,
index 96e1f86..8845ea4 100644 (file)
@@ -244,7 +244,6 @@ xsltFreeStackElemList(xsltStackElemPtr elem) {
 static xsltStackElemPtr
 xsltStackLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
                const xmlChar *nameURI) {
-    xsltStackElemPtr ret = NULL;
     int i;
     xsltStackElemPtr cur;
 
@@ -254,6 +253,58 @@ xsltStackLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
     /*
      * Do the lookup from the top of the stack, but
      * don't use params being computed in a call-param
+     * First lookup expects the variable name and URI to
+     * come from the disctionnary and hence get equality
+     */
+    for (i = ctxt->varsNr; i > ctxt->varsBase; i--) {
+       cur = ctxt->varsTab[i-1];
+       while (cur != NULL) {
+           if (cur->name == name) {
+               if (nameURI == NULL) {
+                   if (cur->nameURI == NULL) {
+                       return(cur);
+                   }
+               } else {
+                   if ((cur->nameURI != NULL) &&
+                       (cur->nameURI == nameURI)) {
+                       return(cur);
+                   }
+               }
+
+           }
+           cur = cur->next;
+       }
+    }
+
+#if 0
+    if ((xmlDictOwns(ctxt->dict, name) <= 0) ||
+        ((nameURI != NULL) && (xmlDictOwns(ctxt->dict, nameURI) <= 0))) {
+       /*
+        * Redo the lookup with string compares
+        */
+       for (i = ctxt->varsNr; i > ctxt->varsBase; i--) {
+           cur = ctxt->varsTab[i-1];
+           while (cur != NULL) {
+               if (xmlStrEqual(cur->name, name)) {
+                   if (nameURI == NULL) {
+                       if (cur->nameURI == NULL) {
+                           return(cur);
+                       }
+                   } else {
+                       if ((cur->nameURI != NULL) &&
+                           (xmlStrEqual(cur->nameURI, nameURI))) {
+                           return(cur);
+                       }
+                   }
+
+               }
+               cur = cur->next;
+           }
+       }
+    }
+#else
+    /*
+     * Redo the lookup with string compares
      */
     for (i = ctxt->varsNr; i > ctxt->varsBase; i--) {
        cur = ctxt->varsTab[i-1];
@@ -274,7 +325,8 @@ xsltStackLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
            cur = cur->next;
        }
     }
-    return(ret);
+#endif
+    return(NULL);
 }
 
 /**
index 539fe9f..88a9c73 100644 (file)
@@ -3,11 +3,12 @@
 $(top_builddir)/xsltproc/xsltproc:
        @(cd ../../xsltproc ; $(MAKE) xsltproc)
 
-EXTRA_DIST = bredfort.css index.xml system.xml \
-             bredfort.xsl menu.xml worklog.xml \
-            result.xhtml docfile.xml doc_file.xml \
-            test.xml test.xsl test.result \
-            message.xml message.xsl message.result
+EXTRA_DIST = \
+    bredfort.css bredfort.xsl doc_file.xml docfile.xml \
+    fragment2.xml fragment.result fragment.xml fragment.xsl \
+    index.xml menu.xml message.result message.xml message.xsl \
+    result.xhtml system.xml test_bad.err test_bad.result \
+    test_bad.xml test.result test.xml test.xsl worklog.xml
 
 
 all: