diff --git a/ChangeLog b/ChangeLog index 29524449d752162ef108a84208943ab21526700c_Q2hhbmdlTG9n..0e6f3c0e5fc4584e6866a6a0c1b838cfb0af7fa5_Q2hhbmdlTG9n 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Jan 23 17:24:26 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> + + * tests/Makefile.am: cleanup + * libxslt/pattern.c: should support most of the patterns now + except ID/Key and maybe some namespace checks when having + a default namespace + * TODO: updated + Tue Jan 23 14:58:32 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> * Makefile.am libxslt.spec.in tests/REC1/Makefile.am diff --git a/TODO b/TODO index 29524449d752162ef108a84208943ab21526700c_VE9ETw==..0e6f3c0e5fc4584e6866a6a0c1b838cfb0af7fa5_VE9ETw== 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ - should transforms for a given stylesheet be thread clean, or can a stylesheet be enriched with document specific informations and cleaned up later ? - => currently stylesheet manipulation is not reentrant. - seems that saving back XSLT stylesheet from a compiled form might be a bit ugly ... @@ -26,7 +25,9 @@ Pattern tester: -> try to optimize for ID scan and tests. + -> also put fast lookup for "text()", "comment()", "node()" + based patterns lists. Pattern scanner: -> add error checks on all returns -> handle unions @@ -29,8 +30,7 @@ Pattern scanner: -> add error checks on all returns -> handle unions - -> compute priority Error handling: -> check the version stuff, design a separate module for error interfacing @@ -72,3 +72,6 @@ level. => Done with a trick, text node name is different, requires > 2.2.11 +Pattern scanner: + -> compute priority + => done diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 29524449d752162ef108a84208943ab21526700c_bGlieHNsdC9wYXR0ZXJuLmM=..0e6f3c0e5fc4584e6866a6a0c1b838cfb0af7fa5_bGlieHNsdC9wYXR0ZXJuLmM= 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -280,7 +280,17 @@ continue; if (!xmlStrEqual(step->value, node->name)) return(0); - /* TODO: Handle namespace ... */ + + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + return(0); + } else if (node->ns->href != NULL) { + if (step->value2 == NULL) + return(0); + if (!xmlStrEqual(step->value2, node->ns->href)) + return(0); + } continue; case XSLT_OP_CHILD: TODO /* Handle OP_CHILD */ @@ -292,7 +302,17 @@ continue; if (!xmlStrEqual(step->value, node->name)) return(0); - /* TODO: Handle namespace ... */ + + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + return(0); + } else if (node->ns->href != NULL) { + if (step->value2 == NULL) + return(0); + if (!xmlStrEqual(step->value2, node->ns->href)) + return(0); + } continue; case XSLT_OP_PARENT: node = node->parent; @@ -302,7 +322,16 @@ continue; if (!xmlStrEqual(step->value, node->name)) return(0); - /* TODO: Handle namespace ... */ + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + return(0); + } else if (node->ns->href != NULL) { + if (step->value2 == NULL) + return(0); + if (!xmlStrEqual(step->value2, node->ns->href)) + return(0); + } continue; case XSLT_OP_ANCESTOR: /* TODO: implement coalescing of ANCESTOR/NODE ops */ @@ -323,8 +352,15 @@ if (node == NULL) return(0); if (xmlStrEqual(step->value, node->name)) { - /* TODO: Handle namespace ... */ - break; + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 == NULL) + break; + } else if (node->ns->href != NULL) { + if ((step->value2 != NULL) && + (xmlStrEqual(step->value2, node->ns->href))) + break; + } } } if (node == NULL) @@ -337,6 +373,15 @@ TODO /* Handle Keys, might be done differently */ break; case XSLT_OP_NS: - TODO /* Handle Namespace */ + /* Namespace test */ + if (node->ns == NULL) { + if (step->value != NULL) + return(0); + } else if (node->ns->href != NULL) { + if (step->value == NULL) + return(0); + if (!xmlStrEqual(step->value, node->ns->href)) + return(0); + } break; case XSLT_OP_ALL: @@ -341,8 +386,15 @@ break; case XSLT_OP_ALL: - TODO /* Handle * */ + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + break; + default: + return(0); + } break; case XSLT_OP_PREDICATE: TODO /* Handle Predicate */ break; case XSLT_OP_PI: @@ -344,8 +396,13 @@ break; case XSLT_OP_PREDICATE: TODO /* Handle Predicate */ break; case XSLT_OP_PI: - TODO /* Handle PI() */ + if (node->type != XML_PI_NODE) + return(0); + if (step->value == NULL) { + if (!xmlStrEqual(step->value, node->name)) + return(0); + } break; case XSLT_OP_COMMENT: @@ -350,5 +407,6 @@ break; case XSLT_OP_COMMENT: - TODO /* Handle Comments() */ + if (node->type != XML_COMMENT_NODE) + return(0); break; case XSLT_OP_TEXT: @@ -353,5 +411,7 @@ break; case XSLT_OP_TEXT: - TODO /* Handle Text() */ + if ((node->type != XML_TEXT_NODE) && + (node->type != XML_CDATA_SECTION_NODE)) + return(0); break; case XSLT_OP_NODE: @@ -356,6 +416,18 @@ break; case XSLT_OP_NODE: - TODO /* Handle Node() */ + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_TEXT_NODE: + case XML_ATTRIBUTE_NODE: + break; + default: + return(0); + } break; } } @@ -601,7 +673,7 @@ } NEXT; PUSH(XSLT_OP_COMMENT, NULL, NULL); - } else if (xmlStrEqual(name, (const xmlChar *)"comment")) { + } else if (xmlStrEqual(name, (const xmlChar *)"node")) { NEXT; SKIP_BLANKS; if (CUR != ')') { @@ -973,7 +1045,7 @@ int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur) { xsltCompMatchPtr pat, list; - const xmlChar *name; + const xmlChar *name = NULL; xmlChar *p, *pattern, tmp; if ((style == NULL) || (cur == NULL)) diff --git a/tests/Makefile.am b/tests/Makefile.am index 29524449d752162ef108a84208943ab21526700c_dGVzdHMvTWFrZWZpbGUuYW0=..0e6f3c0e5fc4584e6866a6a0c1b838cfb0af7fa5_dGVzdHMvTWFrZWZpbGUuYW0= 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,24 +2,3 @@ SUBDIRS=REC1 REC2 -INCLUDES = -I$(srcdir) -I$(top_srcdir)/libxslt \ - $(LIBXML_CFLAGS) -Wall -ansi - -noinst_PROGRAMS = # testxslt testevents - -DEPS = $(top_builddir)/libxslt/libxslt.la -LDADDS = $(top_builddir)/libxslt/libxslt.la $(LIBXML_LIBS) - -#testxslt_SOURCES = test-xslt.c -#testxslt_LDFLAGS = -#testxslt_DEPENDENCIES = $(DEPS) -#testxslt_LDADD = $(LDADDS) -# -#testevents_SOURCES = test-events.c -#testevents_LDFLAGS = -#testevents_DEPENDENCIES = $(DEPS) -#testevents_LDADD = $(LDADDS) - -test tests: $(top_builddir)/libxslt/xsltproc - @(cd REC1 ; make test) - @(cd REC2 ; make test)