1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-11-08 11:02:18 +03:00

That part is not very fun:

- 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
Daniel
This commit is contained in:
Daniel Veillard
2001-01-23 16:27:12 +00:00
parent 583e780787
commit fd72be7739
4 changed files with 98 additions and 36 deletions

View File

@@ -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> Tue Jan 23 14:58:32 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* Makefile.am libxslt.spec.in tests/REC1/Makefile.am * Makefile.am libxslt.spec.in tests/REC1/Makefile.am

7
TODO
View File

@@ -7,7 +7,6 @@ Design:
- should transforms for a given stylesheet be thread clean, - should transforms for a given stylesheet be thread clean,
or can a stylesheet be enriched with document specific or can a stylesheet be enriched with document specific
informations and cleaned up later ? informations and cleaned up later ?
=> currently stylesheet manipulation is not reentrant.
- seems that saving back XSLT stylesheet from a compiled form might - seems that saving back XSLT stylesheet from a compiled form might
be a bit ugly ... be a bit ugly ...
@@ -26,11 +25,12 @@ ID and Key support:
Pattern tester: Pattern tester:
-> try to optimize for ID scan and tests. -> try to optimize for ID scan and tests.
-> also put fast lookup for "text()", "comment()", "node()"
based patterns lists.
Pattern scanner: Pattern scanner:
-> add error checks on all returns -> add error checks on all returns
-> handle unions -> handle unions
-> compute priority
Error handling: Error handling:
-> check the version stuff, design a separate module for error interfacing -> check the version stuff, design a separate module for error interfacing
@@ -72,3 +72,6 @@ Support for disable-output-escaping="yes":
level. level.
=> Done with a trick, text node name is different, requires > 2.2.11 => Done with a trick, text node name is different, requires > 2.2.11
Pattern scanner:
-> compute priority
=> done

View File

@@ -280,7 +280,17 @@ xsltTestCompMatch(xsltCompMatchPtr comp, xmlNodePtr node) {
continue; continue;
if (!xmlStrEqual(step->value, node->name)) if (!xmlStrEqual(step->value, node->name))
return(0); 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; continue;
case XSLT_OP_CHILD: case XSLT_OP_CHILD:
TODO /* Handle OP_CHILD */ TODO /* Handle OP_CHILD */
@@ -292,7 +302,17 @@ xsltTestCompMatch(xsltCompMatchPtr comp, xmlNodePtr node) {
continue; continue;
if (!xmlStrEqual(step->value, node->name)) if (!xmlStrEqual(step->value, node->name))
return(0); 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; continue;
case XSLT_OP_PARENT: case XSLT_OP_PARENT:
node = node->parent; node = node->parent;
@@ -302,7 +322,16 @@ xsltTestCompMatch(xsltCompMatchPtr comp, xmlNodePtr node) {
continue; continue;
if (!xmlStrEqual(step->value, node->name)) if (!xmlStrEqual(step->value, node->name))
return(0); 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; continue;
case XSLT_OP_ANCESTOR: case XSLT_OP_ANCESTOR:
/* TODO: implement coalescing of ANCESTOR/NODE ops */ /* TODO: implement coalescing of ANCESTOR/NODE ops */
@@ -323,8 +352,15 @@ xsltTestCompMatch(xsltCompMatchPtr comp, xmlNodePtr node) {
if (node == NULL) if (node == NULL)
return(0); return(0);
if (xmlStrEqual(step->value, node->name)) { if (xmlStrEqual(step->value, node->name)) {
/* TODO: Handle namespace ... */ /* Namespace test */
break; 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) if (node == NULL)
@@ -337,25 +373,61 @@ xsltTestCompMatch(xsltCompMatchPtr comp, xmlNodePtr node) {
TODO /* Handle Keys, might be done differently */ TODO /* Handle Keys, might be done differently */
break; break;
case XSLT_OP_NS: 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; break;
case XSLT_OP_ALL: 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; break;
case XSLT_OP_PREDICATE: case XSLT_OP_PREDICATE:
TODO /* Handle Predicate */ TODO /* Handle Predicate */
break; break;
case XSLT_OP_PI: 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; break;
case XSLT_OP_COMMENT: case XSLT_OP_COMMENT:
TODO /* Handle Comments() */ if (node->type != XML_COMMENT_NODE)
return(0);
break; break;
case XSLT_OP_TEXT: case XSLT_OP_TEXT:
TODO /* Handle Text() */ if ((node->type != XML_TEXT_NODE) &&
(node->type != XML_CDATA_SECTION_NODE))
return(0);
break; break;
case XSLT_OP_NODE: 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; break;
} }
} }
@@ -601,7 +673,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, int aid) {
} }
NEXT; NEXT;
PUSH(XSLT_OP_COMMENT, NULL, NULL); PUSH(XSLT_OP_COMMENT, NULL, NULL);
} else if (xmlStrEqual(name, (const xmlChar *)"comment")) { } else if (xmlStrEqual(name, (const xmlChar *)"node")) {
NEXT; NEXT;
SKIP_BLANKS; SKIP_BLANKS;
if (CUR != ')') { if (CUR != ')') {
@@ -973,7 +1045,7 @@ error:
int int
xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur) { xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur) {
xsltCompMatchPtr pat, list; xsltCompMatchPtr pat, list;
const xmlChar *name; const xmlChar *name = NULL;
xmlChar *p, *pattern, tmp; xmlChar *p, *pattern, tmp;
if ((style == NULL) || (cur == NULL)) if ((style == NULL) || (cur == NULL))

View File

@@ -2,24 +2,3 @@
SUBDIRS=REC1 REC2 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)