diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common/test.xsl (renamed from test/transform/test.xsl) | 0 | ||||
-rw-r--r-- | test/generate/reference.xml | 10 | ||||
-rw-r--r-- | test/generate/transformation.xsl | 58 | ||||
-rw-r--r-- | test/read_directory/reference.xml | 3 | ||||
-rw-r--r-- | test/transform/transformation.xsl | 2 |
5 files changed, 72 insertions, 1 deletions
diff --git a/test/transform/test.xsl b/test/common/test.xsl index a9f04a5..a9f04a5 100644 --- a/test/transform/test.xsl +++ b/test/common/test.xsl diff --git a/test/generate/reference.xml b/test/generate/reference.xml new file mode 100644 index 0000000..1c702e8 --- /dev/null +++ b/test/generate/reference.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<test_case> +<input_entries> +<entry>Hello 1</entry> +<entry>Hello 2</entry> +<entry>Hello 3</entry> +<entry>Hello 4</entry> +</input_entries> +<parameter_value>42</parameter_value> +</test_case> diff --git a/test/generate/transformation.xsl b/test/generate/transformation.xsl new file mode 100644 index 0000000..6e3d88b --- /dev/null +++ b/test/generate/transformation.xsl @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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="dyn xalan InputXSLT" +> + +<xsl:import href="[testcase.xsl]"/> + +<xsl:template name="generator"> + <xsl:param name="input"/> + <xsl:param name="transformation"/> + <xsl:param name="target"/> + + <xsl:copy-of select="InputXSLT:generate( + $input, + string($transformation), + string($target) + )"/> +</xsl:template> + +<xsl:template name="implementation"> + <xsl:variable name="result"> + <xsl:call-template name="generator"> + <xsl:with-param name="input"> + <test> + <entries> + <entry>Hello 1</entry> + <entry>Hello 2</entry> + <entry>Hello 3</entry> + <entry>Hello 4</entry> + </entries> + <parameter> + <test>21</test> + </parameter> + </test> + </xsl:with-param> + <xsl:with-param name="transformation">[test.xsl]</xsl:with-param> + <xsl:with-param name="target">test_actual.xml</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="generation" select="xalan:nodeset($result)/generation"/> + + <xsl:choose> + <xsl:when test="$generation/@result = 'success'"> + <xsl:copy-of select="InputXSLT:read-file('test_actual.xml')/test_case/transform_test/*"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$generation/*"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/test/read_directory/reference.xml b/test/read_directory/reference.xml index 7d63a85..d2d9d1b 100644 --- a/test/read_directory/reference.xml +++ b/test/read_directory/reference.xml @@ -14,6 +14,9 @@ <name>external_text_formatter</name> </item> <item type="directory"> +<name>generate</name> +</item> +<item type="directory"> <name>read_directory</name> </item> <item type="directory"> diff --git a/test/transform/transformation.xsl b/test/transform/transformation.xsl index 7cfb8f9..247a4c6 100644 --- a/test/transform/transformation.xsl +++ b/test/transform/transformation.xsl @@ -36,7 +36,7 @@ </parameter> </test> </xsl:with-param> - <xsl:with-param name="transformation">test.xsl</xsl:with-param> + <xsl:with-param name="transformation">[test.xsl]</xsl:with-param> </xsl:call-template> </xsl:variable> |