removed the last use of _private that time in the input document, use the
authorDaniel Veillard <veillard@src.gnome.org>
Thu, 26 Feb 2004 16:01:44 +0000 (16:01 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Thu, 26 Feb 2004 16:01:44 +0000 (16:01 +0000)
* libxslt/keys.c libxslt/pattern.c: removed the last use
  of _private that time in the input document, use the psvi
  field again, this may be interesting if XSLT2 support gets
  in but since this is very unlikely ...
Daniel

ChangeLog
libxslt/keys.c
libxslt/pattern.c

index f27737c..daf17a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 26 16:59:45 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/keys.c libxslt/pattern.c: removed the last use
+         of _private that time in the input document, use the psvi
+         field again, this may be interesting if XSLT2 support gets
+         in but since this is very unlikely ...
+
 Thu Feb 26 16:04:28 CET 2004 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/transform.c libxslt/variables.c: use the psvi field
index 6d0e757..8adca04 100644 (file)
@@ -644,7 +644,30 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc,
                    } else {
                        xmlXPathNodeSetAdd(keylist, nodelist->nodeTab[i]);
                    }
-                   nodelist->nodeTab[i]->_private = keyd;
+                   switch (nodelist->nodeTab[i]->type) {
+                        case XML_ELEMENT_NODE:
+                        case XML_TEXT_NODE:
+                        case XML_CDATA_SECTION_NODE:
+                        case XML_PI_NODE:
+                        case XML_COMMENT_NODE:
+                           nodelist->nodeTab[i]->psvi = keyd;
+                           break;
+                        case XML_ATTRIBUTE_NODE: {
+                           xmlAttrPtr attr = (xmlAttrPtr) 
+                                             nodelist->nodeTab[i]->psvi;
+                           attr->psvi = keyd;
+                           break;
+                       }
+                        case XML_DOCUMENT_NODE:
+                        case XML_HTML_DOCUMENT_NODE: {
+                           xmlDocPtr doc = (xmlDocPtr) 
+                                           nodelist->nodeTab[i]->psvi;
+                           doc->psvi = keyd;
+                           break;
+                       }
+                       default:
+                           break;
+                   }
                    xmlFree(str);
                    str = list[index++];
                }
index dd82eb3..68259cd 100644 (file)
@@ -2057,6 +2057,7 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
     const xmlChar *name = NULL;
     xsltCompMatchPtr list = NULL;
     float priority;
+    int keyed = 0;
 
     if ((ctxt == NULL) || (node == NULL))
        return(NULL);
@@ -2133,23 +2134,37 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
                    list = curstyle->rootMatch;
                else
                    list = curstyle->elemMatch;
+               if (node->psvi != NULL) keyed = 1;
                break;
-           case XML_ATTRIBUTE_NODE:
+           case XML_ATTRIBUTE_NODE: {
+               xmlAttrPtr attr;
+
                list = curstyle->attrMatch;
+               attr = (xmlAttrPtr) node;
+               if (attr->psvi != NULL) keyed = 1;
                break;
+           }
            case XML_PI_NODE:
                list = curstyle->piMatch;
+               if (node->psvi != NULL) keyed = 1;
                break;
            case XML_DOCUMENT_NODE:
-           case XML_HTML_DOCUMENT_NODE:
+           case XML_HTML_DOCUMENT_NODE: {
+               xmlDocPtr doc;
+
                list = curstyle->rootMatch;
+               doc = (xmlDocPtr) node;
+               if (doc->psvi != NULL) keyed = 1;
                break;
+           }
            case XML_TEXT_NODE:
            case XML_CDATA_SECTION_NODE:
                list = curstyle->textMatch;
+               if (node->psvi != NULL) keyed = 1;
                break;
            case XML_COMMENT_NODE:
                list = curstyle->commentMatch;
+               if (node->psvi != NULL) keyed = 1;
                break;
            case XML_ENTITY_REF_NODE:
            case XML_ENTITY_NODE:
@@ -2166,7 +2181,6 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
                break;
            default:
                break;
-
        }
        while ((list != NULL) &&
               ((ret == NULL)  || (list->priority > priority))) {
@@ -2210,7 +2224,7 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
            }
        }
 
-       if (node->_private != NULL) {
+       if (keyed) {
            list = curstyle->keyMatch;
            while ((list != NULL) &&
                   ((ret == NULL)  || (list->priority > priority))) {