1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:datetime="http://exslt.org/dates-and-times"
|
4
|
xmlns:exslt="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan"
|
5
|
xmlns:efg="http://www.europeanfilmgateway.eu/efg" version="1.0"
|
6
|
exclude-result-prefixes="xsl datetime exslt xsi xalan">
|
7
|
|
8
|
<!-- <xsl:param name="links" /> -->
|
9
|
|
10
|
<xsl:output method="xml" indent="yes"/>
|
11
|
<xsl:template match="/">
|
12
|
<xsl:apply-templates select="*"/>
|
13
|
</xsl:template>
|
14
|
|
15
|
<xsl:template match="/record/links"/>
|
16
|
|
17
|
<xsl:template match="efg:person|efg:avcreation|efg:nonavcreation">
|
18
|
<xsl:copy>
|
19
|
<xsl:apply-templates select="*|@*|text()"/>
|
20
|
|
21
|
<xsl:for-each select="/record/links/link">
|
22
|
<xsl:call-template name="buildRelation">
|
23
|
<xsl:with-param name="type" select="@type"/>
|
24
|
<xsl:with-param name="target" select="@target"/>
|
25
|
<xsl:with-param name="name" select="@name"/>
|
26
|
<xsl:with-param name="title" select="@title"/>
|
27
|
</xsl:call-template>
|
28
|
</xsl:for-each>
|
29
|
|
30
|
</xsl:copy>
|
31
|
</xsl:template>
|
32
|
|
33
|
<xsl:template match="*|@*|text()">
|
34
|
<xsl:copy>
|
35
|
<xsl:apply-templates select="*|@*|text()"/>
|
36
|
</xsl:copy>
|
37
|
</xsl:template>
|
38
|
|
39
|
<xsl:template name="buildRelation">
|
40
|
<xsl:param name="type"/>
|
41
|
<xsl:param name="target"/>
|
42
|
<xsl:param name="name"/>
|
43
|
<xsl:param name="title"/>
|
44
|
|
45
|
<xsl:if test="not(/record/metadata/efg:efgEntity/efg:*/efg:*[local-name()=$type]/efg:identifier[normalize-space(text()) = $target])">
|
46
|
<xsl:element name="efg:{$type}">
|
47
|
|
48
|
<!-- HACK michele -->
|
49
|
<xsl:if test="($type = 'relAvCreation') or ($type = 'relNonAVCreation')">
|
50
|
<efg:hasItems>true</efg:hasItems>
|
51
|
</xsl:if>
|
52
|
<!-- FINE HACK -->
|
53
|
|
54
|
<efg:identifier>
|
55
|
<xsl:value-of select="$target"/>
|
56
|
</efg:identifier>
|
57
|
<xsl:if test="$name">
|
58
|
<efg:name>
|
59
|
<xsl:value-of select="$name"/>
|
60
|
</efg:name>
|
61
|
</xsl:if>
|
62
|
<xsl:if test="$title">
|
63
|
<efg:title>
|
64
|
<xsl:value-of select="$title"/>
|
65
|
</efg:title>
|
66
|
</xsl:if>
|
67
|
</xsl:element>
|
68
|
</xsl:if>
|
69
|
|
70
|
</xsl:template>
|
71
|
|
72
|
</xsl:stylesheet>
|