forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
didl.xsl
132 lines (126 loc) · 8.08 KB
/
didl.xsl
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8" ?>
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
Developed by DSpace @ Lyncode <dspace@lyncode.com>
> http://www.openarchives.org/OAI/2.0/oai_dc.xsd
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://www.lyncode.com/xoai"
version="1.0">
<xsl:output omit-xml-declaration="yes" method="xml" indent="yes" />
<xsl:template match="/">
<d:DIDL xmlns:d="urn:mpeg:mpeg21:2002:02-DIDL-NS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:mpeg:mpeg21:2002:02-DIDL-NS http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-21_schema_files/did/didl.xsd">
<xsl:if test="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='available']/doc:element/doc:field[@name='value']">
<d:DIDLInfo>
<dcterms:created xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://purl.org/dc/terms/ ">
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='available']/doc:element/doc:field/text()" />
</dcterms:created>
</d:DIDLInfo>
</xsl:if>
<d:Item>
<xsl:attribute name="id">
<xsl:value-of select="doc:metadata/doc:element[@name='others']/doc:field[@name='handle']/text()" />
</xsl:attribute>
<d:Descriptor>
<d:Statement mimeType="application/xml; charset=utf-8">
<dii:Identifier xmlns:dii="urn:mpeg:mpeg21:2002:01-DII-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:mpeg21:2002:01-DII-NS http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-21_schema_files/dii/dii.xsd">urn:hdl:<xsl:value-of select="doc:metadata/doc:element[@name='others']/doc:field[@name='handle']/text()" /></dii:Identifier>
</d:Statement>
</d:Descriptor>
<d:Descriptor>
<d:Statement mimeType="application/xml; charset=utf-8">
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='title']/doc:element/doc:field[@name='value']">
<dc:title><xsl:value-of select="." /></dc:title>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value']">
<dc:creator><xsl:value-of select="." /></dc:creator>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name!='author']/doc:element/doc:field[@name='value']">
<dc:contributor><xsl:value-of select="." /></dc:contributor>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='subject']/doc:element/doc:field[@name='value']">
<dc:subject><xsl:value-of select="." /></dc:subject>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='description']/doc:element/doc:field[@name='value']">
<dc:description><xsl:value-of select="." /></dc:description>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='description']/doc:element[@name='abstract']/doc:element/doc:field[@name='value']">
<dc:description><xsl:value-of select="." /></dc:description>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element/doc:element/doc:field[@name='value']">
<dc:date><xsl:value-of select="." /></dc:date>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element/doc:field[@name='value']">
<dc:type><xsl:value-of select="." /></dc:type>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='identifier']/doc:element/doc:element/doc:field[@name='value']">
<dc:identifier><xsl:value-of select="." /></dc:identifier>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='language']/doc:element/doc:element/doc:field[@name='value']">
<dc:language><xsl:value-of select="." /></dc:language>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='relation']/doc:element/doc:element/doc:field[@name='value']">
<dc:relation><xsl:value-of select="." /></dc:relation>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='relation']/doc:element/doc:field[@name='value']">
<dc:relation><xsl:value-of select="." /></dc:relation>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='rights']/doc:element/doc:element/doc:field[@name='value']">
<dc:rights><xsl:value-of select="." /></dc:rights>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='rights']/doc:element/doc:field[@name='value']">
<dc:rights><xsl:value-of select="." /></dc:rights>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='bitstreams']/doc:element[@name='bitstream']/doc:field[@name='format']">
<dc:format><xsl:value-of select="." /></dc:format>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='covarage']/doc:element/doc:field[@name='value']">
<dc:covarage><xsl:value-of select="." /></dc:covarage>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='covarage']/doc:element/doc:element/doc:field[@name='value']">
<dc:covarage><xsl:value-of select="." /></dc:covarage>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='publisher']/doc:element/doc:field[@name='value']">
<dc:publisher><xsl:value-of select="." /></dc:publisher>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='publisher']/doc:element/doc:element/doc:field[@name='value']">
<dc:publisher><xsl:value-of select="." /></dc:publisher>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='source']/doc:element/doc:field[@name='value']">
<dc:source><xsl:value-of select="." /></dc:source>
</xsl:for-each>
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='source']/doc:element/doc:element/doc:field[@name='value']">
<dc:source><xsl:value-of select="." /></dc:source>
</xsl:for-each>
</oai_dc:dc>
</d:Statement>
</d:Descriptor>
<xsl:for-each select="doc:metadata/doc:element[@name='bundles']/doc:element[@name='bundle']">
<xsl:if test="doc:field[@name='name']/text() = 'ORIGINAL'">
<xsl:for-each select="doc:element[@name='bitstreams']/doc:element">
<d:Component>
<xsl:attribute name="id">
<xsl:value-of select="/doc:metadata/doc:element[@name='others']/doc:field[@name='handle']/text()"></xsl:value-of>/<xsl:value-of select="doc:field[@name='sid']/text()"></xsl:value-of>
</xsl:attribute>
<d:Resource>
<xsl:attribute name="ref">
<xsl:value-of select="doc:field[@name='url']/text()"></xsl:value-of>
</xsl:attribute>
<xsl:attribute name="mimeType">
<xsl:value-of select="doc:field[@name='format']/text()"></xsl:value-of>
</xsl:attribute>
</d:Resource>
</d:Component>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</d:Item>
</d:DIDL>
</xsl:template>
</xsl:stylesheet>