1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
3 | xmlns:xs="http://www.w3.org/2001/XMLSchema" |
---|
4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xs functx" |
---|
5 | xmlns:cmd="http://www.clarin.eu/cmd/" xmlns:functx="http://www.functx.com"> |
---|
6 | |
---|
7 | <xsl:param name="CMDProfile" select="'clarin.eu:cr1:p_1366895758233'"/> |
---|
8 | <xsl:param name="CMDCollection" select="'PARADISEC'"/> |
---|
9 | <xsl:param name="CMDBaseURI" select="'http://www.example.com'"/> |
---|
10 | |
---|
11 | <xsl:include href="utils.xsl"/> |
---|
12 | |
---|
13 | <xsl:template match="text()"/> |
---|
14 | |
---|
15 | <xsl:template match="/collection"> |
---|
16 | <cmd:CMD CMDVersion="1.1" |
---|
17 | xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/{$CMDProfile}/xsd"> |
---|
18 | <cmd:Header> |
---|
19 | <cmd:MdCreator> |
---|
20 | <xsl:value-of |
---|
21 | select="replace(replace(base-uri(document('')),'.*/',''),'.xsl','')"/> |
---|
22 | </cmd:MdCreator> |
---|
23 | <cmd:MdCreationDate> |
---|
24 | <xsl:value-of select="format-date(current-date(),'[Y]-[M01]-[D01]')"/> |
---|
25 | </cmd:MdCreationDate> |
---|
26 | <cmd:MdSelfLink> |
---|
27 | <xsl:value-of select="cmd:createLink($CMDBaseURI,identifier)"/> |
---|
28 | </cmd:MdSelfLink> |
---|
29 | <cmd:MdProfile> |
---|
30 | <xsl:value-of select="$CMDProfile"/> |
---|
31 | </cmd:MdProfile> |
---|
32 | <cmd:MdCollectionDisplayName> |
---|
33 | <xsl:value-of select="$CMDCollection"/> |
---|
34 | </cmd:MdCollectionDisplayName> |
---|
35 | </cmd:Header> |
---|
36 | <cmd:Resources> |
---|
37 | <cmd:ResourceProxyList> |
---|
38 | <xsl:for-each select="items/item"> |
---|
39 | <cmd:ResourceProxy id="i{identifier}"> |
---|
40 | <cmd:ResourceType>Metadata</cmd:ResourceType> |
---|
41 | <cmd:ResourceRef> |
---|
42 | <xsl:value-of select="cmd:createLink($CMDBaseURI,identifier)"/> |
---|
43 | </cmd:ResourceRef> |
---|
44 | </cmd:ResourceProxy> |
---|
45 | </xsl:for-each> |
---|
46 | </cmd:ResourceProxyList> |
---|
47 | <cmd:JournalFileProxyList/> |
---|
48 | <cmd:ResourceRelationList/> |
---|
49 | </cmd:Resources> |
---|
50 | <cmd:Components> |
---|
51 | <cmd:collection> |
---|
52 | <cmd:collectionInfo> |
---|
53 | <cmd:identifier> |
---|
54 | <xsl:value-of select="cmd:notEmptyValue(identifier)"/> |
---|
55 | </cmd:identifier> |
---|
56 | <xsl:for-each select="title[cmd:exists(.)]"> |
---|
57 | <cmd:title> |
---|
58 | <xsl:value-of select="cmd:notEmptyValue(.)"/> |
---|
59 | </cmd:title> |
---|
60 | </xsl:for-each> |
---|
61 | <xsl:if test="cmd:exists(university)"> |
---|
62 | <cmd:university> |
---|
63 | <xsl:value-of select="cmd:notEmptyValue(university)"/> |
---|
64 | </cmd:university> |
---|
65 | </xsl:if> |
---|
66 | <xsl:if test="cmd:exists(description)"> |
---|
67 | <cmd:Description> |
---|
68 | <cmd:Description> |
---|
69 | <xsl:value-of select="cmd:notEmptyValue(description)"/> |
---|
70 | </cmd:Description> |
---|
71 | </cmd:Description> |
---|
72 | </xsl:if> |
---|
73 | <cmd:geographicalCoverage> |
---|
74 | <xsl:if test="cmd:exists(region)"> |
---|
75 | <cmd:Region> |
---|
76 | <xsl:value-of select="cmd:notEmptyValue(region)"/> |
---|
77 | </cmd:Region> |
---|
78 | </xsl:if> |
---|
79 | <xsl:for-each select="countries/country[cmd:exists(.)]"> |
---|
80 | <cmd:Country> |
---|
81 | <cmd:CountryName> |
---|
82 | <xsl:value-of |
---|
83 | select="cmd:notEmptyValue(.,functx:substring-before-last(.,' - '))" |
---|
84 | /> |
---|
85 | </cmd:CountryName> |
---|
86 | <cmd:CountryCoding> |
---|
87 | <xsl:value-of |
---|
88 | select="cmd:notEmptyValue(.,functx:substring-after-last(.,' - '))" |
---|
89 | /> |
---|
90 | </cmd:CountryCoding> |
---|
91 | </cmd:Country> |
---|
92 | </xsl:for-each> |
---|
93 | <cmd:geographicalLocation> |
---|
94 | <cmd:southLimit> |
---|
95 | <xsl:value-of |
---|
96 | select="cmd:notEmptyValue(geographicLocation/south_limit)"/> |
---|
97 | </cmd:southLimit> |
---|
98 | <cmd:northLimit> |
---|
99 | <xsl:value-of |
---|
100 | select="cmd:notEmptyValue(geographicLocation/north_limit)"/> |
---|
101 | </cmd:northLimit> |
---|
102 | <cmd:eastLimit> |
---|
103 | <xsl:value-of |
---|
104 | select="cmd:notEmptyValue(geographicLocation/east_limit)"/> |
---|
105 | </cmd:eastLimit> |
---|
106 | <cmd:westLimit> |
---|
107 | <xsl:value-of |
---|
108 | select="cmd:notEmptyValue(geographicLocation/west_limit)"/> |
---|
109 | </cmd:westLimit> |
---|
110 | </cmd:geographicalLocation> |
---|
111 | </cmd:geographicalCoverage> |
---|
112 | <xsl:for-each select="languages/language[cmd:exists(.)]"> |
---|
113 | <cmd:Language> |
---|
114 | <cmd:LanguageName> |
---|
115 | <xsl:value-of |
---|
116 | select="cmd:notEmptyValue(.,functx:substring-before-last(.,' - '))" |
---|
117 | /> |
---|
118 | </cmd:LanguageName> |
---|
119 | <cmd:ISO639> |
---|
120 | <cmd:iso-639-3-code> |
---|
121 | <xsl:value-of |
---|
122 | select="cmd:notEmptyValue(.,functx:substring-after-last(.,' - '))" |
---|
123 | /> |
---|
124 | </cmd:iso-639-3-code> |
---|
125 | </cmd:ISO639> |
---|
126 | </cmd:Language> |
---|
127 | </xsl:for-each> |
---|
128 | <xsl:for-each select="(collector|operator)[cmd:exists(.)]"> |
---|
129 | <cmd:Creator> |
---|
130 | <cmd:Role> |
---|
131 | <xsl:value-of select="name()"/> |
---|
132 | </cmd:Role> |
---|
133 | <cmd:Contact> |
---|
134 | <cmd:Person> |
---|
135 | <xsl:value-of |
---|
136 | select="cmd:notEmptyValue(.)" |
---|
137 | /> |
---|
138 | </cmd:Person> |
---|
139 | </cmd:Contact> |
---|
140 | </cmd:Creator> |
---|
141 | </xsl:for-each> |
---|
142 | </cmd:collectionInfo> |
---|
143 | <xsl:apply-templates select="accessInfo"/> |
---|
144 | <xsl:apply-templates select="depositInfo"/> |
---|
145 | <xsl:apply-templates select="adminInfo"/> |
---|
146 | </cmd:collection> |
---|
147 | </cmd:Components> |
---|
148 | </cmd:CMD> |
---|
149 | </xsl:template> |
---|
150 | |
---|
151 | <xsl:template match="accessInfo"> |
---|
152 | <cmd:accessInfo> |
---|
153 | <xsl:if test="exists((adminAccess/userName|adminComment)[cmd:exists(.)])"> |
---|
154 | <cmd:adminAccess> |
---|
155 | <xsl:for-each select="adminAccess/userName[cmd:exists(.)]"> |
---|
156 | <cmd:userName> |
---|
157 | <xsl:value-of select="cmd:notEmptyValue(.)"/> |
---|
158 | </cmd:userName> |
---|
159 | </xsl:for-each> |
---|
160 | <xsl:if test="cmd:exists(adminComment)"> |
---|
161 | <cmd:comment> |
---|
162 | <xsl:value-of select="cmd:notEmptyValue(adminComment)"/> |
---|
163 | </cmd:comment> |
---|
164 | </xsl:if> |
---|
165 | </cmd:adminAccess> |
---|
166 | </xsl:if> |
---|
167 | <xsl:if test="cmd:exists(dataAccessConditions)"> |
---|
168 | <cmd:dataAccess> |
---|
169 | <cmd:conditions> |
---|
170 | <xsl:value-of select="cmd:notEmptyValue(dataAccessConditions)"/> |
---|
171 | </cmd:conditions> |
---|
172 | <xsl:if test="cmd:exists(dataAccessNarrative)"> |
---|
173 | <cmd:narrative> |
---|
174 | <xsl:value-of select="cmd:notEmptyValue(dataAccessNarrative)"/> |
---|
175 | </cmd:narrative> |
---|
176 | </xsl:if> |
---|
177 | </cmd:dataAccess> |
---|
178 | </xsl:if> |
---|
179 | </cmd:accessInfo> |
---|
180 | </xsl:template> |
---|
181 | |
---|
182 | <xsl:template match="depositInfo"> |
---|
183 | <cmd:depositInfo> |
---|
184 | <xsl:if test="cmd:exists(metadataSource)"> |
---|
185 | <cmd:metadataSource> |
---|
186 | <xsl:value-of select="cmd:notEmptyValue(metadataSource)"/> |
---|
187 | </cmd:metadataSource> |
---|
188 | </xsl:if> |
---|
189 | <xsl:if test="cmd:exists(orthographicNotes)"> |
---|
190 | <cmd:orthographicNotes> |
---|
191 | <xsl:value-of select="cmd:notEmptyValue(metadataSource)"/> |
---|
192 | </cmd:orthographicNotes> |
---|
193 | </xsl:if> |
---|
194 | <xsl:if test="cmd:exists(media)"> |
---|
195 | <cmd:media> |
---|
196 | <xsl:value-of select="cmd:notEmptyValue(metadataSource)"/> |
---|
197 | </cmd:media> |
---|
198 | </xsl:if> |
---|
199 | <cmd:recordCreated> |
---|
200 | <xsl:value-of select="cmd:ISODateTime(cmd:notEmptyValue(recordCreated))"/> |
---|
201 | </cmd:recordCreated> |
---|
202 | <cmd:recordLastModified> |
---|
203 | <xsl:value-of select="cmd:ISODateTime(cmd:notEmptyValue(recordLastModified))"/> |
---|
204 | </cmd:recordLastModified> |
---|
205 | <xsl:if test="cmd:exists(adminComment)"> |
---|
206 | <cmd:adminComment> |
---|
207 | <xsl:value-of select="cmd:notEmptyValue(adminComment)"/> |
---|
208 | </cmd:adminComment> |
---|
209 | </xsl:if> |
---|
210 | </cmd:depositInfo> |
---|
211 | </xsl:template> |
---|
212 | |
---|
213 | <xsl:template match="adminInfo"> |
---|
214 | <cmd:adminInfo> |
---|
215 | <cmd:depositFormReceived> |
---|
216 | <xsl:value-of select="cmd:notEmptyValue(depositFormReceived)"/> |
---|
217 | </cmd:depositFormReceived> |
---|
218 | <xsl:if test="cmd:exists(tapeLocation)"> |
---|
219 | <cmd:tapeLocation> |
---|
220 | <xsl:value-of select="cmd:notEmptyValue(tapeLocation)"></xsl:value-of> |
---|
221 | </cmd:tapeLocation> |
---|
222 | </xsl:if> |
---|
223 | <xsl:if test="cmd:exists(fieldOfResearch)"> |
---|
224 | <cmd:fieldOfResearch> |
---|
225 | <xsl:value-of select="cmd:notEmptyValue(fieldOfResearch)"/> |
---|
226 | </cmd:fieldOfResearch> |
---|
227 | </xsl:if> |
---|
228 | <xsl:if test="cmd:exists(fundingBody)"> |
---|
229 | <cmd:fundingBody> |
---|
230 | <xsl:value-of select="cmd:notEmptyValue(fundingBody)"/> |
---|
231 | </cmd:fundingBody> |
---|
232 | </xsl:if> |
---|
233 | <xsl:if test="cmd:exists(grantIdentifier)"> |
---|
234 | <cmd:grantIdentifier> |
---|
235 | <xsl:value-of select="cmd:notEmptyValue(grantIdentifier)"/> |
---|
236 | </cmd:grantIdentifier> |
---|
237 | </xsl:if> |
---|
238 | </cmd:adminInfo> |
---|
239 | </xsl:template> |
---|
240 | |
---|
241 | </xsl:stylesheet> |
---|