more on RVT's in XPath predicates, this time for bug 159726. Cleaned up
authorWilliam M. Brack <wbrack@src.gnome.org>
Tue, 30 Nov 2004 03:00:32 +0000 (03:00 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Tue, 30 Nov 2004 03:00:32 +0000 (03:00 +0000)
* libxslt/pattern.c: more on RVT's in XPath predicates, this
  time for bug 159726.  Cleaned up the logic a little, hopefully
  now covers all setting of XSLT_RUNTIME_EXTRA.
* tests/general/bug-158.xsl: corrected a typo

ChangeLog
libxslt/pattern.c
libxslt/xsltwin32config.h
tests/general/bug-158.xsl

index 48024f1..3a07c6c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Nov 30 10:53:18 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+       * libxslt/pattern.c: more on RVT's in XPath predicates, this
+         time for bug 159726.  Cleaned up the logic a little, hopefully
+         now covers all setting of XSLT_RUNTIME_EXTRA.
+       * tests/general/bug-158.xsl: corrected a typo
+
 Thu Nov 25 22:24:03 HKT 2004 William Brack <wbrack@mmm.com.hk>
 
        * libxslt/variables.c, libxslt/xsltInternals.h: backed out the
index 7760518..f50cf46 100644 (file)
@@ -607,8 +607,20 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                break;
            case XSLT_OP_PREDICATE: {
                xmlNodePtr oldNode;
+               xmlDocPtr doc;
                int oldCS, oldCP;
                int pos = 0, len = 0;
+               int isRVT;
+
+               doc = node->doc;
+               if ((doc != NULL) &&
+                   (doc->name != NULL) &&
+                   (doc->name[0] == ' ') &&
+                   (xmlStrEqual(BAD_CAST doc->name,
+                                BAD_CAST " fake node libxslt")))
+                   isRVT = 1;
+               else
+                   isRVT = 0;
                /*
                 * The simple existing predicate code cannot handle
                 * properly cascaded predicates. If in this situation
@@ -616,7 +628,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                 * if the node is in the result list.
                 */
                if (comp->steps[i + 1].op == XSLT_OP_PREDICATE) {
-                   xmlDocPtr prevdoc, doc;
+                   xmlDocPtr prevdoc;
                    xmlXPathObjectPtr list;
                    int ix, j;
                    int nocache = 0;
@@ -628,7 +640,6 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                    list = (xmlXPathObjectPtr)
                        XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
                    
-                   doc = node->doc;
                    if ((list == NULL) || (prevdoc != doc)) {
                        xmlChar *query;
                        xmlXPathObjectPtr newlist;
@@ -658,15 +669,8 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                        }
                        ix = 0;
 
-                       if ((parent == NULL) || (node->doc == NULL))
+                       if ((parent == NULL) || (node->doc == NULL) || isRVT)
                            nocache = 1;
-                       else {
-                           if ((doc->name != NULL) &&
-                               (doc->name[0] == ' ') &&
-                               (xmlStrEqual(BAD_CAST doc->name, 
-                                            BAD_CAST " fake node libxslt")))
-                               nocache = 1;
-                       }
                        
                        if (nocache == 0) {
                            if (list != NULL)
@@ -774,8 +778,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                            if (node->doc != NULL) {
                                len = (int)
                                    XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra);
-                               if ((node->doc->name != NULL) &&
-                                   (node->doc->name[0] != ' ')) {
+                               if (!isRVT) {
                                    XSLT_RUNTIME_EXTRA(ctxt,
                                        sel->previousExtra) = node;
                                    XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
@@ -828,7 +831,8 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                         * If the node is in a Value Tree we cannot
                         * cache it !
                         */
-                       if ((node->doc != NULL) && (nocache == 0)) {
+                       if ((!isRVT) && (node->doc != NULL) &&
+                           (nocache == 0)) {
                            XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) =
                                node;
                            XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
@@ -879,9 +883,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                             * If the node is in a Value Tree we cannot
                             * cache it !
                             */
-                           if ((node->doc != NULL) &&
-                               (node->doc->name != NULL) &&
-                               (node->doc->name[0] != ' ')) {
+                           if ((node->doc != NULL) && !isRVT) {
                                len = (int)
                                    XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra);
                                XSLT_RUNTIME_EXTRA(ctxt,
@@ -925,7 +927,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
                         * If the node is in a Value Tree we cannot
                         * cache it !
                         */
-                       if ((node->doc != NULL) && (nocache == 0)) {
+                       if ((node->doc != NULL) && (nocache == 0) && !isRVT) {
                            XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) =
                                node;
                            XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
index b542c1b..f2dc77a 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
  *
  * extra version information, used to show a CVS compilation
  */
-#define LIBXML_VERSION_EXTRA "-CVS967"
+#define LIBXML_VERSION_EXTRA "-CVS970"
 
 /**
  * WITH_XSLT_DEBUG:
index 0e77175..3b955dc 100644 (file)
@@ -7,7 +7,7 @@
                 xmlns="http://www.w3.org/1999/xhtml">
 
 <xsl:variable name="myPath" select="/dsl:page/@path" />
-<xsl:variable name="layout" select="document('../docs/bug158.doc')"/>
+<xsl:variable name="layout" select="document('../docs/bug-158.doc')"/>
 <xsl:variable name="root"><xsl:value-of select="$layout//layout:page[@path=$myPath]" />
 </xsl:variable>