xsltCompileStepPattern handles nested predicates now
authorBjorn Reese <breese@src.gnome.org>
Sun, 4 Mar 2001 16:53:26 +0000 (16:53 +0000)
committerBjorn Reese <breese@src.gnome.org>
Sun, 4 Mar 2001 16:53:26 +0000 (16:53 +0000)
ChangeLog
libxslt/pattern.c

index 7489aba..01ffe10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
-Sun Mar  4 13:21:16 CET 2001 Bjorn Reese <breese@users.sourceforge.net>
+Sun Mar  4 17:53:13 CET 2001 Bjorn Reese <breese@users.sourceforge.net>
 
        * libxslt/pattern.c: fixed the compilation of patterns which
-         contains XPath NodeTypes.
+         contains XPath NodeTypes. Handling of nested predicates.
 
 Sat Mar  3 20:56:47 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
index 38ace5b..31f5a19 100644 (file)
@@ -1016,6 +1016,7 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token) {
     xmlChar *prefix = NULL;
     xmlChar *ncname = NULL;
     xmlChar *URL = NULL;
+    int level;
 
     SKIP_BLANKS;
     if ((token == NULL) && (CUR == '@')) {
@@ -1152,15 +1153,26 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token) {
     }
 parse_predicate:
     SKIP_BLANKS;
+    level = 0;
     while (CUR == '[') {
        const xmlChar *q;
        xmlChar *ret = NULL;
 
+       level++;
        NEXT;
        q = CUR_PTR;
        /* TODO: avoid breaking in strings ... */
-       while ((IS_CHAR(CUR)) && (CUR != ']'))
+       while (IS_CHAR(CUR)) {
+           /* Skip over nested predicates */
+           if (CUR == '[')
+               level++;
+           if (CUR == ']') {
+               level--;
+               if (level == 0)
+                   break;
+           }
            NEXT;
+       }
        if (!IS_CHAR(CUR)) {
            xsltGenericError(xsltGenericErrorContext,
                    "xsltCompileStepPattern : ']' expected\n");