aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-21 20:30:37 +0200
committerAdrian Kummerländer2014-05-21 20:30:37 +0200
commit283101c02a7e6a71f221fe731168e9b0096e3766 (patch)
tree8dfe46ba47aaad2edc66bfef14e45ac5864a7fb0 /test/transform
parent35334241ce4b76b1b1a66219ce938f27fdf39031 (diff)
downloadInputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar.gz
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar.bz2
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar.lz
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar.xz
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.tar.zst
InputXSLT-283101c02a7e6a71f221fe731168e9b0096e3766.zip
Added test case base template and improved transformer helper template
* test case base template contains the basic test case markup ** it was mostly created to include include-path resolution into the test cases * improved transformer helper template by separating the external function call into its own variable
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/reference.xml2
-rw-r--r--test/transform/test.xsl2
-rw-r--r--test/transform/transformation.xsl48
3 files changed, 24 insertions, 28 deletions
diff --git a/test/transform/reference.xml b/test/transform/reference.xml
index b98f978..5d45081 100644
--- a/test/transform/reference.xml
+++ b/test/transform/reference.xml
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<test_case>
-<transform>
<transform_test>
<parameter_value>42</parameter_value>
</transform_test>
-</transform>
</test_case>
diff --git a/test/transform/test.xsl b/test/transform/test.xsl
index 9a1ea7a..7d4cac0 100644
--- a/test/transform/test.xsl
+++ b/test/transform/test.xsl
@@ -4,7 +4,7 @@
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"
+ exclude-result-prefixes="xalan InputXSLT"
>
<xsl:output
diff --git a/test/transform/transformation.xsl b/test/transform/transformation.xsl
index 24f4df7..fc41eb3 100644
--- a/test/transform/transformation.xsl
+++ b/test/transform/transformation.xsl
@@ -2,44 +2,42 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:dyn="http://exslt.org/dynamic"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:InputXSLT="function.inputxslt.application"
- exclude-result-prefixes="InputXSLT xalan"
+ exclude-result-prefixes="dyn xalan InputXSLT"
>
-<xsl:output
- method="xml"
- omit-xml-declaration="no"
- encoding="UTF-8"
- indent="yes"
-/>
+<xsl:include href="[testcase.xsl]"/>
<xsl:template name="transformer">
<xsl:param name="transformation"/>
<xsl:param name="target"/>
<xsl:param name="parameters"/>
- <xsl:variable name="result" select="
- InputXSLT:transform($transformation, $target, xalan:nodeset($parameters))
- "/>
+ <xsl:variable name="command">
+ InputXSLT:transform(
+ $transformation,
+ $target,
+ xalan:nodeset($parameters)
+ )
+ </xsl:variable>
+
+ <xsl:variable name="result" select="dyn:evaluate($command)"/>
</xsl:template>
-<xsl:template match="/">
-<test_case>
- <transform>
- <xsl:call-template name="transformer">
- <xsl:with-param name="transformation">test.xsl</xsl:with-param>
- <xsl:with-param name="target">test_actual.xml</xsl:with-param>
- <xsl:with-param name="parameters">
- <test>21</test>
- </xsl:with-param>
- </xsl:call-template>
+<xsl:template name="implementation">
+ <xsl:call-template name="transformer">
+ <xsl:with-param name="transformation">test.xsl</xsl:with-param>
+ <xsl:with-param name="target">test_actual.xml</xsl:with-param>
+ <xsl:with-param name="parameters">
+ <test>21</test>
+ </xsl:with-param>
+ </xsl:call-template>
- <xsl:copy-of select="
- InputXSLT:read-xml-file('test_actual.xml')/test_case/transform_test
- "/>
- </transform>
-</test_case>
+ <xsl:copy-of select="
+ InputXSLT:read-xml-file('test_actual.xml')/test_case/transform_test
+ "/>
</xsl:template>
</xsl:stylesheet>