summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2007-01-11 03:13:13 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2007-01-11 03:13:13 +0000
commit40e7c29b35c975e4b7ff6275a9f8aaca24a4a86c (patch)
treece0476e8d46fa9bebf8b289617f3e9a521dae702 /tests
parent7581a7896fbf2d9216622b54265ed202692ea006 (diff)
downloadlibxslt-40e7c29b35c975e4b7ff6275a9f8aaca24a4a86c.tar.gz
libxslt-40e7c29b35c975e4b7ff6275a9f8aaca24a4a86c.tar.bz2
libxslt-40e7c29b35c975e4b7ff6275a9f8aaca24a4a86c.zip
added new function replace from Joel Reed. added new test case for above.
* libexslt/strings.c: added new function replace from Joel Reed. * tests/exslt/Makefile.am, replace.1.xml, replace.1.xsl, replace.1.out: added new test case for above. * libxslt.spec.in: trivial change from Gnome to GNOME * configure.in: trivial change for flags on my compilations * libxslt/documents.c, libxslt/documents.h, libxslt/keys.c, libxslt/keys.h, libxslt/variables.c, libxslt/templates.c, libxslt/transform.c, libxslt/variables.c, libxslt/xslt.c, libxslt/xsltutils.c: fixed some documentation/comments and compilation warnings - no change to logic. * re-generated the documentation. svn path=/trunk/; revision=1413
Diffstat (limited to 'tests')
-rw-r--r--tests/exslt/strings/Makefile.am3
-rw-r--r--tests/exslt/strings/replace.1.out22
-rw-r--r--tests/exslt/strings/replace.1.xml12
-rw-r--r--tests/exslt/strings/replace.1.xsl36
4 files changed, 72 insertions, 1 deletions
diff --git a/tests/exslt/strings/Makefile.am b/tests/exslt/strings/Makefile.am
index 69268027..5bdbd2a0 100644
--- a/tests/exslt/strings/Makefile.am
+++ b/tests/exslt/strings/Makefile.am
@@ -7,7 +7,8 @@ EXTRA_DIST = \
tokenize.1.xml tokenize.1.xsl tokenize.1.out \
tokenize.2.xml tokenize.2.xsl tokenize.2.out \
tokenize.3.xml tokenize.3.xsl tokenize.3.out \
- split.1.xml split.1.xsl split.1.out
+ split.1.xml split.1.xsl split.1.out \
+ replace.1.xml replace.1.xsl replace.1.out
all:
diff --git a/tests/exslt/strings/replace.1.out b/tests/exslt/strings/replace.1.out
new file mode 100644
index 00000000..076d1101
--- /dev/null
+++ b/tests/exslt/strings/replace.1.out
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<out>;
+ str:replace('a, simple, list', ', ', '-')
+ a-simple-list
+
+ str:replace('a, simple, list', 'a, ', 'the ')
+ the simple, list
+
+ str:replace('a, simple, list', 'list', 'array')
+ a, simple, array
+
+ str:replace('a, simple, list', 'i', 'I')
+ a, sImple, lIst
+
+ str:replace('a, simple, list', ', ', '')
+ asimplelist
+
+ str:replace('fee, fi, fo, fum', $x, $y)
+ tee, eye, billow, a longer string
+
+ str:replace('fee, fi, fo, fum', $x, 'j')
+ j, j, j, j</out>
diff --git a/tests/exslt/strings/replace.1.xml b/tests/exslt/strings/replace.1.xml
new file mode 100644
index 00000000..6371161f
--- /dev/null
+++ b/tests/exslt/strings/replace.1.xml
@@ -0,0 +1,12 @@
+<doc>
+ <strings>
+ <x>fee</x>
+ <x>fi</x>
+ <x>fo</x>
+ <x>fum</x>
+ <y>tee</y>
+ <y>eye</y>
+ <y>billow</y>
+ <y>a longer string</y>
+ </strings>
+</doc>
diff --git a/tests/exslt/strings/replace.1.xsl b/tests/exslt/strings/replace.1.xsl
new file mode 100644
index 00000000..0c9e86cd
--- /dev/null
+++ b/tests/exslt/strings/replace.1.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:str="http://exslt.org/strings"
+ exclude-result-prefixes="str">
+
+<xsl:template match="/">
+ <xsl:variable name="x" select="doc/strings/x"/>
+ <xsl:variable name="y" select="doc/strings/y"/>
+
+<out>;
+ str:replace('a, simple, list', ', ', '-')
+ <xsl:copy-of select="str:replace('a, simple, list', ', ', '-')"/>
+
+ str:replace('a, simple, list', 'a, ', 'the ')
+ <xsl:copy-of select="str:replace('a, simple, list', 'a, ', 'the ')"/>
+
+ str:replace('a, simple, list', 'list', 'array')
+ <xsl:copy-of select="str:replace('a, simple, list', 'list', 'array')"/>
+
+ str:replace('a, simple, list', 'i', 'I')
+ <xsl:copy-of select="str:replace('a, simple, list', 'i', 'I')"/>
+
+ str:replace('a, simple, list', ', ', '')
+ <xsl:copy-of select="str:replace('a, simple, list', ', ', '')"/>
+
+ str:replace('fee, fi, fo, fum', $x, $y)
+ <xsl:copy-of select="str:replace('fee, fi, fo, fum', $x, $y)" />
+
+ str:replace('fee, fi, fo, fum', $x, 'j')
+ <xsl:copy-of select="str:replace('fee, fi, fo, fum', $x, 'j')" />
+
+</out>
+</xsl:template>
+
+</xsl:stylesheet>