[libxslt] Fix curlies support in literals for non-compiled AVTs



commit 0dd2f5377e1d8ff94d9774b69f6ce9fb07466fef
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Nov 8 14:58:21 2010 +0100

    Fix curlies support in literals for non-compiled AVTs

 libxslt/templates.c        |   12 +++++++++++-
 tests/REC/Makefile.am      |    1 +
 tests/REC/test-7.6.2-2.out |    2 ++
 tests/REC/test-7.6.2-2.xml |    1 +
 tests/REC/test-7.6.2-2.xsl |    6 ++++++
 5 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/libxslt/templates.c b/libxslt/templates.c
index c6250dc..52bb3cf 100644
--- a/libxslt/templates.c
+++ b/libxslt/templates.c
@@ -279,7 +279,17 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
 	    ret = xmlStrncat(ret, str, cur - str);
 	    str = cur;
 	    cur++;
-	    while ((*cur != 0) && (*cur != '}')) cur++;
+	    while ((*cur != 0) && (*cur != '}')) {
+		/* Need to check for literal (bug539741) */
+		if ((*cur == '\'') || (*cur == '"')) {
+		    char delim = *(cur++);
+		    while ((*cur != 0) && (*cur != delim))
+			cur++;
+		    if (*cur != 0)
+			cur++;	/* skip the ending delimiter */
+		} else
+		    cur++;
+            }
 	    if (*cur == 0) {
 	        xsltTransformError(ctxt, NULL, inst,
 			"xsltAttrTemplateValueProcessNode: unmatched '{'\n");
diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am
index 9e228b5..0e299d2 100644
--- a/tests/REC/Makefile.am
+++ b/tests/REC/Makefile.am
@@ -65,6 +65,7 @@ EXTRA_DIST = 						\
     test-7.6.1-2.out test-7.6.1-2.xml test-7.6.1-2.xsl	\
     test-7.6.1-3.out test-7.6.1-3.xml test-7.6.1-3.xsl	\
     test-7.6.2-1.out test-7.6.2-1.xml test-7.6.2-1.xsl	\
+    test-7.6.2-2.out test-7.6.2-2.xml test-7.6.2-2.xsl	\
     test-7.7-1.out test-7.7-1.xml test-7.7-1.xsl	\
     test-7.7-2.out test-7.7-2.xml test-7.7-2.xsl	\
     test-7.7-3.out test-7.7-3.xml test-7.7-3.xsl	\
diff --git a/tests/REC/test-7.6.2-2.out b/tests/REC/test-7.6.2-2.out
new file mode 100644
index 0000000..f9301e8
--- /dev/null
+++ b/tests/REC/test-7.6.2-2.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<abc/>
diff --git a/tests/REC/test-7.6.2-2.xml b/tests/REC/test-7.6.2-2.xml
new file mode 100644
index 0000000..69d62f2
--- /dev/null
+++ b/tests/REC/test-7.6.2-2.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/REC/test-7.6.2-2.xsl b/tests/REC/test-7.6.2-2.xsl
new file mode 100644
index 0000000..c6f3aba
--- /dev/null
+++ b/tests/REC/test-7.6.2-2.xsl
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
+    <xsl:template match="/">
+        <xsl:element name="{substring('abc}', 1, 3)}"/>
+    </xsl:template>
+</xsl:stylesheet>



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