[libxslt] Allow whitespace in xsl:variable with select



commit c632bf37dd2c924d20b23c46c9452d29d7739fc8
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Nov 8 11:13:17 2010 +0100

    Allow whitespace in xsl:variable with select
    
    Comments are also allowed

 libxslt/preproc.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libxslt/preproc.c b/libxslt/preproc.c
index b47d809..0e39343 100644
--- a/libxslt/preproc.c
+++ b/libxslt/preproc.c
@@ -1844,6 +1844,9 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
     comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
 	                        XSLT_NAMESPACE);
     if (comp->select != NULL) {
+#ifndef XSLT_REFACTORED
+        xmlNodePtr cur;
+#endif
 	comp->comp = xsltXPathCompile(style, comp->select);
 	if (comp->comp == NULL) {
 	    xsltTransformError(NULL, style, inst,
@@ -1851,12 +1854,25 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
 		comp->select);
 	    style->errors++;
 	}
+#ifdef XSLT_REFACTORED
 	if (inst->children != NULL) {
 	    xsltTransformError(NULL, style, inst,
-		"XSLT-variable: The must be no child nodes, since the "
+		"XSLT-variable: There must be no child nodes, since the "
 		"attribute 'select' was specified.\n");
 	    style->errors++;
 	}
+#else
+        for (cur = inst->children; cur != NULL; cur = cur->next) {
+            if (cur->type != XML_COMMENT_NODE &&
+                (cur->type != XML_TEXT_NODE || !xsltIsBlank(cur->content)))
+            {
+                xsltTransformError(NULL, style, inst,
+                    "XSLT-variable: There must be no child nodes, since the "
+                    "attribute 'select' was specified.\n");
+                style->errors++;
+            }
+        }
+#endif
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]