aboutsummaryrefslogtreecommitdiff
path: root/test/write_file
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-06-27 21:35:46 +0200
committerAdrian Kummerlaender2014-06-27 21:35:46 +0200
commita8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6 (patch)
tree17ccde0cd5fa5a4f632aec7a0ff11ed954e2b93f /test/write_file
parent266b408ee53b9bc7db2b1a5c92e62adfd2af6def (diff)
downloadInputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar.gz
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar.bz2
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar.lz
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar.xz
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.tar.zst
InputXSLT-a8be7f7dde5cf0d51026de0e6bc4d0f59f41c4b6.zip
Updated README.md and added "write-file" test case
* slightly improved FunctionTransform test case utility templates
Diffstat (limited to 'test/write_file')
-rw-r--r--test/write_file/reference.xml3
-rw-r--r--test/write_file/transformation.xsl26
2 files changed, 29 insertions, 0 deletions
diff --git a/test/write_file/reference.xml b/test/write_file/reference.xml
new file mode 100644
index 0000000..ba10cf5
--- /dev/null
+++ b/test/write_file/reference.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test_case>Hello world!
+</test_case>
diff --git a/test/write_file/transformation.xsl b/test/write_file/transformation.xsl
new file mode 100644
index 0000000..f65e62d
--- /dev/null
+++ b/test/write_file/transformation.xsl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="InputXSLT xalan"
+>
+
+<xsl:import href="[testcase.xsl]"/>
+
+<xsl:template name="implementation">
+ <xsl:variable name="result" select="InputXSLT:write-file('test.txt', 'Hello world!')"/>
+ <xsl:variable name="content" select="InputXSLT:read-file('test.txt')"/>
+
+ <xsl:choose>
+ <xsl:when test="$content/self::file/@result = 'success'">
+ <xsl:value-of select="$content/self::file/text()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ Error during file io
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>