diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | test/check.sh | 2 | ||||
-rw-r--r-- | test/common/testcase.xsl | 22 | ||||
-rw-r--r-- | test/default_params/reference.xml | 2 | ||||
-rw-r--r-- | test/default_params/transformation.xsl | 25 | ||||
-rw-r--r-- | test/read_directory/reference.xml | 2 | ||||
-rw-r--r-- | test/read_directory/transformation.xsl | 19 | ||||
-rw-r--r-- | test/read_file/reference.xml | 4 | ||||
-rw-r--r-- | test/read_file/transformation.xsl | 15 | ||||
-rw-r--r-- | test/read_xml_file/reference.xml | 2 | ||||
-rw-r--r-- | test/read_xml_file/transformation.xsl | 19 | ||||
-rw-r--r-- | test/transform/reference.xml | 2 | ||||
-rw-r--r-- | test/transform/test.xsl | 2 | ||||
-rw-r--r-- | test/transform/transformation.xsl | 48 |
14 files changed, 69 insertions, 96 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7722264..e346613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ set( src/function/read_xml_file.cc src/function/read_directory.cc src/function/transform.cc - src/function/resolve_include.cc src/support/filesystem_context.cc src/support/stylesheet_parameter_guard.cc src/support/xalan_string.cc diff --git a/test/check.sh b/test/check.sh index fd537d7..84687bf 100755 --- a/test/check.sh +++ b/test/check.sh @@ -9,7 +9,7 @@ do cd $testcase rm -f actual.xml - ./../../build/test --transformation transformation.xsl --target actual.xml + ./../../build/test --transformation transformation.xsl --target actual.xml --include ../common/ diff -u reference.xml actual.xml if [ $? = 0 ] diff --git a/test/common/testcase.xsl b/test/common/testcase.xsl new file mode 100644 index 0000000..70bfa3a --- /dev/null +++ b/test/common/testcase.xsl @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:InputXSLT="function.inputxslt.application" + exclude-result-prefixes="InputXSLT" +> + +<xsl:output + method="xml" + omit-xml-declaration="no" + encoding="UTF-8" + indent="yes" +/> + +<xsl:template match="/"> +<test_case> + <xsl:call-template name="implementation"/> +</test_case> +</xsl:template> + +</xsl:stylesheet> diff --git a/test/default_params/reference.xml b/test/default_params/reference.xml index fcdbacf..566064b 100644 --- a/test/default_params/reference.xml +++ b/test/default_params/reference.xml @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <test_case> -<default_params> <target_file>actual.xml</target_file> <parent_directory>default_params</parent_directory> -</default_params> </test_case> diff --git a/test/default_params/transformation.xsl b/test/default_params/transformation.xsl index 1bbddef..0ffaea0 100644 --- a/test/default_params/transformation.xsl +++ b/test/default_params/transformation.xsl @@ -6,27 +6,18 @@ exclude-result-prefixes="InputXSLT" > -<xsl:output - method="xml" - omit-xml-declaration="no" - encoding="UTF-8" - indent="yes" -/> +<xsl:include href="[testcase.xsl]"/> <xsl:param name="target-file"/> <xsl:param name="parent-directory"/> -<xsl:template match="/"> -<test_case> - <default_params> - <target_file> - <xsl:value-of select="$target-file"/> - </target_file> - <parent_directory> - <xsl:value-of select="$parent-directory"/> - </parent_directory> - </default_params> -</test_case> +<xsl:template name="implementation"> + <target_file> + <xsl:value-of select="$target-file"/> + </target_file> + <parent_directory> + <xsl:value-of select="$parent-directory"/> + </parent_directory> </xsl:template> </xsl:stylesheet> diff --git a/test/read_directory/reference.xml b/test/read_directory/reference.xml index 8252569..a7192ea 100644 --- a/test/read_directory/reference.xml +++ b/test/read_directory/reference.xml @@ -1,11 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <test_case> -<function_read_directory> <item>common</item> <item>default_params</item> <item>read_directory</item> <item>read_file</item> <item>read_xml_file</item> <item>transform</item> -</function_read_directory> </test_case> diff --git a/test/read_directory/transformation.xsl b/test/read_directory/transformation.xsl index d3c21f1..3a4d162 100644 --- a/test/read_directory/transformation.xsl +++ b/test/read_directory/transformation.xsl @@ -6,21 +6,12 @@ exclude-result-prefixes="InputXSLT" > -<xsl:output - method="xml" - omit-xml-declaration="no" - encoding="UTF-8" - indent="yes" -/> +<xsl:include href="[testcase.xsl]"/> -<xsl:template match="/"> -<test_case> - <function_read_directory> - <xsl:for-each select="InputXSLT:read-directory('../')[@type='directory']"> - <item><xsl:value-of select="."/></item> - </xsl:for-each> - </function_read_directory> -</test_case> +<xsl:template name="implementation"> + <xsl:for-each select="InputXSLT:read-directory('../')[@type='directory']"> + <item><xsl:value-of select="."/></item> + </xsl:for-each> </xsl:template> </xsl:stylesheet> diff --git a/test/read_file/reference.xml b/test/read_file/reference.xml index 7cbcc95..0bca6f7 100644 --- a/test/read_file/reference.xml +++ b/test/read_file/reference.xml @@ -1,11 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<test_case> -<function_read_file><?xml version="1.0"?> +<test_case><?xml version="1.0"?> <tester> <eintrag>Hello 1</eintrag> <eintrag>Hello 2</eintrag> <eintrag>Hello 3</eintrag> <eintrag>Hello 4</eintrag> </tester> -</function_read_file> </test_case> diff --git a/test/read_file/transformation.xsl b/test/read_file/transformation.xsl index 96b8976..e17734e 100644 --- a/test/read_file/transformation.xsl +++ b/test/read_file/transformation.xsl @@ -6,19 +6,10 @@ exclude-result-prefixes="InputXSLT" > -<xsl:output - method="xml" - omit-xml-declaration="no" - encoding="UTF-8" - indent="yes" -/> +<xsl:include href="[testcase.xsl]"/> -<xsl:template match="/"> -<test_case> - <function_read_file> - <xsl:value-of select="InputXSLT:read-file('../common/test.txt')"/> - </function_read_file> -</test_case> +<xsl:template name="implementation"> + <xsl:value-of select="InputXSLT:read-file('../common/test.txt')"/> </xsl:template> </xsl:stylesheet> diff --git a/test/read_xml_file/reference.xml b/test/read_xml_file/reference.xml index d82dc9c..26b5f82 100644 --- a/test/read_xml_file/reference.xml +++ b/test/read_xml_file/reference.xml @@ -1,9 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <test_case> -<function_read_xml_file> <item>Hello 1</item> <item>Hello 2</item> <item>Hello 3</item> <item>Hello 4</item> -</function_read_xml_file> </test_case> diff --git a/test/read_xml_file/transformation.xsl b/test/read_xml_file/transformation.xsl index ba6fed1..e0a3794 100644 --- a/test/read_xml_file/transformation.xsl +++ b/test/read_xml_file/transformation.xsl @@ -6,21 +6,12 @@ exclude-result-prefixes="InputXSLT" > -<xsl:output - method="xml" - omit-xml-declaration="no" - encoding="UTF-8" - indent="yes" -/> +<xsl:include href="[testcase.xsl]"/> -<xsl:template match="/"> -<test_case> - <function_read_xml_file> - <xsl:for-each select="InputXSLT:read-xml-file('../common/test.txt')/tester/eintrag"> - <item><xsl:value-of select="."/></item> - </xsl:for-each> - </function_read_xml_file> -</test_case> +<xsl:template name="implementation"> + <xsl:for-each select="InputXSLT:read-xml-file('../common/test.txt')/tester/eintrag"> + <item><xsl:value-of select="."/></item> + </xsl:for-each> </xsl:template> </xsl:stylesheet> 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> |