Revision 48219
Added by Alessia Bardi almost 7 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/claims_openaire_2_ODF.xml | ||
---|---|---|
22 | 22 |
<xsl:output indent="yes"/> |
23 | 23 |
|
24 | 24 |
<xsl:template match="/"> |
25 |
<xsl:choose> |
|
26 |
<xsl:when test="//instance/webresource/url != ''">
|
|
25 |
<xsl:choose>
|
|
26 |
<xsl:when test="//instance/webresource/url != '' or //pid[@classid = 'doi'] != ''">
|
|
27 | 27 |
<xsl:call-template name="createRecord"/> |
28 |
<xsl:call-template name="oafFields"/> |
|
29 | 28 |
</xsl:when> |
30 | 29 |
<xsl:otherwise> |
31 | 30 |
<xsl:call-template name="skipRecord"/> |
... | ... | |
39 | 38 |
<oai:header> |
40 | 39 |
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection" |
41 | 40 |
copy-namespaces="no"/> |
41 |
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix" |
|
42 |
copy-namespaces="no"/> |
|
42 | 43 |
<dri:recordIdentifier> |
43 | 44 |
<xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/> |
44 | 45 |
</dri:recordIdentifier> |
45 | 46 |
<dr:dateOfTransformation> |
46 |
<xsl:value-of select="date:date-time()"/>
|
|
47 |
<xsl:value-of select="date:date-time()"/> |
|
47 | 48 |
</dr:dateOfTransformation> |
48 | 49 |
</oai:header> |
49 | 50 |
<oai:metadata> |
... | ... | |
59 | 60 |
copy-namespaces="no"/> |
60 | 61 |
<xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection" |
61 | 62 |
copy-namespaces="no"/> |
63 |
<xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix" |
|
64 |
copy-namespaces="no"/> |
|
62 | 65 |
<dr:dateOfTransformation> |
63 | 66 |
<xsl:value-of select="date:date-time()"/> |
64 | 67 |
</dr:dateOfTransformation> |
... | ... | |
67 | 70 |
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
68 | 71 |
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd" |
69 | 72 |
xmlns="http://datacite.org/schema/kernel-3"> |
70 |
<xsl:apply-templates/> |
|
73 |
|
|
74 |
<xsl:choose> |
|
75 |
<xsl:when test="//webresource/url != ''"> |
|
76 |
<identifier identifierType="URL"> |
|
77 |
<xsl:value-of select="./text()"/> |
|
78 |
</identifier> |
|
79 |
</xsl:when> |
|
80 |
<xsl:otherwise> |
|
81 |
<identifier identifierType="URL"> |
|
82 |
<xsl:value-of |
|
83 |
select="concat('http://dx.doi.org', '/', //pid[@classid = 'doi'][1])" |
|
84 |
/> |
|
85 |
</identifier> |
|
86 |
</xsl:otherwise> |
|
87 |
</xsl:choose> |
|
88 |
|
|
71 | 89 |
<alternateIdentifiers> |
72 |
<xsl:for-each select="oaf:result/pid[./text()]"> |
|
90 |
<xsl:for-each select="//oaf:result/pid[./text()]">
|
|
73 | 91 |
<alternateIdentifier alternateIdentifierType="{@classid}"> |
74 | 92 |
<xsl:value-of select="."/> |
75 | 93 |
</alternateIdentifier> |
76 | 94 |
</xsl:for-each> |
77 |
<xsl:for-each select="oaf:result/originalId"> |
|
95 |
<xsl:for-each select="//oaf:result/originalId">
|
|
78 | 96 |
<alternateIdentifier> |
79 | 97 |
<xsl:value-of select="."/> |
80 | 98 |
</alternateIdentifier> |
81 | 99 |
</xsl:for-each> |
82 | 100 |
</alternateIdentifiers> |
101 |
<xsl:apply-templates/> |
|
102 |
|
|
83 | 103 |
<titles> |
84 |
<xsl:for-each select="oaf:result/title/text()"> |
|
104 |
<xsl:for-each select="//oaf:result/title/text()">
|
|
85 | 105 |
<title> |
86 | 106 |
<xsl:value-of select="normalize-space(.)"/> |
87 | 107 |
</title> |
88 | 108 |
</xsl:for-each> |
89 | 109 |
</titles> |
90 | 110 |
<descriptions> |
91 |
<xsl:for-each select="oaf:result/description/text()"> |
|
111 |
<xsl:for-each select="//oaf:result/description/text()">
|
|
92 | 112 |
<description descriptionType="Abstract"> |
93 | 113 |
<xsl:value-of select="normalize-space(.)"/> |
94 | 114 |
</description> |
95 | 115 |
</xsl:for-each> |
96 | 116 |
</descriptions> |
97 | 117 |
<subjects> |
98 |
<xsl:for-each select="oaf:result/subject[./text()]"> |
|
118 |
<xsl:for-each select="//oaf:result/subject[./text()]">
|
|
99 | 119 |
<xsl:choose> |
100 | 120 |
<xsl:when test="@classname = 'keyword'"> |
101 | 121 |
<subject> |
... | ... | |
112 | 132 |
</subjects> |
113 | 133 |
<!-- Size (O) --> |
114 | 134 |
<sizes> |
115 |
<xsl:for-each select="oaf:result/size/text()"> |
|
135 |
<xsl:for-each select="//oaf:result/size/text()">
|
|
116 | 136 |
<size> |
117 | 137 |
<xsl:value-of select="."/> |
118 | 138 |
</size> |
119 | 139 |
</xsl:for-each> |
120 | 140 |
</sizes> |
121 | 141 |
</resource> |
142 |
<xsl:call-template name="oafFields"/> |
|
122 | 143 |
</oai:metadata> |
123 | 144 |
<xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/> |
124 | 145 |
</oai:record> |
125 | 146 |
</xsl:template> |
126 | 147 |
|
127 |
<!--Identifier (M) --> |
|
128 |
<xsl:template match="oaf:result//webresource/url"> |
|
129 |
<identifier identifierType="URL"> |
|
130 |
<xsl:value-of select="./text()"/> |
|
131 |
</identifier> |
|
132 |
</xsl:template> |
|
133 |
|
|
134 |
|
|
135 | 148 |
<!-- Handling relationships --> |
136 |
<xsl:template match="oaf:result/rels"> |
|
149 |
<xsl:template match="//oaf:result/rels">
|
|
137 | 150 |
<!-- Creators (M) --> |
138 | 151 |
<creators> |
139 | 152 |
<xsl:for-each select="./rel[./to/@class = 'hasAuthor']"> |
... | ... | |
167 | 180 |
|
168 | 181 |
|
169 | 182 |
<!--publisher (M) from publisher --> |
170 |
<xsl:template match="oaf:result/publisher/text()"> |
|
183 |
<xsl:template match="//oaf:result/publisher/text()">
|
|
171 | 184 |
<publisher> |
172 | 185 |
<xsl:value-of select="normalize-space(.)"/> |
173 | 186 |
</publisher> |
174 | 187 |
</xsl:template> |
175 | 188 |
|
176 | 189 |
<!-- Publication year (M) --> |
177 |
<xsl:template match="oaf:result/dateofacceptance/text()"> |
|
190 |
<xsl:template match="//oaf:result/dateofacceptance/text()">
|
|
178 | 191 |
<publicationYear> |
179 | 192 |
<xsl:value-of select="normalize-space(substring-before(., '-'))"/> |
180 | 193 |
</publicationYear> |
181 | 194 |
</xsl:template> |
182 | 195 |
|
183 | 196 |
<!-- Language (R) from language@classid --> |
184 |
<xsl:template match="oaf:result/language/@classid"> |
|
197 |
<xsl:template match="//oaf:result/language/@classid">
|
|
185 | 198 |
<language> |
186 | 199 |
<xsl:value-of select="."/> |
187 | 200 |
</language> |
... | ... | |
189 | 202 |
|
190 | 203 |
<!-- ResourceType (R) --> |
191 | 204 |
<xsl:template |
192 |
match="oaf:result/children/instance/instancetype[./@classname != 'Unknown'] | oaf:result/resourcetype[./@classname != '']">
|
|
205 |
match="//oaf:result/children/instance/instancetype[./@classname != 'Unknown'] | //oaf:result/resourcetype[./@classname != '']">
|
|
193 | 206 |
<resourceType resourceTypeGeneral="{./@classname}"/> |
194 | 207 |
</xsl:template> |
195 | 208 |
|
196 | 209 |
<!-- Version (O) --> |
197 |
<xsl:template match="oaf:result/version/text()"> |
|
210 |
<xsl:template match="//oaf:result/version/text()">
|
|
198 | 211 |
<version> |
199 | 212 |
<xsl:value-of select="."/> |
200 | 213 |
</version> |
... | ... | |
210 | 223 |
<xsl:value-of select="//oaf:result/bestlicense/@classid"/> |
211 | 224 |
</oaf:accessrights> |
212 | 225 |
<oaf:language> |
213 |
<xsl:value-of select="oaf:result/language/@classid"/> |
|
226 |
<xsl:value-of select="//oaf:result/language/@classid"/>
|
|
214 | 227 |
</oaf:language> |
215 | 228 |
<xsl:for-each select="//instance/hostedby"> |
216 | 229 |
<xsl:copy-of select="." copy-namespaces="no"/> |
... | ... | |
225 | 238 |
</xsl:stylesheet> |
226 | 239 |
|
227 | 240 |
|
241 |
|
|
228 | 242 |
]]></CODE> |
229 | 243 |
</SCRIPT> |
230 | 244 |
</CONFIGURATION> |
Also available in: Unified diff
Fixed transformation rule