Test Coverage Report

Stylesheet: /build/src/main/resources/xslt/lib/makeUrlFromSource.xslt

module: /build/src/main/resources/xslt/lib/makeUrlFromSource.xslt; 34 lines

01: <?xml version="1.0" encoding="UTF-8"?>
02: <xsl:stylesheet
03: 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
04: 	version='2.0'
05: 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
06: 	xmlns:zenta="http://magwas.rulez.org/zenta">
07: 
08: 
09: 	<xsl:param name="zentasources" select="document(concat($targetdir,'/.zentasources'))"/>
10: 	<xsl:param name="targetdir"/>
11: 	<xsl:function name="zenta:makeUrlFromSource">
12: 		<xsl:param name="locator"/>
13: 		<xsl:variable name="folder" select="tokenize($locator,'/')[1]"/>
14: 		<xsl:variable name="path" select="string-join(tokenize($locator,'/')[position()>1],'/')"/>
15: 		<xsl:variable name="source" select="$zentasources//source[@name=$folder]"/>
16: 		<xsl:variable name="type" select="$source/@type"/>
17: 		<xsl:choose>
18: 			<xsl:when test="$type = 'uri'">
19: 				<xsl:value-of select="concat($source/@uri,'/',$path)"/>
20: 			</xsl:when>
21: 			<xsl:when test="$type = 'folder'">
22: 				<xsl:value-of select="concat('file://',$targetdir,'/', $source/@uri,'/',$path)"/>
23: 			</xsl:when>
24: 			<xsl:when test="$type = 'github'">
25: 				<xsl:value-of select="concat('file://',$targetdir,'/', 'inputs/',$source/@repo,'/',$source/@path,'/',$path)"/>
26: 			</xsl:when>
27: 			<xsl:otherwise>
28: 				<xsl:value-of select="error(QName('http://magwas.rulez/org/zenta', 'zenta:nosuchtype'), concat('unknown type for ',$locator, ' type:', $type))"/>
29: 			</xsl:otherwise>
30: 		</xsl:choose>
31: 	</xsl:function>
32: 
33: </xsl:stylesheet>
34: