-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMediaConchCSV.xsl
More file actions
55 lines (55 loc) · 2.14 KB
/
MediaConchCSV.xsl
File metadata and controls
55 lines (55 loc) · 2.14 KB
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"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mc="https://mediaarea.net/mediaconch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" extension-element-prefixes="xsi">
<xsl:output encoding="UTF-8" method="text" version="1.0" indent="yes"/>
<xsl:template match="/mc:MediaConch">
<xsl:text>filename</xsl:text>
<xsl:for-each select="mc:media[1]/mc:policy/mc:policy|mc:media[1]/mc:policy/mc:rule|mc:media[1]/mc:rule|mc:media[1]/mc:implementationChecks/mc:check">
<xsl:text>,</xsl:text>
<xsl:choose>
<xsl:when test="local-name()='check'">
<xsl:value-of select="@icid"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>"</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="mc:media">
<xsl:text>
</xsl:text>
<xsl:call-template name="escapecommas">
<xsl:with-param name="text" select="@ref"/>
</xsl:call-template>
<xsl:for-each select="mc:policy/mc:policy|mc:policy/mc:rule|mc:rule">
<xsl:text>,</xsl:text>
<xsl:value-of select="@outcome"/>
</xsl:for-each>
<xsl:for-each select="mc:implementationChecks/mc:check">
<xsl:text>,</xsl:text>
<xsl:choose>
<xsl:when test="@fail_count = '0'">pass</xsl:when>
<xsl:when test="@fail_count > '0'">fail</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="escapecommas">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="$text = ''" >
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:when test="contains($text, ',')">
<xsl:value-of select="substring-before($text,',')"/>
<xsl:text>\,</xsl:text>
<xsl:call-template name="escapecommas">
<xsl:with-param name="text" select="substring-after($text,',')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>