From: Bjorn Reese Date: Sun, 4 Mar 2001 16:53:26 +0000 (+0000) Subject: xsltCompileStepPattern handles nested predicates now X-Git-Tag: v1.1.28~1426 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d1f04d50dcc9f2db02ec0b49ee3b6409da029d;p=platform%2Fupstream%2Flibxslt.git xsltCompileStepPattern handles nested predicates now --- diff --git a/ChangeLog b/ChangeLog index 7489aba..01ffe10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ -Sun Mar 4 13:21:16 CET 2001 Bjorn Reese +Sun Mar 4 17:53:13 CET 2001 Bjorn Reese * 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 diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 38ace5b..31f5a19 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -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");