diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/exslt/strings/replace.1.out | 12 | ||||
-rw-r--r-- | tests/exslt/strings/replace.1.xml | 4 | ||||
-rw-r--r-- | tests/exslt/strings/replace.1.xsl | 13 |
3 files changed, 28 insertions, 1 deletions
diff --git a/tests/exslt/strings/replace.1.out b/tests/exslt/strings/replace.1.out index 076d1101..f41d67cc 100644 --- a/tests/exslt/strings/replace.1.out +++ b/tests/exslt/strings/replace.1.out @@ -1,5 +1,9 @@ <?xml version="1.0"?> <out>; + result nodes: 1 + result text nodes: 1 + result string: a + str:replace('a, simple, list', ', ', '-') a-simple-list @@ -19,4 +23,10 @@ tee, eye, billow, a longer string str:replace('fee, fi, fo, fum', $x, 'j') - j, j, j, j</out> + j, , , + + str:replace('foo', '', 'baz') + fbazobazo + + str:replace('Price is $1.10', $from, $to) + Price is \$1.10</out> diff --git a/tests/exslt/strings/replace.1.xml b/tests/exslt/strings/replace.1.xml index 6371161f..16aac14c 100644 --- a/tests/exslt/strings/replace.1.xml +++ b/tests/exslt/strings/replace.1.xml @@ -8,5 +8,9 @@ <y>eye</y> <y>billow</y> <y>a longer string</y> + <from>$</from> + <from>\</from> + <to>\$</to> + <to>$\backslash$</to> </strings> </doc> diff --git a/tests/exslt/strings/replace.1.xsl b/tests/exslt/strings/replace.1.xsl index 0c9e86cd..f9a74423 100644 --- a/tests/exslt/strings/replace.1.xsl +++ b/tests/exslt/strings/replace.1.xsl @@ -7,8 +7,15 @@ <xsl:template match="/"> <xsl:variable name="x" select="doc/strings/x"/> <xsl:variable name="y" select="doc/strings/y"/> + <xsl:variable name="from" select="doc/strings/from"/> + <xsl:variable name="to" select="doc/strings/to"/> + <xsl:variable name="result" select="str:replace('a', 'b', 'c')"/> <out>; + result nodes: <xsl:value-of select="count($result)"/> + result text nodes: <xsl:value-of select="count($result/self::text())"/> + result string: <xsl:value-of select="$result/self::text()"/> + str:replace('a, simple, list', ', ', '-') <xsl:copy-of select="str:replace('a, simple, list', ', ', '-')"/> @@ -30,6 +37,12 @@ str:replace('fee, fi, fo, fum', $x, 'j') <xsl:copy-of select="str:replace('fee, fi, fo, fum', $x, 'j')" /> + str:replace('foo', '', 'baz') + <xsl:copy-of select="str:replace('foo', '', 'baz')" /> + + str:replace('Price is $1.10', $from, $to) + <xsl:copy-of select="str:replace('Price is $1.10', $from, $to)" /> + </out> </xsl:template> |