[xslt] <text> bug.



Hi,
I am trying to hack mod_xslt to make it work with libxslt
(currently it uses sablotron).

When parsing my .xslts which include

<xsl:text disable-output-escaping="yes"><![CDATA[<]]>
!--#include virtual="/micronavi.ehtml"--<![CDATA[>]]></xsl:text>

I got: 'xsltParseTemplateContent: xslt:text content problem'
A while later I found that any <text> node which consists of CDATA section
and some text after or before it gives an error.

The problem is that if we have something like this: <![CDATA[<]]>aaa
CDATA is node n and 'aaa' is n->next (!) ...
So checking 'if n->next != NULL ... break;' is, IMHO, wrong in this case.

I attach a little patch to fix this problem :-)

cheers.

-- 
Michal Sajdak --> xterm --> LinuxNews Team.
GPG fingerprint = E320 1FE0 1E4B 0F3A DA9F  4C87 7F7E D6FD 1273 2326
http://urtica.linuxnews.pl/~xterm/key/
diff -ur libxslt-0.13.0/libxslt/transform.c libxslt-0.13.0a/libxslt/transform.c
--- libxslt-0.13.0/libxslt/transform.c	Tue Jun 26 04:55:08 2001
+++ libxslt-0.13.0a/libxslt/transform.c	Mon Jul  2 18:07:51 2001
@@ -1604,9 +1604,8 @@
 	xmlNodePtr copy;
 
 	while (text != NULL) {
-	    if (((text->type != XML_TEXT_NODE) &&
-		 (text->type != XML_CDATA_SECTION_NODE)) ||
-		(text->next != NULL)) {
+	    if ((text->type != XML_TEXT_NODE) &&
+	         (text->type != XML_CDATA_SECTION_NODE)) {
 		xsltGenericError(xsltGenericErrorContext,
 				 "xsl:text content problem\n");
 		break;
diff -ur libxslt-0.13.0/libxslt/xslt.c libxslt-0.13.0a/libxslt/xslt.c
--- libxslt-0.13.0/libxslt/xslt.c	Tue Jun 26 04:55:08 2001
+++ libxslt-0.13.0a/libxslt/xslt.c	Mon Jul  2 18:07:36 2001
@@ -1043,9 +1043,8 @@
 		    }
 
 		    while (text != NULL) {
-			if (((text->type != XML_TEXT_NODE) &&
-			     (text->type != XML_CDATA_SECTION_NODE)) ||
-			    (text->next != NULL)) {
+			if ((text->type != XML_TEXT_NODE) &&
+			     (text->type != XML_CDATA_SECTION_NODE)) {
 			    xsltGenericError(xsltGenericErrorContext,
 		 "xsltParseTemplateContent: xslt:text content problem\n");
 			    style->errors++;


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