aboutsummaryrefslogtreecommitdiff
path: root/test/read_directory/transformation.xsl
blob: f1446a287e970a3de75d6eb420844eebae945de5 (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
<?xml version="1.0" encoding="UTF-8"?>
<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"
>

<xsl:include href="[testcase.xsl]"/>

<xsl:template name="implementation">
	<xsl:variable name="result">
		<xsl:copy-of select="InputXSLT:read-directory('../')"/>
	</xsl:variable>

	<xsl:choose>
		<xsl:when test="xalan:nodeset($result)/directory/@result = 'success'">
			<xsl:for-each select="xalan:nodeset($result)/directory/entry">
				<item type="{@type}">
					<name><xsl:value-of select="./name"/></name>

					<xsl:if test="@type='file' and ./name='check'">
						<extension><xsl:value-of select="./extension"/></extension>
					</xsl:if>
				</item>
			</xsl:for-each>
		</xsl:when>
		<xsl:otherwise>
			Error during directory io
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

</xsl:stylesheet>