aboutsummaryrefslogtreecommitdiff
path: root/test/transform/transformation.xsl
blob: 7cfb8f987bd49619bc768b69f25d160f137c320b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?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="transformer">
	<xsl:param name="input"/>
	<xsl:param name="transformation"/>

	<xsl:copy-of select="InputXSLT:transform(
		$input,
		string($transformation)
	)"/>
</xsl:template>

<xsl:template name="implementation">
	<xsl:variable name="result">
		<xsl:call-template name="transformer">
			<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:call-template>
	</xsl:variable>

	<xsl:variable name="transformation" select="xalan:nodeset($result)/transformation"/>

	<xsl:choose>
		<xsl:when test="$transformation/@result = 'success'">
			<xsl:copy-of select="$transformation/test_case/transform_test/*"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:copy-of select="$transformation/*"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

</xsl:stylesheet>