aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-17 13:59:33 +0200
committerAdrian Kummerländer2014-05-17 13:59:33 +0200
commit246a8e020d97cfc3b4409996f99450fa95b730b1 (patch)
tree85dd9b1dc7bf739ba8bc32cae007b983e19f0fb9 /test/transform
parente7f9b4789d5b0971a14ac00c9bc834f7154ccb9f (diff)
downloadInputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar.gz
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar.bz2
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar.lz
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar.xz
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.tar.zst
InputXSLT-246a8e020d97cfc3b4409996f99450fa95b730b1.zip
Improved FunctionTransform test case transformations
* added basic "transformer" wrapper template to call "InputXSLT:transform" ** this removes the need to specifiy arguments in a separate xslt variable
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/reference.xml40
-rw-r--r--test/transform/test.xsl11
-rw-r--r--test/transform/transformation.xsl26
3 files changed, 22 insertions, 55 deletions
diff --git a/test/transform/reference.xml b/test/transform/reference.xml
index d3675bc..b98f978 100644
--- a/test/transform/reference.xml
+++ b/test/transform/reference.xml
@@ -2,45 +2,7 @@
<test_case>
<transform>
<transform_test>
-<argument_value>42</argument_value>
-<transformation_content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
-&lt;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"
-&gt;
-
-&lt;xsl:output
- method="xml"
- omit-xml-declaration="no"
- encoding="UTF-8"
- indent="yes"
-/&gt;
-
-&lt;xsl:template match="/"&gt;
-&lt;test_case&gt;
- &lt;transform&gt;
- &lt;xsl:variable name="argument"&gt;
- &lt;key&gt;test&lt;/key&gt;
- &lt;value&gt;42&lt;/value&gt;
- &lt;/xsl:variable&gt;
-
- &lt;xsl:variable
- name = "result"
- select = "InputXSLT:transform('test.xsl', 'test_actual.xml', $argument)"
- /&gt;
-
- &lt;xsl:copy-of select="
- InputXSLT:read-xml-file('test_actual.xml')/test_case/transform_test
- "/&gt;
- &lt;/transform&gt;
-&lt;/test_case&gt;
-&lt;/xsl:template&gt;
-
-&lt;/xsl:stylesheet&gt;
-</transformation_content>
+<parameter_value>42</parameter_value>
</transform_test>
</transform>
</test_case>
diff --git a/test/transform/test.xsl b/test/transform/test.xsl
index 677e80d..9a1ea7a 100644
--- a/test/transform/test.xsl
+++ b/test/transform/test.xsl
@@ -14,17 +14,14 @@
indent="yes"
/>
-<xsl:param name="arguments"/>
+<xsl:param name="parameters"/>
<xsl:template match="/">
<test_case>
<transform_test>
- <argument_value>
- <xsl:value-of select="xalan:nodeset($arguments)/value"/>
- </argument_value>
- <transformation_content>
- <xsl:value-of select="InputXSLT:read-file('transformation.xsl')"/>
- </transformation_content>
+ <parameter_value>
+ <xsl:value-of select="$parameters/test * 2"/>
+ </parameter_value>
</transform_test>
</test_case>
</xsl:template>
diff --git a/test/transform/transformation.xsl b/test/transform/transformation.xsl
index 7348fef..24f4df7 100644
--- a/test/transform/transformation.xsl
+++ b/test/transform/transformation.xsl
@@ -14,18 +14,26 @@
indent="yes"
/>
+<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:template>
+
<xsl:template match="/">
<test_case>
<transform>
- <xsl:variable name="argument">
- <key>test</key>
- <value>42</value>
- </xsl:variable>
-
- <xsl:variable
- name = "result"
- select = "InputXSLT:transform('test.xsl', 'test_actual.xml', $argument)"
- />
+ <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