Revision 42470
Added by Alessia Bardi over 8 years ago
nsf_2_db.xsl | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
|
3 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions">
|
|
2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
3 |
> |
|
4 | 4 |
|
5 | 5 |
<xsl:param name="parentDatasourceId" /> |
6 | 6 |
<xsl:param name="namespacePrefix" select="string('nsf_________')" /> |
7 | 7 |
|
8 | 8 |
<xsl:template match="/"> |
9 |
<record xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
10 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" |
|
11 |
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
12 |
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"> |
|
9 |
<record |
|
10 |
> |
|
13 | 11 |
|
14 | 12 |
<xsl:copy-of select=".//*[local-name()='header']"/> |
15 | 13 |
<metadata> |
... | ... | |
129 | 127 |
</xsl:if> |
130 | 128 |
</xsl:for-each> |
131 | 129 |
--> |
130 |
|
|
132 | 131 |
|
133 | 132 |
<xsl:for-each select="//funding"> |
134 |
<xsl:variable name="p1" select="normalize-space(./orgDirectorateAbbr)" /> |
|
135 |
<xsl:variable name="p2" select="normalize-space(./orgDivisionAbbr)" /> |
|
136 |
|
|
137 |
<xsl:if test="string-length($p1) > 0"> |
|
133 |
<xsl:variable name="directorate" select="normalize-space(./orgDirectorateAbbr)"/> |
|
134 |
<xsl:variable name="division" select="normalize-space(./orgDivisionAbbr)"/> |
|
135 |
<xsl:variable name="fundingId"> |
|
138 | 136 |
<xsl:choose> |
139 |
<xsl:when test="string-length($p2) > 0">
|
|
140 |
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::', $p1, '::', $p2)"/>
|
|
141 |
<ROW table="project_fundingpath">
|
|
142 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD>
|
|
143 |
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
|
144 |
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
|
145 |
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
|
146 |
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
|
147 |
</ROW>
|
|
137 |
<xsl:when test="string-length($directorate) > 0">
|
|
138 |
<xsl:choose>
|
|
139 |
<xsl:when test="string-length($division) > 0">
|
|
140 |
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate, '::', $division)"/>
|
|
141 |
</xsl:when>
|
|
142 |
<xsl:otherwise>
|
|
143 |
<xsl:value-of select="concat($namespacePrefix, '::NSF::', $directorate)"/>
|
|
144 |
</xsl:otherwise>
|
|
145 |
</xsl:choose>
|
|
148 | 146 |
</xsl:when> |
149 | 147 |
<xsl:otherwise> |
150 |
<xsl:variable name="fundingId" select="concat($namespacePrefix, '::NSF::', $p1)"/> |
|
151 |
<ROW table="project_fundingpath"> |
|
152 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId,'@@', $projectId)" /></FIELD> |
|
153 |
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD> |
|
154 |
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD> |
|
155 |
<FIELD name="startdate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$startDate" /></FIELD> |
|
156 |
<FIELD name="enddate" type="date" format="MM/dd/yyyy"><xsl:value-of select="$endDate" /></FIELD> |
|
157 |
</ROW> |
|
148 |
<xsl:value-of select="concat($namespacePrefix, '::NSF')"/> |
|
158 | 149 |
</xsl:otherwise> |
159 | 150 |
</xsl:choose> |
160 |
</xsl:if> |
|
151 |
</xsl:variable> |
|
152 |
|
|
153 |
<ROW table="project_fundingpath"> |
|
154 |
<FIELD name="_dnet_resource_identifier_"> |
|
155 |
<xsl:value-of select="concat($fundingId,'@@', $projectId)"/> |
|
156 |
</FIELD> |
|
157 |
<FIELD name="funding"> |
|
158 |
<xsl:value-of select="$fundingId"/> |
|
159 |
</FIELD> |
|
160 |
<FIELD name="project"> |
|
161 |
<xsl:value-of select="$projectId"/> |
|
162 |
</FIELD> |
|
163 |
<FIELD name="startdate" type="date" format="MM/dd/yyyy"> |
|
164 |
<xsl:value-of select="$startDate"/> |
|
165 |
</FIELD> |
|
166 |
<FIELD name="enddate" type="date" format="MM/dd/yyyy"> |
|
167 |
<xsl:value-of select="$endDate"/> |
|
168 |
</FIELD> |
|
169 |
</ROW> |
|
161 | 170 |
</xsl:for-each> |
162 | 171 |
</xsl:if> |
163 | 172 |
</ROWS> |
Also available in: Unified diff
link to the funding path that only contains the funder info, in cases when directorate and divisions are not specified.