Skip to content
Snippets Groups Projects
Commit b680889ed975 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

New examples, new bugs:

- libxslt/xsltproc.c: avoid segfault when stylesheet is inproper
- libxslt/transform.c: add support for "*" to strip and preserve
  space.
Daniel
parent 4e2dc471cf84
No related branches found
No related tags found
No related merge requests found
Mon Jan 22 19:37:00 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/xsltproc.c: avoid segfault when stylesheet is inproper
* libxslt/transform.c: add support for "*" to strip and preserve
space.
Mon Jan 22 15:30:19 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* TODO: updated
......
......@@ -512,6 +512,7 @@
xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node) {
xmlNodePtr copy;
xmlNodePtr delete = NULL;
int strip_spaces = -1;
switch (node->type) {
case XML_DOCUMENT_NODE:
......@@ -545,6 +546,8 @@
(ctxt->style->stripSpaces != NULL)) {
const xmlChar *val;
if (strip_spaces == -1) {
/* TODO: add namespaces support */
val = (const xmlChar *)
xmlHashLookup(ctxt->style->stripSpaces,
node->parent->name);
......@@ -548,4 +551,14 @@
val = (const xmlChar *)
xmlHashLookup(ctxt->style->stripSpaces,
node->parent->name);
if (val != NULL) {
if (xmlStrEqual(val, (xmlChar *) "strip"))
strip_spaces = 1;
if (xmlStrEqual(val, (xmlChar *) "preserve"))
strip_spaces = 0;
}
if (strip_spaces == -1) {
val = (const xmlChar *)
xmlHashLookup(ctxt->style->stripSpaces,
(const xmlChar *)"*");
if ((val != NULL) &&
......@@ -551,5 +564,11 @@
if ((val != NULL) &&
(xmlStrEqual(val, (xmlChar *) "strip"))) {
(xmlStrEqual(val, (xmlChar *) "strip")))
strip_spaces = 1;
else
strip_spaces = 0;
}
}
if (strip_spaces == 1) {
delete = node;
break;
}
......
......@@ -49,4 +49,5 @@
else
xmlIndentTreeOutput = 0;
i++;
}
break;
......@@ -52,3 +53,4 @@
break;
}
}
......@@ -53,6 +55,6 @@
}
}
}
if (cur != NULL) {
for (;i < argc ; i++) {
doc = xmlParseFile(argv[i]);
if (doc == NULL) {
......@@ -85,5 +87,4 @@
xmlFreeDoc(res);
}
if (cur != NULL)
xsltFreeStylesheet(cur);
......@@ -89,4 +90,5 @@
xsltFreeStylesheet(cur);
}
xmlCleanupParser();
xmlMemoryDump();
return(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment