From: William M. Brack Date: Fri, 23 Jan 2004 10:51:45 +0000 (+0000) Subject: changed priority of template patterns starting with '//' from 0.0 to 0.5 X-Git-Tag: v1.1.28~502 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42fd0f2244f2b935f0db42f8c310c0759d07274a;p=platform%2Fupstream%2Flibxslt.git changed priority of template patterns starting with '//' from 0.0 to 0.5 * libxslt/pattern.c: changed priority of template patterns starting with '//' from 0.0 to 0.5 (Bug 131705) --- diff --git a/ChangeLog b/ChangeLog index a8a7df1..0fd6115 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 23 18:52:22 HKT 2004 William Brack + + * libxslt/pattern.c: changed priority of template patterns + starting with '//' from 0.0 to 0.5 (Bug 131705) + Thu Jan 22 18:42:03 CET 2004 Daniel Veillard * libxslt/xslt.c: applied patch from Stefan Kost to fix diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 1914caa..7e2ed99 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -1643,6 +1643,7 @@ xsltCompileLocationPathPattern(xsltParserContextPtr ctxt) { */ NEXT; NEXT; + ctxt->comp->priority = 0.5; /* '//' means not 0 priority */ xsltCompileRelativePathPattern(ctxt, NULL); } else if (CUR == '/') { /* @@ -1784,6 +1785,11 @@ xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, "xsltCompilePattern : parsing '%s'\n", element->pattern); #endif + /* + Preset default priority to be zero. + This may be changed by xsltCompileLocationPathPattern. + */ + element->priority = 0; xsltCompileLocationPathPattern(ctxt); if (ctxt->error) { xsltTransformError(NULL, style, node, @@ -1801,42 +1807,36 @@ xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, /* * Set-up the priority */ - if (((element->steps[0].op == XSLT_OP_ELEM) || - (element->steps[0].op == XSLT_OP_ATTR)) && - (element->steps[0].value != NULL) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = 0; -#if 0 - } else if ((element->steps[0].op == XSLT_OP_ROOT) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = 0; -#endif - } else if ((element->steps[0].op == XSLT_OP_PI) && - (element->steps[0].value != NULL) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = 0; - } else if ((element->steps[0].op == XSLT_OP_ATTR) && - (element->steps[0].value2 != NULL) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = -0.25; - } else if ((element->steps[0].op == XSLT_OP_NS) && - (element->steps[0].value != NULL) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = -0.25; - } else if ((element->steps[0].op == XSLT_OP_ATTR) && - (element->steps[0].value == NULL) && - (element->steps[0].value2 == NULL) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = -0.5; - } else if (((element->steps[0].op == XSLT_OP_PI) || - (element->steps[0].op == XSLT_OP_TEXT) || - (element->steps[0].op == XSLT_OP_ALL) || - (element->steps[0].op == XSLT_OP_NODE) || - (element->steps[0].op == XSLT_OP_COMMENT)) && - (element->steps[1].op == XSLT_OP_END)) { - element->priority = -0.5; - } else { - element->priority = 0.5; + if (element->priority == 0) { /* if not yet determined */ + if (((element->steps[0].op == XSLT_OP_ELEM) || + (element->steps[0].op == XSLT_OP_ATTR) || + (element->steps[0].op == XSLT_OP_PI)) && + (element->steps[0].value != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + ; /* previously preset */ + } else if ((element->steps[0].op == XSLT_OP_ATTR) && + (element->steps[0].value2 != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.25; + } else if ((element->steps[0].op == XSLT_OP_NS) && + (element->steps[0].value != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.25; + } else if ((element->steps[0].op == XSLT_OP_ATTR) && + (element->steps[0].value == NULL) && + (element->steps[0].value2 == NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.5; + } else if (((element->steps[0].op == XSLT_OP_PI) || + (element->steps[0].op == XSLT_OP_TEXT) || + (element->steps[0].op == XSLT_OP_ALL) || + (element->steps[0].op == XSLT_OP_NODE) || + (element->steps[0].op == XSLT_OP_COMMENT)) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.5; + } else { + element->priority = 0.5; + } } #ifdef WITH_XSLT_DEBUG_PATTERN xsltGenericDebug(xsltGenericDebugContext,