summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2010-11-08 14:58:21 +0100
committerDaniel Veillard <veillard@redhat.com>2010-11-08 14:58:21 +0100
commit0dd2f5377e1d8ff94d9774b69f6ce9fb07466fef (patch)
treea9695d13e6bd8cc0030ffd253c4db857e19c3aeb
parent0d6713d715509da1fec27bec220d43aa4fc48d0f (diff)
downloadlibxslt-0dd2f5377e1d8ff94d9774b69f6ce9fb07466fef.tar.gz
Fix curlies support in literals for non-compiled AVTs
-rw-r--r--libxslt/templates.c12
-rw-r--r--tests/REC/Makefile.am1
-rw-r--r--tests/REC/test-7.6.2-2.out2
-rw-r--r--tests/REC/test-7.6.2-2.xml1
-rw-r--r--tests/REC/test-7.6.2-2.xsl6
5 files changed, 21 insertions, 1 deletions
diff --git a/libxslt/templates.c b/libxslt/templates.c
index c6250dc4..52bb3cf3 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 9e228b57..0e299d21 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 00000000..f9301e89
--- /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 00000000..69d62f2c
--- /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 00000000..c6f3abac
--- /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>