From 584831ad3ce5df9d3c7934b8d066a0c6931817f0 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 17 Jan 2001 20:04:58 +0000 Subject: [PATCH] - libxslt/transform.c libxslt/xslt.c: avoiding some problems with blank node stripping when not allowed. Daniel --- ChangeLog | 7 ++++++- libxslt/transform.c | 30 +++++++----------------------- libxslt/xslt.c | 4 +++- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53aff54..f0d5e9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -Wed Jan 17 20:15:40 CET 2001 +Wed Jan 17 21:03:01 CET 2001 Daniel Veillard + + * libxslt/transform.c libxslt/xslt.c: avoiding some problems + with blank node stripping when not allowed. + +Wed Jan 17 20:15:40 CET 2001 Daniel Veillard * libxslt/transform.c: modified apply-templates processing added select and sort support support. diff --git a/libxslt/transform.c b/libxslt/transform.c index fcfd47b..5596bf7 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -793,18 +793,6 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, return; } - /* - * Cleanup of ignorable blank node detected - */ - if (delete != NULL) { -#ifdef DEBUG_PROCESS - xsltGenericDebug(xsltGenericDebugContext, - "xsltApplyOneTemplate: removing ignorable blank node\n"); -#endif - xmlUnlinkNode(delete); - xmlFreeNode(delete); - delete = NULL; - } if (IS_XSLT_ELEM(cur)) { if (IS_XSLT_NAME(cur, "apply-templates")) { ctxt->insert = insert; @@ -844,20 +832,16 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, * For stylesheets, the set of whitespace-preserving * element names consists of just xsl:text. */ - if (!(IS_BLANK_NODE(cur))) { #ifdef DEBUG_PROCESS - xsltGenericDebug(xsltGenericDebugContext, - "xsltApplyOneTemplate: copy text %s\n", cur->content); + xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyOneTemplate: copy text %s\n", cur->content); #endif - copy = xmlCopyNode(cur, 0); - if (copy != NULL) { - xmlAddChild(insert, copy); - } else { - xsltGenericError(xsltGenericErrorContext, - "xsltApplyOneTemplate: text copy failed\n"); - } + copy = xmlCopyNode(cur, 0); + if (copy != NULL) { + xmlAddChild(insert, copy); } else { - delete = cur; + xsltGenericError(xsltGenericErrorContext, + "xsltApplyOneTemplate: text copy failed\n"); } } else if (cur->type == XML_ELEMENT_NODE) { #ifdef DEBUG_PROCESS diff --git a/libxslt/xslt.c b/libxslt/xslt.c index 25f7d9b..5f8f09f 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -491,7 +491,9 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xsltTemplatePtr ret, } } else if (cur->type == XML_TEXT_NODE) { if (IS_BLANK_NODE(cur)) { - delete = cur; + if (xmlNodeGetSpacePreserve(cur) != 1) { + delete = cur; + } } } else if (cur->type != XML_ELEMENT_NODE) { delete = cur; -- 2.7.4