summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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>