summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2003-08-03 11:48:43 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2003-08-03 11:48:43 +0000
commit52f96f5ba18b641320de6db5ffda3d94d1508569 (patch)
treea0b85b2b4c7dc1a11b33e55fcfe11c098ae36cca
parent7d6a91ecb536d82c8c358a0fcd2102482626d1f8 (diff)
downloadlibxslt-52f96f5ba18b641320de6db5ffda3d94d1508569.tar.gz
libxslt-52f96f5ba18b641320de6db5ffda3d94d1508569.tar.bz2
libxslt-52f96f5ba18b641320de6db5ffda3d94d1508569.zip
Fixing Bug 116517
-rw-r--r--ChangeLog8
-rw-r--r--libxslt/templates.c20
-rw-r--r--tests/docs/Makefile.am1
-rw-r--r--tests/docs/bug-126.xml1
-rw-r--r--tests/general/Makefile.am1
-rw-r--r--tests/general/bug-126.out9
-rw-r--r--tests/general/bug-126.xsl17
7 files changed, 57 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b24f11ec..1680ddc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sun Aug 3 19:46:42 HTK 2003 William Brack <wbrack@mmm.com.hk>
+
+ Fixed bug 116517 - handling of '{' and '}'
+ * templates.c: added checks for escaping and balancing of
+ curly brackets
+ * tests/general/Makefile.am tests/docs/Makefile.am:
+ Added test case (bug-126) to regression suite.
+
Sun Aug 3 15:50:51 HKT 2003 William Brack <wbrack@mmm.com.hk>
Fixed bug 117552 - sort with multiple keys
diff --git a/libxslt/templates.c b/libxslt/templates.c
index 93c0416e..80bd063d 100644
--- a/libxslt/templates.c
+++ b/libxslt/templates.c
@@ -247,11 +247,20 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
cur = str;
while (*cur != 0) {
if (*cur == '{') {
+ if (*(cur+1) == '{') { /* escaped '{' */
+ cur++;
+ ret = xmlStrncat(ret, str, cur - str);
+ cur++;
+ str = cur;
+ continue;
+ }
ret = xmlStrncat(ret, str, cur - str);
str = cur;
cur++;
while ((*cur != 0) && (*cur != '}')) cur++;
if (*cur == 0) {
+ xsltTransformError(ctxt, NULL, NULL,
+ "xsltAttrTemplateValueProcessNode: unmatched '{'\n");
ret = xmlStrncat(ret, str, cur - str);
return(ret);
}
@@ -288,6 +297,17 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
}
cur++;
str = cur;
+ } else if (*cur == '}') {
+ cur++;
+ if (*cur == '}') { /* escaped '}' */
+ ret = xmlStrncat(ret, str, cur - str);
+ cur++;
+ str = cur;
+ continue;
+ } else {
+ xsltTransformError(ctxt, NULL, NULL,
+ "xsltAttrTemplateValueProcessNode: unmatched '}'\n");
+ }
} else
cur++;
}
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index 9ca0715d..62361d35 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -125,6 +125,7 @@ EXTRA_DIST = \
bug-123.xml \
bug-124.xml \
bug-125.xml \
+ bug-126.xml \
character.xml \
array.xml \
items.xml
diff --git a/tests/docs/bug-126.xml b/tests/docs/bug-126.xml
new file mode 100644
index 00000000..69d62f2c
--- /dev/null
+++ b/tests/docs/bug-126.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 982faa01..4091d23f 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -130,6 +130,7 @@ EXTRA_DIST = \
bug-123.out bug-123.xsl \
bug-124.out bug-124.xsl \
bug-125.out bug-125.xsl \
+ bug-126.out bug-126.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-126.out b/tests/general/bug-126.out
new file mode 100644
index 00000000..95ecafdb
--- /dev/null
+++ b/tests/general/bug-126.out
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+ <foo attr="$x"/> Expect '$x'
+ <foo attr="val"/> Expect 'val'
+ <foo attr="{$x"/> Expect 'bracket $x'
+ <foo attr="$x}"/> Expect '$x bracket'
+ <foo attr="{$x}"/> Expect 'bracket $x bracket'
+ <foo attr="{val}"/> Expect 'bracket val bracket'
+
diff --git a/tests/general/bug-126.xsl b/tests/general/bug-126.xsl
new file mode 100644
index 00000000..1fbd4062
--- /dev/null
+++ b/tests/general/bug-126.xsl
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:variable name="x" select="'val'" />
+ <xsl:template match="/">
+ <xsl:text>
+ </xsl:text>
+ <foo attr="$x"/> Expect '$x'
+ <foo attr="{$x}"/> Expect 'val'
+ <foo attr="{{$x"/> Expect 'bracket $x'
+ <foo attr="$x}}"/> Expect '$x bracket'
+ <foo attr="{{$x}}"/> Expect 'bracket $x bracket'
+ <foo attr="{{{$x}}}"/> Expect 'bracket val bracket'
+ </xsl:template>
+
+</xsl:stylesheet>