Compare commits

...

9 Commits
master ... beta

@ -116,7 +116,7 @@ public class HttpConnector2 {
String rateLimit = urlConn.getHeaderField(Constants.HTTPHEADER_IETF_DRAFT_RATELIMIT_LIMIT);
String rateRemaining = urlConn.getHeaderField(Constants.HTTPHEADER_IETF_DRAFT_RATELIMIT_REMAINING);
if ((rateLimit != null) && (rateRemaining != null) && (Integer.parseInt(rateRemaining) < 2)) {
if ((rateLimit != null) && (rateRemaining != null) && (Integer.parseInt(rateRemaining) < 9)) {
if (retryAfter > 0) {
backoffAndSleep(retryAfter);
} else {

@ -0,0 +1,23 @@
public package eu.dnetlib.dhp.collection.plugin;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.net.URL;
import java.util.zip.GZIPInputStream;
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
public class FileGZipCollectorPlugin extends AbstractSplittedRecordPlugin {
@Override
protected BufferedInputStream getBufferedInputStream(final String baseUrl) throws CollectorServiceException {
try {
GZIPInputStream stream = new GZIPInputStream(new FileInputStream(new URL(baseUrl).getPath()));
return new BufferedInputStream(stream);
} catch (Exception e) {
throw new CollectorServiceException(e);
}
}
}

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?><oai:record xmlns:datacite="http://datacite.org/schema/kernel-4" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaire="http://namespace.openaire.eu/schema/oaire/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><oai:header><oai:identifier>10.12688/f1000research.9091.2</oai:identifier><oai:datestamp>2021-09-28T15:17:39.54796799+02:00</oai:datestamp></oai:header><metadata><article xmlns:ali="http://www.niso.org/schemas/ali/1.0" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article"><front><journal-meta xmlns:ali="http://www.niso.org/schemas/ali/1.0/"><journal-id journal-id-type="pmc">F1000Research</journal-id><journal-title-group><journal-title>F1000Research</journal-title></journal-title-group><issn pub-type="epub">2046-1402</issn><publisher><publisher-name>F1000 Research Limited</publisher-name><publisher-loc>London, UK</publisher-loc></publisher></journal-meta><article-meta xmlns:ali="http://www.niso.org/schemas/ali/1.0/"><article-id pub-id-type="doi">10.12688/f1000research.9091.2</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Note</subject></subj-group><subj-group><subject>Articles</subject><subj-group><subject>Genitourinary Cancers</subject></subj-group><subj-group><subject>Methods for Diagnostic &amp; Therapeutic Studies</subject></subj-group></subj-group></article-categories><title-group><article-title>A multi-site cutting device implements efficiently the divide-and-conquer strategy in tumor sampling</article-title><fn-group content-type="pub-status"><fn><p>[version 2; peer review: 2 approved, 1 approved with reservations]</p></fn></fn-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><name name-style="western"><surname>Lopez</surname><given-names>Jose I.</given-names></name><xref ref-type="corresp" rid="c1">a</xref><xref ref-type="aff" rid="a1">1</xref><xref ref-type="aff" rid="a2">2</xref><xref ref-type="aff" rid="a3">3</xref></contrib><contrib contrib-type="author" corresp="yes"><name name-style="western"><surname>Cortes</surname><given-names>Jesus M.</given-names></name><xref ref-type="corresp" rid="c2">b</xref><xref ref-type="aff" rid="a4">4</xref><xref ref-type="aff" rid="a5">5</xref><xref ref-type="aff" rid="a6">6</xref></contrib><aff id="a1">
<label>1</label>Department of Pathology, Cruces University Hospital, Barakaldo, Spain</aff><aff id="a2">
<label>2</label>Biomarkers in Cancer Unit, Biocruces Research Institute, Barakaldo, Spain</aff><aff id="a3">
<label>3</label>University of the Basque Country, Leioa, Spain</aff><aff id="a4">
<label>4</label>Quantitative Biomedicine Unit, Biocruces Research Institute, Barakaldo, Spain</aff><aff id="a5">
<label>5</label>Ikerbasque: The Basque Foundation for Science, Bilbao, Spain</aff><aff id="a6">
<label>6</label>Department of Cell Biology and Histology, University of the Basque Country, Leioa, Spain</aff></contrib-group><author-notes><corresp id="c1">
<label>a</label>
<email xlink:href="mailto:joseignacio.lopez@osakidetza.eus">joseignacio.lopez@osakidetza.eus</email>
</corresp><corresp id="c2">
<label>b</label>
<email xlink:href="mailto:jesus.m.cortes@gmail.com">jesus.m.cortes@gmail.com</email>
</corresp><fn fn-type="con"><p>JIL and JMC identified the problem and gave a realistic solution. JIL and JMC wrote this note.</p></fn><fn fn-type="conflict"><p>
<bold>Competing interests: </bold>No competing interests were disclosed.</p></fn></author-notes><pub-date pub-type="epub"><day>26</day><month>7</month><year>2016</year></pub-date><pub-date pub-type="collection"><year>2016</year></pub-date><volume>5</volume><elocation-id>1587</elocation-id><history><date date-type="accepted"><day>25</day><month>7</month><year>2016</year></date></history><permissions><copyright-statement>Copyright: © 2016 Lopez JI and Cortes JM</copyright-statement><copyright-year>2016</copyright-year><license xlink:href="http://creativecommons.org/licenses/by/4.0/"><license-p>This is an open access article distributed under the terms of the Creative Commons Attribution Licence, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.</license-p></license></permissions><self-uri content-type="pdf" xlink:href="https://f1000researchdata.s3.amazonaws.com/manuscripts/9998/7ac6d72c-7dd6-42bd-8710-09ea4569c295_9091_-_jesus_cortes_v2.pdf"/><abstract><p>We recently showed that in order to detect intra-tumor heterogeneity a Divide-and-Conquer (DAC) strategy of tumor sampling outperforms current routine protocols. This paper is a continuation of this work, but here we focus on DAC implementation in the Pathology Laboratory. In particular, we describe a new simple method that makes use of a cutting grid device and is applied to clear cell renal cell carcinomas for DAC implementation. This method assures a thorough sampling of large surgical specimens, facilitates the demonstration of intratumor heterogeneity, and saves time to pathologists in the daily practice. The method involves the following steps: 1. Thin slicing of the tumor (by hand or machine), 2. Application of a cutting grid to the slices (
<italic toggle="yes">e.g</italic>., a French fry cutter), resulting in multiple tissue cubes with fixed position within the slice, 3. Selection of tissue cubes for analysis, and finally, 4. Inclusion of selected cubes into a cassette for histological processing (with about eight tissue fragments within each cassette). Thus, using our approach in a 10 cm in-diameter-tumor we generate 80 tumor tissue fragments placed in 10 cassettes and, notably, in a tenth of time. Eighty samples obtained across all the regions of the tumor will assure a much higher performance in detecting intratumor heterogeneity, as proved recently with synthetic data.</p></abstract><kwd-group kwd-group-type="author"><kwd>Tumor sampling</kwd><kwd>cutting grid</kwd><kwd>divide and conquer</kwd><kwd>clear cell renal cell carcinoma</kwd><kwd>intratumor heterogeneity</kwd><kwd>pathology routine</kwd></kwd-group><funding-group><funding-statement>JMC is funded by Ikerbasque: The Basque Foundation for Science.</funding-statement><funding-statement>
<italic toggle="yes">The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.</italic>
</funding-statement></funding-group></article-meta></front></article></metadata></oai:record>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='/oai.xsl' ?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2021-11-18T15:55:16Z</responseDate>
<request identifier="oai:pub.uni-bielefeld.de:2527408" metadataPrefix="oai_openaire" verb="GetRecord">https://pub.uni-bielefeld.de/oai</request>
<GetRecord>
<record>
<header>
<identifier>oai:pub.uni-bielefeld.de:2527408</identifier>
<datestamp>2018-07-24T13:00:24Z</datestamp>
<setSpec>bi_dissertation</setSpec>
<setSpec>doc-type:doctoralThesis</setSpec>
<setSpec>ddc:540</setSpec>
<setSpec>bi_dissertationFtxt</setSpec>
<setSpec>open_access</setSpec>
</header>
<metadata>
<resource xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns="http://namespace.openaire.eu/schema/oaire/" xsi:schemaLocation="http://namespace.openaire.eu/schema/oaire/ https://www.openaire.eu/schema/repo-lit/4.0/openaire.xsd">
<datacite:titles>
<datacite:title xml:lang="ger">Reaktionsverhalten organometallischer Verbindungen des Lithiums und des Calciums gegenüber Aminalen</datacite:title>
</datacite:titles>
<datacite:creators>
<datacite:creator>
<datacite:creatorName nameType="Personal">Hülsmann, Matthias</datacite:creatorName>
<datacite:givenName>Matthias</datacite:givenName>
<datacite:familyName>Hülsmann</datacite:familyName>
<datacite:affiliation affiliationIdentifierScheme="ROR" schemeURI="https://ror.org/" affiliationIdentifier="02hpadn98">Bielefeld University</datacite:affiliation>
</datacite:creator>
</datacite:creators>
<datacite:relatedIdentifiers>
<datacite:relatedIdentifier relatedIdentifierType="URL" relationType="HasMetadata">https://pub.uni-bielefeld.de/record/2527408.json</datacite:relatedIdentifier>
</datacite:relatedIdentifiers>
<datacite:alternateIdentifiers>
<datacite:alternateIdentifier alternateIdentifierType="URN">urn:nbn:de:hbz:361-25274082</datacite:alternateIdentifier>
</datacite:alternateIdentifiers>
<dc:language>ger</dc:language>
<datacite:date dateType="Issued">2012</datacite:date>
<resourceType resourceTypeGeneral="literature" uri="http://purl.org/coar/resource_type/c_1843">bi_dissertation</resourceType>
<dc:format>application/pdf</dc:format>
<datacite:identifier identifierType="URL">https://pub.uni-bielefeld.de/record/2527408</datacite:identifier>
<datacite:rights rightsURI="http://purl.org/coar/access_right/c_abf2">open access</datacite:rights>
<dc:source>Hülsmann M. <em>Reaktionsverhalten organometallischer Verbindungen des Lithiums und des Calciums gegenüber Aminalen</em>. Bielefeld: Universität Bielefeld; 2012.</dc:source>
<datacite:subjects>
<datacite:subject schemeURI="http://dewey.info/" subjectScheme="dewey">540</datacite:subject>
</datacite:subjects>
<licenseCondition uri="https://rightsstatements.org/page/InC/1.0/">In Copyright</licenseCondition>
<datacite:sizes>
<datacite:size>8 B</datacite:size>
</datacite:sizes>
<file accessRightsURI="" mimeType="application/pdf">https://pub.uni-bielefeld.de/download/2527408/2527412</file>
</resource>
</metadata>
</record>
</GetRecord>
</OAI-PMH>

@ -0,0 +1,131 @@
<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl' href='/oai2.xsl' ?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2021-11-18T15:55:56Z</responseDate>
<request verb="GetRecord" identifier="oai:www.zora.uzh.ch:10" metadataPrefix="oai_openaire">https://www.zora.uzh.ch/cgi/oai2</request>
<GetRecord>
<record>
<header>
<identifier>oai:www.zora.uzh.ch:10</identifier>
<datestamp>2021-02-12T18:13:36Z</datestamp>
<setSpec>7375626A656374733D3130323531:3130303832</setSpec>
<setSpec>7375626A656374733D3130323531:3130313834</setSpec>
<setSpec>7375626A656374733D3130313730:3130313938:3130313939</setSpec>
<setSpec>74797065733D61727469636C65</setSpec>
<setSpec>73776973736269623D596573</setSpec>
<setSpec>6574683D596573</setSpec>
<setSpec>6E623D4E6F</setSpec>
</header>
<metadata>
<oaire:resource xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://www.w3.org/2001/XMLSchema-instance"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xsi:schemaLocation="http://namespace.openaire.eu/schema/oaire/ https://www.openaire.eu/schema/repo-lit/4.0/openaire.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<datacite:titles>
<datacite:title>Adhesive properties of Enterobacter sakazakii to human epithelial and brain microvascular endothelial cells</datacite:title>
</datacite:titles>
<datacite:creators>
<datacite:creator>
<datacite:creatorName nameType="Personal">Mange, J P</datacite:creatorName>
<datacite:givenName>J P</datacite:givenName>
<datacite:familyName>Mange</datacite:familyName>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Stephan, Roger</datacite:creatorName>
<datacite:givenName>Roger</datacite:givenName>
<datacite:familyName>Stephan</datacite:familyName>
<datacite:nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">https://orcid.org/0000-0003-1002-4762</datacite:nameIdentifier>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Borel, Nicole</datacite:creatorName>
<datacite:givenName>Nicole</datacite:givenName>
<datacite:familyName>Borel</datacite:familyName>
<datacite:nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">https://orcid.org/0000-0002-1556-9262</datacite:nameIdentifier>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Wild, P</datacite:creatorName>
<datacite:givenName>P</datacite:givenName>
<datacite:familyName>Wild</datacite:familyName>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Kim, Kwang Sik</datacite:creatorName>
<datacite:givenName>Kwang Sik</datacite:givenName>
<datacite:familyName>Kim</datacite:familyName>
<datacite:affiliation affiliationIdentifier="60005248" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">Johns Hopkins University|Baltimore|United States</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Pospischil, A</datacite:creatorName>
<datacite:givenName>A</datacite:givenName>
<datacite:familyName>Pospischil</datacite:familyName>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
<datacite:creator>
<datacite:creatorName nameType="Personal">Lehner, Angelika</datacite:creatorName>
<datacite:givenName>Angelika</datacite:givenName>
<datacite:familyName>Lehner</datacite:familyName>
<datacite:nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">https://orcid.org/0000-0003-1863-5090</datacite:nameIdentifier>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:creator>
</datacite:creators>
<datacite:contributors>
<datacite:contributor contributorType="HostingInstitution">
<datacite:contributorName nameType="Organizational">University of Zurich</datacite:contributorName>
<datacite:nameIdentifier schemeURI="http://www.crossref.org/fundref/" nameIdentifierScheme="CrossRef Funder DOI">https://doi.org/10.13039/501100006447</datacite:nameIdentifier>
</datacite:contributor>
<datacite:contributor contributorType="ContactPerson">
<datacite:contributorName nameType="Personal">Stephan, Roger</datacite:contributorName>
<datacite:givenName>Roger</datacite:givenName>
<datacite:familyName>Stephan</datacite:familyName>
<datacite:nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">https://orcid.org/0000-0003-1002-4762</datacite:nameIdentifier>
<datacite:affiliation affiliationIdentifier="60012614" affiliationIdentifierScheme="Scopus" SchemeURI="https://www.scopus.com/">University of Zurich|Zurich|Switzerland</datacite:affiliation>
</datacite:contributor>
</datacite:contributors>
<datacite:alternateIdentifiers>
<datacite:alternateIdentifier alternateIdentifierType="URL">https://www.zora.uzh.ch/id/eprint/10/</datacite:alternateIdentifier>
</datacite:alternateIdentifiers>
<datacite:relatedIdentifiers>
<datacite:relatedIdentifier relationType="Cites" relatedIdentifierType="DOI">10.1186/1471-2180-6-58</datacite:relatedIdentifier>
<datacite:relatedIdentifier relationType="Cites" relatedIdentifierType="PMID">16800879</datacite:relatedIdentifier>
<datacite:relatedIdentifier relationType="HasPart" relatedIdentifierType="URL">https://www.zora.uzh.ch/id/eprint/10/1/Mange_Microb2006V.pdf</datacite:relatedIdentifier>
</datacite:relatedIdentifiers>
<datacite:dates>
<datacite:date dateType="Created">2008-02-11T12:11:38</datacite:date>
<datacite:date dateType="Created">2008-05-12T22:52:34</datacite:date>
<datacite:date dateType="Accepted">2008-02-11T12:11:37</datacite:date>
<datacite:date dateType="Updated">2021-02-12T18:13:36</datacite:date>
<datacite:date dateType="Issued">2006</datacite:date>
</datacite:dates>
<dc:language>en</dc:language>
<dc:publisher>BioMed Central</dc:publisher>
<oaire:resourceType uri="http://purl.org/coar/resource_type/c_6501" resourceTypeGeneral="literature">journal article</oaire:resourceType>
<dc:description>BACKGROUND: Enterobacter sakazakii is an opportunistic pathogen that has been associated with sporadic cases and outbreaks causing meningitis, necrotizing enterocolitis and sepsis especially in neonates. However, up to now little is known about the mechanisms of pathogenicity in E. sakazakii. A necessary state in the successful colonization, establishment and ultimately production of disease by microbial pathogens is the ability to adhere to host surfaces such as mucous membranes, gastric and intestinal epithelial or endothelial tissue.This study examined for the first time the adherence ability of 50 E. sakazakii strains to the two epithelial cell lines HEp-2 and Caco-2, as well as the brain microvascular endothelial cell line HBMEC. Furthermore, the effects of bacterial culture conditions on the adherence behaviour were investigated. An attempt was made to characterize the factors involved in adherence. RESULTS: Two distinctive adherence patterns, a diffuse adhesion and the formation of localized clusters of bacteria on the cell surface could be distinguished on all three cell lines. In some strains, a mixture of both patterns was observed. Adherence was maximal during late exponential phase, and increased with higher MOI. The adhesion capacity of E. sakazakii to HBMEC cells was affected by the addition of blood to the bacteria growth medium. Mannose, hemagglutination, trypsin digestion experiments and transmission electron microscopy suggested that the adhesion of E. sakazakii to the epithelial and endothelial cells is mainly non-fimbrial based. CONCLUSION: Adherence experiments show heterogeneity within different E. sakazakii strains. In agreement with studies on E. cloacae, we found no relationship between the adhesive capacities in E. sakazakii and the eventual production of specific fimbriae. Further studies will have to be carried out in order to determine the adhesin(s) involved in the interaction of E. sakazakii with cells and to enhance knowledge of the pathogenesis of E. sakazakii infection.</dc:description>
<dc:formats>
<dc:format>Mange_Microb2006V.pdf - application/pdf</dc:format>
</dc:formats>
<datacite:identifier identifierType="DOI">10.5167/uzh-10</datacite:identifier>
<datacite:rights rightsURI="http://purl.org/coar/access_right/c_abf2">open access</datacite:rights>
<dc:source>Mange, J P; Stephan, Roger; Borel, Nicole; Wild, P; Kim, Kwang Sik; Pospischil, A; Lehner, Angelika (2006). Adhesive properties of Enterobacter sakazakii to human epithelial and brain microvascular endothelial cells. BMC Microbiology, 6:58.</dc:source>
<datacite:subjects>
<datacite:subject classificationCode="570" valueURI="http://dewey.info/class/570/" subjectScheme="Dewey Decimal Classification" xml:lang="en" schemeURI="http://dewey.info/scheme/">570 Life sciences; biology</datacite:subject>
<datacite:subject classificationCode="610" valueURI="http://dewey.info/class/610/" subjectScheme="Dewey Decimal Classification" xml:lang="en" schemeURI="http://dewey.info/scheme/">610 Medicine &amp; health</datacite:subject>
<datacite:subject classificationCode="10082" valueURI="https://www.zora.uzh.ch/view/subjectsnew/10082.html" subjectScheme="ZORA Communities &amp; Collections" xml:lang="en">10082 Institute of Food Safety and Hygiene</datacite:subject>
<datacite:subject classificationCode="10184" valueURI="https://www.zora.uzh.ch/view/subjectsnew/10184.html" subjectScheme="ZORA Communities &amp; Collections" xml:lang="en">10184 Institute of Veterinary Pathology</datacite:subject>
<datacite:subject classificationCode="10199" valueURI="https://www.zora.uzh.ch/view/subjectsnew/10199.html" subjectScheme="ZORA Communities &amp; Collections" xml:lang="en">10199 Clinic for Clinical Pharmacology and Toxicology</datacite:subject>
<datacite:subject classificationCode="2404" subjectScheme="Scopus Subject Areas" xml:lang="en">2404 Microbiology</datacite:subject>
<datacite:subject classificationCode="2726" subjectScheme="Scopus Subject Areas" xml:lang="en">2726 Microbiology (medical)</datacite:subject>
</datacite:subjects>
<oaire:licenseCondition startDate="unknown" uri="http://creativecommons.org/licenses/by/2.0/">Creative Commons: Attribution 2.0 Generic (CC BY 2.0)</oaire:licenseCondition>
<datacite:sizes>
<datacite:size>1MB</datacite:size>
</datacite:sizes>
</oaire:resource>
</metadata>
</record>
</GetRecord>
</OAI-PMH>

@ -0,0 +1,360 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="2.0">
<xsl:param name="varDataSourceId" select="string('eurocrisdris::dris')"/>
<xsl:variable name="namespacePrefix" select="string('eurocrisdris')"/>
<xsl:template match="/">
<record>
<xsl:copy-of select=".//*[local-name() = 'header']"/>
<metadata>
<xsl:variable name="rid" select="replace(normalize-space(//itemListElement/oat_id),'https://api.eurocris.org/dris/entries/dris','')"/>
<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
<xsl:variable name="repositoryType">
<xsl:choose>
<xsl:when test="lower-case(normalize-space(//scope)) = 'vocabs:scopes/classcerif00889'">
<xsl:value-of select="string('crissystem::institutional')"/>
</xsl:when>
<xsl:when test="lower-case(normalize-space(//scope)) = 'vocabs:scopes/classcerif00939'">
<xsl:value-of select="string('crissystem::national')"/>
</xsl:when>
<xsl:when test="lower-case(normalize-space(//scope)) = 'vocabs:scopes/classcerif00122'">
<xsl:value-of select="string('crissystem::funder')"/>
</xsl:when>
<xsl:when test="lower-case(normalize-space(//scope)) = 'vocabs:scopes/classcerif00938'">
<xsl:value-of select="string('crissystem::regional')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('crissystem')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="oCountry" select="upper-case(normalize-space(//iso_3166_codes/Alpha2))"/>
<xsl:variable name="repositoryPlatform">
<xsl:for-each select="//itemListElement/oat_included">
<xsl:choose>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01750'">
<xsl:value-of select="string('COBISS.CG')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01751'">
<xsl:value-of select="string('Converis')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01752'">
<xsl:value-of select="string('CRIStin')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01753'">
<xsl:value-of select="string('CSpace')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01754'">
<xsl:value-of select="string('DSpace-CRIS')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01755'">
<xsl:value-of select="string('EPrints')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01756'">
<xsl:value-of select="string('Haplo')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01757'">
<xsl:value-of select="string('Ideate')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01758'">
<xsl:value-of select="string('In-House-Built')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01759'">
<xsl:value-of select="string('IRINS')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01760'">
<xsl:value-of select="string('IRIS')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01761'">
<xsl:value-of select="string('Metis')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01762'">
<xsl:value-of select="string('Omega-PSIR')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01763'">
<xsl:value-of select="string('PeopleSoft')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01764'">
<xsl:value-of select="string('Pure')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01765'">
<xsl:value-of select="string('SIGMA Research')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01766'">
<xsl:value-of select="string('SoleCRIS')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01767'">
<xsl:value-of select="string('Symplectic Elements')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01768'">
<xsl:value-of select="string('UXXI-INV')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01769'">
<xsl:value-of select="string('VIVO')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01770'">
<xsl:value-of select="string('Worktribe')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01854'">
<xsl:value-of select="string('HISinOne-RES')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01960'">
<xsl:value-of select="string('Dialnet CRIS')"/>
</xsl:when>
<xsl:when test="lower-case(substring(normalize-space(oat_id),string-length(oat_id) -30 +1,30)) = 'cris-platforms/classcerif01961'">
<xsl:value-of select="string('Esploro')"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="repositoryPlatform" select="upper-case(normalize-space(//itemListElement/oat_included[3]/label/en))"/>
<xsl:variable name="contenttypes">
<xsl:for-each select=".//content_types">
<xsl:if test="position() > 1">-</xsl:if>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="languages">
<xsl:for-each select=".//content_languages">
<xsl:if test="position() > 1">,</xsl:if>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="subjects">
<xsl:for-each select=".//content_subjects/label">
<xsl:if test="position() > 1">@@</xsl:if>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<ROWS>
<ROW table="dsm_datasources">
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="id">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="officialname">
<xsl:choose>
<xsl:when test="//itemListElement/name">
<xsl:value-of select="normalize-space(//itemListElement/name[1])"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(//repository_metadata/name[1]/acronym)" />
</xsl:otherwise>
</xsl:choose>
</FIELD>
<FIELD name="englishname">
<xsl:choose>
<xsl:when test="//itemListElement/acronym">
<xsl:value-of select="normalize-space(//itemListElement/acronym)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(//repository_metadata/name[1]/name[1])"/>
</xsl:otherwise>
</xsl:choose>
</FIELD>
<FIELD name="websiteurl">
<xsl:value-of select="normalize-space(//itemListElement/uri)"/>
</FIELD>
<FIELD name="contactemail">
<xsl:value-of select="normalize-space(//pEmail)"/>
</FIELD>
<xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')">
<FIELD name="latitude" type="float">
<xsl:value-of select="normalize-space(//organisation/location/latitude)"/>
</FIELD>
</xsl:if>
<xsl:if test="normalize-space(//organisation/location/latitude) = 'null'">
<FIELD name="latitude" type="float"/>
</xsl:if>
<xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')">
<FIELD name="longitude" type="float">
<xsl:value-of select="normalize-space(//organisation/location/longitude)"/>
</FIELD>
</xsl:if>
<xsl:if test="normalize-space(//organisation/location/longitude) = 'null'">
<FIELD name="longitude" type="float"/>
</xsl:if>
<FIELD name="namespaceprefix">
<xsl:value-of select="dnet:generateNsPrefix('dris', replace($rid,'dris',''))"/>
</FIELD>
<FIELD name="languages">
<xsl:value-of select="normalize-space($languages)"/>
</FIELD>
<FIELD name="od_contenttypes">
<xsl:value-of select="normalize-space($contenttypes)"/>
</FIELD>
<FIELD name="collectedfrom">
<xsl:value-of select="$varDataSourceId"/>
</FIELD>
<FIELD name="typology">
<xsl:value-of select="$repositoryType"/>
</FIELD>
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
<FIELD name="platform">
<xsl:value-of select="$repositoryPlatform"/>
</FIELD>
<FIELD name="description">
<xsl:value-of select="normalize-space(//itemListElement/description)"/>
</FIELD>
<FIELD name="subjects">
<xsl:value-of select="normalize-space($subjects)"/>
</FIELD>
<xsl:if test="//policies/preservation_policy/version_control/policy[./text() = 'updated_versions_allowed']">
<FIELD name="versioning" type="boolean">true</FIELD>
</xsl:if>
</ROW>
<ROW table="dsm_api">
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="$apiId"/>
</FIELD>
<FIELD name="id">
<xsl:value-of select="$apiId"/>
</FIELD>
<FIELD name="protocol">oai</FIELD>
<FIELD name="datasource">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="contentdescription">metadata</FIELD>
<FIELD name="typology">
<xsl:value-of select="$repositoryType"/>
</FIELD>
<FIELD name="baseurl">
<xsl:value-of select="normalize-space(//itemListElement/openaireCrisEndpointURL)"/>
</FIELD>
<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
</ROW>
<ROW table="dsm_apiparams">
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="concat($apiId, '@@format')"/>
</FIELD>
<FIELD name="api">
<xsl:value-of select="$apiId"/>
</FIELD>
<FIELD name="param">format</FIELD>
<FIELD name="value">oai_cerif_openaire</FIELD>
</ROW>
<!-- <xsl:for-each select="//organisation"> -->
<xsl:variable name="oUrl" select="normalize-space(//itemListElement/oat_included[4]/oat_id)"/>
<xsl:variable name="preferredNameLanguage" select="./name/preferred_phrases[./value = 'name'][1]/language[1]"/>
<xsl:variable name="oName">
<xsl:choose>
<xsl:when test="string-length($preferredNameLanguage[1]/text()) > 0 and ./name[./language = $preferredNameLanguage]/name">
<xsl:value-of select="./name[./language = $preferredNameLanguage]/name/text()" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="oAcronym">
<xsl:choose>
<xsl:when test="string-length($preferredNameLanguage[1]/text()) > 0 and ./name[./language = $preferredNameLanguage]/acronym">
<xsl:value-of select="./name[./language = $preferredNameLanguage]/acronym" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//acronym"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="organizationId" select="translate(translate(concat($namespacePrefix, '::', $oName, '_', $oCountry), ' ', '_'), '&amp;quot;', '')"/>
<xsl:if test="string-length($oName) > 0">
<ROW table="dsm_organizations">
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="$organizationId"/>
</FIELD>
<FIELD name="id">
<xsl:value-of select="$organizationId"/>
</FIELD>
<FIELD name="legalname">
<xsl:value-of select="$oName"/>
</FIELD>
<FIELD name="legalshortname">
<xsl:value-of select="normalize-space($oAcronym)"/>
</FIELD>
<FIELD name="websiteurl">
<xsl:choose>
<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
<xsl:value-of select="normalize-space($oUrl)"/>
</xsl:when>
<xsl:when test="string-length(normalize-space($oUrl)) > 0">
<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
</xsl:when>
</xsl:choose>
</FIELD>
<FIELD name="country">
<xsl:choose>
<xsl:when test="$oCountry = 'UK'">GB</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$oCountry"/>
</xsl:otherwise>
</xsl:choose>
</FIELD>
<FIELD name="collectedfrom">
<xsl:value-of select="$varDataSourceId"/>
</FIELD>
<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
</ROW>
<ROW table="dsm_datasource_organization">
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
</FIELD>
<FIELD name="datasource">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="organization">
<xsl:value-of select="$organizationId"/>
</FIELD>
</ROW>
</xsl:if>
<!-- </xsl:for-each> -->
<!-- EOSC datasource support , TODO -->
<xsl:choose>
<xsl:when test="$repositoryType = 'crissystem::institutional'">
<ROW table="dsm_datasources_eosc">
<FIELD name="id"><xsl:value-of select="$datasourceId"/></FIELD>
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="jurisdiction"><xsl:value-of select="string('Institutional')"/></FIELD>
</ROW>
</xsl:when>
<xsl:when test="$repositoryType = 'crissystem::thematic'">
<ROW table="dsm_datasources_eosc">
<FIELD name="id"><xsl:value-of select="$datasourceId"/></FIELD>
<FIELD name="_dnet_resource_identifier_">
<xsl:value-of select="$datasourceId"/>
</FIELD>
<FIELD name="thematic" type="boolean">true</FIELD>
</ROW>
</xsl:when>
</xsl:choose>
</ROWS>
</metadata>
</record>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,818 @@
<!-- adaptation 2021-08-23 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
extension-element-prefixes="TransformationFunction"
exclude-result-prefixes="TransformationFunction"
version="1.1">
<xsl:param name="varOfficialName" />
<xsl:param name="varDsType" />
<xsl:param name="varDataSourceId" />
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
<xsl:param name="varFP7" select = "'corda_______::'"/>
<xsl:param name="varH2020" select = "'corda__h2020::'"/>
<xsl:param name="varAKA" select = "'aka_________::'"/>
<xsl:param name="varARC" select = "'arc_________::'"/>
<xsl:param name="varCONICYT" select = "'conicytf____::'"/>
<xsl:param name="varDFG" select = "'dfgf________::'"/>
<xsl:param name="varFCT" select = "'fct_________::'"/>
<xsl:param name="varFWF" select = "'fwf_________::'"/>
<xsl:param name="varHRZZ" select = "'irb_hr______::'"/> <!-- HRZZ not found -->
<xsl:param name="varMESTD" select = "'mestd_______::'"/>
<xsl:param name="varMZOS" select = "'irb_hr______::'"/>
<xsl:param name="varNHMRC" select = "'nhmrc_______::'"/>
<xsl:param name="varNIH" select = "'nih_________::'"/>
<xsl:param name="varNSF" select = "'nsf_________::'"/>
<xsl:param name="varNWO" select = "'nwo_________::'"/>
<xsl:param name="varRCUK" select = "'rcuk________::'"/>
<xsl:param name="varSFI" select ="'sfi_________::'"/>
<xsl:param name="varSGOV" select = "'sgov________::'"/> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select = "'snsf________::'"/>
<xsl:param name="varTARA" select = "'taraexp_____::'"/> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select = "'tubitakf____::'"/>
<xsl:param name="varWT" select = "'wt__________::'"/>
<xsl:template match="/">
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)" />
<xsl:if test="//oai:header/@status='deleted'">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:call-template name="validRecord" />
</xsl:template>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template name="validRecord">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<!-- ~~~~~ pre-detect resourceType, superType and store in variable ~~~~~ -->
<!-- optimize resourceType, superType in case of several statements (e.g. FU Berlin unfortunately contains record with several) -->
<!--
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, distinct-values(//*[local-name()='resourceType'][1]/@uri), 'TextTypologies')" />
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
-->
<xsl:variable name="varTypLst" select="distinct-values((//*[local-name()='resourceType']/(., @*)))"/>
<xsl:variable name="varCobjCatLst" select="distinct-values((for $i in $varTypLst return TransformationFunction:convertString($tf, normalize-space($i), 'TextTypologies')))"/>
<xsl:variable name="varCobjSupLst" select="for $i in $varCobjCatLst return concat($i, '###', TransformationFunction:convertString($tf, normalize-space($i), 'SuperTypes'))"/>
<xsl:variable name="varCobjSup" select="(
$varCobjSupLst[not(substring-after(., '###') = 'other') and not(substring-before(., '###') = ('0038', '0039', '0040'))][1],
$varCobjSupLst[not(substring-after(., '###') = 'other')][1],
$varCobjSupLst[not(substring-before(., '###') = ('0020', '0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
'0000')[1]"/>
<xsl:variable name="varSuperType" select="substring-after($varCobjSup, '###')"/>
<xsl:variable name="varCobjCategory" select="substring-before($varCobjSup, '###')"/>
<!-- ~~~~~ pre-detect, -clean, -deduplicat PIDs and store in variable ~~~~~ -->
<xsl:variable name="varKnownFileEndings" select="('.bmp', '.doc', '.docx', '.epub', '.flv', '.jpeg', '.jpg', '.m4v', '.mp4', '.mpg', '.odp', '.pdf', '.png', '.ppt', '.tiv', '.txt', '.xls', '.xlsx', '.zip')" />
<!-- landingPage URL -->
<!-- either generate landing pages (as often not given), or compare URL with baseURL -->
<!--
// covered in comparison: URL encoded baseURLs, item URL und baseURL differing only in prefix www. or postfix port
// not covered in comparison: URL encoded item URL, URLs being a substring of URLs (like item URL http://def.br/... and baseURL http://abcdef.br/...), ports when only in baseURL or only in item URL
// tries to not consider higher level URLs as item URLs (e.g. journal URLs) by enforcing something after /
-->
<xsl:variable name="varOrigBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varAggrBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and (./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varLandingPage" select="(
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//oaf:datasourceprefix[. = 'od_______268']/concat('https://qspace.library.queensu.ca/handle/', substring-after(//dri:recordIdentifier, 'oai:qspace.library.queensu.ca:')),
//oaf:datasourceprefix[. = 'od_______307']/concat('http://repositorium.sdum.uminho.pt/handle/', substring-after(//dri:recordIdentifier, 'oai:repositorium.sdum.uminho.pt:')),
//oaf:datasourceprefix[. = 'od_______317']/concat('https://papyrus.bib.umontreal.ca/xmlui/handle/', substring-after(//dri:recordIdentifier, 'oai:papyrus.bib.umontreal.ca:')),
//oaf:datasourceprefix[. = 'od______1318']/concat('https://orbi.uliege.be/handle/', substring-after(//dri:recordIdentifier, 'oai:orbi.ulg.ac.be:')),
//oaf:datasourceprefix[. = 'od______1388']/concat('http://rabida.uhu.es/dspace/handle/', substring-after(//dri:recordIdentifier, 'oai:rabida.uhu.es:')),
//oaf:datasourceprefix[. = 'od______1472']/concat('https://gredos.usal.es/handle/', substring-after(//dri:recordIdentifier, 'oai:gredos.usal.es:')),
//oaf:datasourceprefix[. = 'od______1560']/concat('https://riunet.upv.es/handle/', substring-after(//dri:recordIdentifier, 'oai:riunet.upv.es:')),
//oaf:datasourceprefix[. = 'od______3158']/concat('https://open.uct.ac.za/handle/', substring-after(//dri:recordIdentifier, 'oai:localhost:')),
//oaf:datasourceprefix[. = 'od______4225']/concat('https://repository.rothamsted.ac.uk/item/', substring-after(//dri:recordIdentifier, 'oai:repository.rothamsted.ac.uk:')),
//oaf:datasourceprefix[. = 'od______9626']/(//datacite:identifier)[@identifierType='Handle'][not(contains(., '/handle/123456789/'))],
//oaf:datasourceprefix[not(. = ('od_______268', 'od_______307', 'od______1318', 'od______1388', 'od______1472', 'od______4225'))]/(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*) = ('url', 'uri')][not(contains(., 'doi.org/')) and not(contains(., '/doi/')) and not(contains(., '/pmc/'))][starts-with(., 'http')]
)[1]"/>
<!-- IDs (identifier and alternateIdentifier, not relatedIdentifier) -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'doi.org/10.')]/lower-case(substring-after(., 'doi.org/')),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:doi:')]/substring-after(., 'info:doi:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='doi'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/lower-case(.),
(//datacite:identifier, //datacite:alternateIdentifier)[matches(., '.*/doi/.*/10\..*')]/replace(., '.*/doi/.*/(10\..*)$', '$1')
)), ' DOI:::'))"/>
<xsl:variable name="varPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'hdl.handle.net/')][not(contains(., '123456789'))]/substring-after(., 'hdl.handle.net/'),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:hdl:')][not(contains(., '123456789'))]/substring-after(., 'info:hdl:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='handle'][not(starts-with(., 'http')) and not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:')) and not(contains(., '/handle/123456789/'))]
)), ' Handle:::'))"/>
<xsl:variable name="varPidUrn" select="concat(' URN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'urn:nbn:')]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:')),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'http') and (contains(lower-case(.), '://nbn-resolving.org/urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn/resolver.pl?urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn:nbn:') or contains(lower-case(.), '://resolver.obvsg.at/urn:nbn:') or contains(lower-case(.), '://urn.fi/urn:nbn:') or contains(lower-case(.), '://urn.kb.se/resolve?urn=urn:nbn:'))]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:'))
)), ' URN:::'))"/>
<xsl:variable name="varPidArk" select="concat(' ARK:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '/ark:/')]/concat('ark:/', substring-after(., '/ark:/'))
)), ' ARK:::'))"/>
<xsl:variable name="varPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'info:pmid/')]/substring-after(., 'info:pmid/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmid:') or starts-with(lower-case(.), 'pubmed:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))][not(contains(., ':'))],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmid'][not(contains(., ':'))]
)), ' PMID:::'))"/>
<xsl:variable name="varPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(lower-case(.), '://www.ncbi.nlm.nih.gov/pmc/articles/pmc') or contains(lower-case(.), '://europepmc.org/articles/pmc'))]/substring-after(., '/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmcid:') or starts-with(lower-case(.), 'pmc:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmcid']
)), ' PMCID:::'))"/>
<xsl:variable name="varPidHal" select="concat(' HAL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='hal' and (starts-with(., 'hal-') or starts-with(., 'halshs-') or starts-with(., 'halsde-'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(., '://hal.archives-ouvertes.fr/hal') or contains(., '://hal.inria.fr/hal') or contains(., '://halshs.archives-ouvertes.fr/hal') or contains(., '://halsde.archives-ouvertes.fr/hal'))]/substring-after(., '.fr/')
)), ' HAL:::'))"/>
<xsl:variable name="varPidBibc" select="concat(' BIBC:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'bibcode:')]/substring-after(lower-case(.), 'bibcode:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(lower-case(.), 'bibcode=')]/substring(substring-after(lower-case(.), 'bibcode='), 1, 19)
)), ' BIBC:::'))"/>
<xsl:variable name="varPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'arxiv:')]/substring-after(lower-case(.), 'arxiv:'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/abs/')]/substring-after(., '://arxiv.org/abs/'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/pdf/')]/substring-before(substring-after(lower-case(.), '://arxiv.org/pdf/'), '.pdf'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='arxiv']
)), ' arXiv:::'))"/>
<xsl:variable name="varPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos:') and not(starts-with(lower-case(.), 'wos: wos:'))]/substring-after(lower-case(.), 'wos:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos: wos:')]/substring-after(lower-case(.), 'wos: wos:')
)), ' WOS:::'))"/>
<xsl:variable name="varPidScp" select="concat(' SCP:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'scopus_id:') or starts-with(lower-case(.), 'scopus:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'scopus: eid=')]/substring-after(., 'eid=2-s2.0-'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'scp=')]/substring-after(., 'scp='),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'eid=2-s2.0-')]/substring-after(., 'eid=2-s2.0-')
)), ' SCP:::'))"/>
<xsl:variable name="varPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
[not(. = $varLandingPage)]
)), ' URL:::'))"/>
<xsl:variable name="varPidIsbn" select="concat(' ISBN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and not(contains(., ':')) and not($varCobjCategory = '0013')],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and starts-with(lower-case(.), 'urn:isbn') and not($varCobjCategory = '0013')]/substring-after(lower-case(.), 'urn:isbn:')
)), ' ISBN:::'))"/>
<xsl:variable name="varPidIssn" select="string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)=('issn', 'pissn', 'eissn', 'lissn') and matches(., '.*\d{4}[\s-]?\d{3}[\dXx].*') and not($varCobjCategory = '0001')]/concat(' ', upper-case((@identifierType, @alternateIdentifierType)), ':::', replace(., '^.*(\d{4})[\s-]?(\d{3}[\dXx]).*$', '$1-$2'))
)), '')"/>
<!-- heap all IDs, drop landingPage URL -->
<xsl:variable name="varPidPre" select="concat($varPidDoi[not(. = ' DOI:::')], $varPidHandle[not(. = ' Handle:::')], $varPidUrn[not(. = ' URN:::')], $varPidArk[not(. = ' ARK:::')], $varPidPmid[not(. = ' PMID:::')], $varPidPmcid[not(. = ' PMCID:::')], $varPidHal[not(. = ' HAL:::')], $varPidBibc[not(. = ' BIBC:::')], $varPidArxiv[not(. = ' arXiv:::')], $varPidWos[not(. = ' WOS:::')], $varPidScp[not(. = ' SCP:::')], $varPidUrl[not(. = ' URL:::')], $varPidIsbn[not(. = ' ISBN:::')], $varPidIssn[not(. = ' ISSN:::')])"/>
<!--
<xsl:variable name="varPid" select="concat($varPidPre, $varLandingPage[string-length($varPidPre) = 0]/concat('landingPage:::', .))"/>
<xsl:variable name="varPid" select="concat($varPidPre, concat(' landingPage:::', $varLandingPage[string-length($varPidPre) = 0], .))"/>
-->
<xsl:variable name="varPid" select="concat($varPidPre, //oaf:datasourceprefix[string-length($varPidPre) = 0]/concat(' landingPage:::', $varLandingPage))"/>
<!-- relatedIdentifier -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varRelPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'doi.org/10.')]/concat(lower-case(substring-after(., 'doi.org/')), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:doi:')]/concat(substring-after(., 'info:doi:'), ':::', @relationType),
(//datacite:relatedIdentifier)[@relatedIdentifierType='DOI'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/concat(lower-case(.), ':::', @relationType),
(//datacite:relatedIdentifier)[matches(., '.*/doi/.*/10\..*')]/concat(replace(., '.*/doi/.*/(10\..*)$', '$1'), ':::', @relationType)
)), ' DOI:::'))"/>
<xsl:variable name="varRelPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'hdl.handle.net/')]/concat(substring-after(., 'hdl.handle.net/'), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:hdl:')]/concat(substring-after(., 'info:hdl:'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@relatedIdentifierType)='handle'][not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]/concat(., ':::', @relationType)
)), ' Handle:::'))"/>
<xsl:variable name="varRelPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/concat(substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))]/concat(., ':::', @relationType)
)), ' PMID:::'))"/>
<xsl:variable name="varRelPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='pmcid']
/concat(., ':::', @relationType)
)), ' PMCID:::'))"/>
<xsl:variable name="varRelPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='arxiv']
/concat(., ':::', @relationType)
)), ' arXiv:::'))"/>
<xsl:variable name="varRelPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))]/concat(., ':::', @relationType),
(//datacite:relatedIdentifier)[starts-with(lower-case(.), 'wos:')]/concat(substring-after(lower-case(.), 'wos:'), ':::', @relationType)
)), ' WOS:::'))"/>
<xsl:variable name="varRelPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
/concat(., ':::', @relationType)
)), ' URL:::'))"/>
<xsl:variable name="varRelPid" select="concat($varRelPidDoi[not(. = ' DOI:::')], $varRelPidHandle[not(. = ' Handle:::')], $varRelPidPmid[not(. = ' PMID:::')], $varRelPidPmcid[not(. = ' PMCID:::')], $varRelPidArxiv[not(. = ' arXiv:::')], $varRelPidWos[not(. = ' WOS:::')], $varRelPidUrl[not(. = ' URL:::')])"/>
<!-- container PIDs -->
<xsl:variable name="varContainerPidIssn" select="string-join(distinct-values((
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0001' and lower-case(@*) = ('issn', 'pissn', 'eissn', 'lissn')]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', substring(normalize-space(.), 1, 4), '-', substring(normalize-space(.), string-length(normalize-space(replace(., '\(.*$', '')))-3, 4), ':::0043'),
(//datacite:relatedIdentifier)[lower-case(@*) = ('issn', 'pissn', 'eissn', 'lissn') and lower-case(@relationType) = 'ispartof' and not(contains(lower-case(.), 'doi')) and matches(., '.*\d{4}[\-\s]*\d{3}[\dXx].*') and not(contains(lower-case(.), 'edition'))]/concat(' ', upper-case(@relatedIdentifierType), ':::', substring(normalize-space(replace(., 'ISSN:?', '')), 1, 4), '-', substring(normalize-space(.), string-length(normalize-space(replace(., '\(.*$', '')))-3, 4), (.[$varCobjCategory = '0001' or //*[local-name()='resourceType' and contains(@uri, 'c_dcae04bc')]]/':::0043', .[$varCobjCategory = '0013']/'0002', //*[local-name()='resourceType'][./@uri=('http://purl.org/coar/resource_type/c_5794', 'http://purl.org/coar/resource_type/c_6670')]/'0004')[1])
)), '')"/>
<xsl:variable name="varContainerPidIsbn" select="string-join(distinct-values((
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0013' and lower-case(@*) = 'isbn'][not(contains(., ':'))][not(contains(normalize-space(.), ' '))]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', normalize-space(.), ':::0002'),
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0013' and starts-with(lower-case(.), 'urn:isbn:')][not(contains(normalize-space(.), ' '))]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', substring-after(normalize-space(.), 'urn:isbn:'), ':::0002'),
(//datacite:relatedIdentifier)[lower-case(@*) = 'isbn' and lower-case(./@relationType) = 'ispartof']/concat(' ', upper-case(@relatedIdentifierType), ':::', normalize-space(.), ':::', (.[$varCobjCategory = '0001']/':::0043', .[$varCobjCategory = '0013']/'0002', //*[local-name()='resourceType'][./@uri=('http://purl.org/coar/resource_type/c_5794', 'http://purl.org/coar/resource_type/c_6670')]/'0004')[1])
)), '')"/>
<xsl:variable name="varContainerPidUrl" select="string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*) = 'url' and lower-case(./@relationType) = 'ispartof'][not(contains(normalize-space(.), ' ')) and not(contains(., 'doi/'))]/concat(' ', upper-case(@relatedIdentifierType), ':::', normalize-space(.), ':::', (.[$varCobjCategory = ('0024', '0025', '0030', '0033')]/':::0022')[1])
)), '')"/>
<xsl:variable name="varContainerPid" select="concat($varContainerPidIssn[not(. = ' ISSN:::')], $varContainerPidIsbn[not(. = ' ISBN:::')], $varContainerPidUrl[not(. = ' URL:::')])"/>
<!-- drop oaire resource -->
<!-- <oaire:resource xmlns="http://namespace.openaire.eu/schema/oaire/"> -->
<datacite:resource>
<!-- ~~~~~ IDs ~~~~~ -->
<!-- choose 'best' PID among identifiers and alternateIdentifers, and cut off DOI resolver prefix to just get the number part -->
<datacite:identifier>
<xsl:attribute name="identifierType" select="substring-before(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
<xsl:value-of select="substring-after(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
</datacite:identifier>
<datacite:alternateIdentifiers>
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[position() > 1][string-length(substring-after(., ':::')) > 0]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="substring-before(., ':::')"/>
<xsl:value-of select="substring-after(., ':::')" />
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:for-each select="(//datacite:alternateIdentifier, //datacite:identifier)
[not($varCobjCategory = '0001' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))]
[not($varCobjCategory = '0013' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = 'isbn')]
[not(ends-with(., 'pdf'))]
[not(@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('doi', 'handle', 'urn', 'pmid', 'pmcid', 'arxiv', 'wos', 'url', 'isbn', 'issn', 'eissn', 'lissn', 'pissn'))]
[not(. = $varLandingPage)]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="./@*[local-name()=('identifierType', 'alternateIdentifierType')]"/>
<xsl:value-of select="."/>
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</datacite:alternateIdentifier>
</xsl:if>
</datacite:alternateIdentifiers>
<datacite:relatedIdentifiers>
<xsl:for-each select="tokenize(normalize-space($varRelPid), ' ')
[not(contains(lower-case($varContainerPid), lower-case(substring-before(substring-after(., ':::'), ':::'))))]">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="substring-before(., ':::')"/>
<xsl:attribute name="relationType" select="substring-after(substring-after(., ':::'), ':::')"/>
<xsl:value-of select="substring-before(substring-after(., ':::'), ':::')" />
</datacite:relatedIdentifier>
</xsl:for-each>
<xsl:for-each select="(//datacite:relatedIdentifier)
[not(@relatedIdentifierType/lower-case(.) = ('doi', 'handle', 'pmid', 'pmcid', 'wos', 'url'))]
[not(starts-with(lower-case(.), 'wos:') or contains(., 'hdl.handle.net/') or contains(., 'doi.org/10.'))]
[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn', 'isbn') and @relationType/lower-case(.) = 'ispartof')]">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="./@relatedIdentifierType"/>
<xsl:attribute name="relationType" select="./@relationType"/>
<xsl:value-of select=".[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))],
.[@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn')]/concat(substring(., 1, 4), '-', substring(., string-length(.)-3, 4))"/>
</datacite:relatedIdentifier>
</xsl:for-each>
<xsl:for-each select="tokenize(normalize-space($varContainerPid), ' ')">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="substring-before(., ':::')"/>
<xsl:attribute name="relationType" select="'IsPartOf'"/>
<xsl:value-of select="substring-before(substring-after(., ':::'), ':::')" />
<!-- <xsl:value-of select="substring-after(., ':::')" /> -->
</datacite:relatedIdentifier>
</xsl:for-each>
</datacite:relatedIdentifiers>
<!-- change namespace/format from oaire to datacite for description, language, rights, ... -->
<xsl:for-each select="//oaire:resourceType">
<datacite:resourceType>
<xsl:attribute name="xs:anyURI" select="@uri"/>
<xsl:value-of select="."/>
</datacite:resourceType>
</xsl:for-each>
<xsl:for-each select="distinct-values(//oaire:version)">
<datacite:version>
<xsl:value-of select="."/>
</datacite:version>
</xsl:for-each>
<xsl:if test="(//datacite:rights, //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rightsList>
<xsl:for-each select="(//datacite:rights | //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rights>
<xsl:attribute name="rightsURI" select="(@rightsURI, @uri)[1]"/>
<xsl:value-of select="."/>
</datacite:rights>
</xsl:for-each>
</datacite:rightsList>
</xsl:if>
<xsl:if test="//datacite:title">
<datacite:titles>
<xsl:for-each select="//datacite:title">
<datacite:title>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:title>
</xsl:for-each>
</datacite:titles>
</xsl:if>
<xsl:if test="//dc:description">
<datacite:descriptions>
<xsl:for-each select="//dc:description">
<datacite:description>
<xsl:attribute name="descriptionType" select="'Abstract'"/>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:description>
</xsl:for-each>
</datacite:descriptions>
</xsl:if>
<xsl:for-each select="distinct-values(//dc:language)[string-length(normalize-space(.)) > 0]">
<datacite:language>
<xsl:value-of select="normalize-space(.)"/>
</datacite:language>
</xsl:for-each>
<xsl:for-each select="distinct-values(//dc:publisher)[string-length(normalize-space(.)) > 0]">
<datacite:publisher>
<xsl:value-of select="normalize-space(.)"/>
</datacite:publisher>
</xsl:for-each>
<xsl:if test="//dc:format[string-length(normalize-space(.)) > 0]">
<datacite:formats>
<xsl:for-each select="distinct-values(//dc:format)[string-length(normalize-space(.)) > 0]">
<datacite:format>
<xsl:value-of select="normalize-space(.)"/>
</datacite:format>
</xsl:for-each>
</datacite:formats>
</xsl:if>
<xsl:if test="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReferences>
<xsl:for-each select="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReference>
<datacite:funderName>
<xsl:value-of select="./oaire:funderName"/>
</datacite:funderName>
<datacite:funderIdentifier>
<xsl:attribute name="funderIdentifierType" select="'Crossref Funder ID'"/>
<xsl:value-of select="./oaire:funderIdentifier"/>
</datacite:funderIdentifier>
<datacite:awardNumber>
<xsl:value-of select="./oaire:awardNumber"/>
</datacite:awardNumber>
<!--<xsl:value-of select="."/>-->
</datacite:fundingReference>
</xsl:for-each>
</datacite:fundingReferences>
</xsl:if>
<xsl:apply-templates select="(//*[local-name()='resource'], //*[local-name() = 'oai_openaire'])/*[not(local-name() = ('identifier', 'alternateIdentifiers', 'alternateIdentifier', 'relatedIdentifiers', 'relatedIdentifier', 'description', 'titles', 'title', 'language', 'publisher', 'resourceType', 'version', 'fundingReferences', 'fundingReference', 'rights', 'licenseCondition', 'file', 'format', 'audience', 'source', 'coverage'))][not(starts-with(local-name(), 'citation'))]"/>
<!-- </oaire:resource> -->
</datacite:resource>
<!-- ~~~~~ put oaf elements below datacite:resource ~~~~~ -->
<!-- oaf:identifier -->
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[string-length(substring-after(normalize-space(.), ':::')) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="substring-before(normalize-space(.), ':::')"/>
<xsl:value-of select="substring-after(normalize-space(.), ':::')"/>
</oaf:identifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</oaf:identifier>
</xsl:if>
<xsl:if test="//*[local-name() = 'about']/*[local-name() = 'provenance']/*[local-name() = 'originDescription']/*[local-name() = 'originDescription']/*[local-name() = 'identifier' and string-length(.) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'oai-original'"/>
<xsl:value-of select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'identifier']"/>
</oaf:identifier>
</xsl:if>
<xsl:variable name='varEmbargoEndDate' select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='date'][@dateType='Available']), 'DateISO8601')"/>
<!-- resourceType, superType -->
<xsl:choose>
<xsl:when test="lower-case(//*[local-name()='resourceType']/@resourceTypeGeneral) = ('dataset', 'software', 'literature', 'publication', 'other research product') or not(//*[local-name()='resourceType']/@resourceTypeGeneral)">
<dr:CobjCategory>
<xsl:attribute name="type" select="//oaf:datasourceprefix[. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/')]/'other', //oaf:datasourceprefix[not(. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/'))]/$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
</xsl:when>
<!-- drop journals -->
<xsl:when test="lower-case(//*[local-name()='resourceType']/@uri) = 'http://purl.org/coar/resource_type/c_0640'">
<xsl:call-template name="terminate"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="terminate"/>
</xsl:otherwise>
</xsl:choose>
<!-- review status -->
<xsl:variable name="varRefereedConvt" select="for $i in (
//*[local-name()='resourceType']/(., @uri), //oai:setSpec, //*[local-name()='description'])
return TransformationFunction:convertString($tf, normalize-space($i), 'ReviewLevels')"/>
<xsl:variable name="varRefereedIdntf" select="(
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])pre[\.\-_\\/\s\(\)%\d#:]?prints?([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0002',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])refereed([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0001',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '.*-peer-reviewed-(fulltext-)?article-.*')]/'0001')"/>
<xsl:variable name="varRefereedSourc" select="(//*[local-name()=('publisher', 'source', 'citationTitle')][matches(lower-case(.), '.*[\s\-\.\\_/:%]pre[\s\-\.\\_/:%]?prints?([\s\-\.\\_/:%].*|$)')]/'0002')"/>
<xsl:variable name="varRefereedReltn" select="//*[local-name() = 'relatedIdentifier'][./@relationType/lower-case(.)='isreviewedby']/'0001'"/>
<xsl:variable name="varRefereedDesct" select="(//*[local-name() = 'description']
[matches(lower-case(.), '.*(this\s*book|this\s*volume|it)\s*(constitutes|presents)\s*the\s*(thoroughly\s*)?refereed') or
matches(lower-case(.), '.*peer[\.\-_/\s\(\)]?review\s*under\s*responsibility\s*of.*') or
matches(lower-case(.), '(this|a)\s*(article|preprint)\s*(has\s*been\s*)?(peer[\-\s]*)?reviewed\s*and\s*recommended\s*by\s*peer[\-\s]*community')]/'0001')"/>
<xsl:variable name="varRefereedTitle" select="(//*[local-name()=('title')][matches(lower-case(.), '.*\[.*peer[\s\-\._]*review\s*:.*\]\s*$')]/'0001')"/>
<xsl:variable name="varRefereedVersn" select="TransformationFunction:convertString($tf, normalize-space( //*[local-name()='version']), 'ReviewLevels')"/>
<xsl:variable name="varRefereed" select="($varRefereedConvt, $varRefereedIdntf, $varRefereedSourc, $varRefereedReltn, $varRefereedDesct, $varRefereedTitle, $varRefereedVersn)"/>
<xsl:choose>
<xsl:when test="count($varRefereed[. = '0001']) > 0">
<oaf:refereed>
<xsl:value-of select="'0001'"/>
</oaf:refereed>
</xsl:when>
<xsl:when test="count($varRefereed[. = '0002']) > 0">
<oaf:refereed>
<xsl:value-of select="'0002'"/>
</oaf:refereed>
</xsl:when>
</xsl:choose>
<oaf:dateAccepted>
<xsl:value-of select="TransformationFunction:convertString($tf, normalize-space(//datacite:date[@dateType = 'Issued']), 'DateISO8601')"/>
</oaf:dateAccepted>
<!--
<oaf:accessrights>
<xsl:variable name='varAccessRights' select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')" />
</oaf:accessrights>
<xsl:choose>
<xsl:when test="not($varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())))">
<xsl:value-of select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')"/>
</xsl:when>
<xsl:when test="$varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
</xsl:choose>
-->
<xsl:variable name='varAccessRights' select="string-join((for $i in ((//*[local-name() = 'rights'], //*[lower-case(local-name())='licensecondition'])/(@*, .)) return TransformationFunction:convertString($tf, $i, 'AccessRights')), ' ')" />
<oaf:accessrights>
<xsl:choose>
<xsl:when test="contains($varAccessRights, 'OPEN SOURCE')">
<xsl:value-of select="'OPEN SOURCE'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'OPEN')">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and (xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())">
<xsl:value-of select="'EMBARGO'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'RESTRICTED')">
<xsl:value-of select="'RESTRICTED'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'CLOSED')">
<xsl:value-of select="'CLOSED'"/>
</xsl:when>
</xsl:choose>
</oaf:accessrights>
<xsl:for-each select="//*[local-name()='licenseCondition']
[string-length(.) > 0 or string-length(@uri) > 0]
[(starts-with(@uri, 'http') and (contains(@uri, '://creativecommons.org/licenses/') or contains(@uri, '://creativecommons.org/publicdomain/') or contains(@uri, '://opensource.org/licenses/') or contains(@uri, '://opendatacommons.org/licenses/') or contains(@uri, '://rightsstatements.org/page/') or contains(@uri, '://rightsstatements.org/vocab/') or contains(@uri, '://www.opendefinition.org/licenses/') or contains(@uri, '://www.gnu.org/licenses/') or contains(@uri, '://artlibre.org/licence/') or contains(@uri, '://repositorio.uca.edu.sv/jspui/licencias/') or contains(@uri, '://bibliotecavirtual.unl.edu.ar/licencia/'))) or matches(., '^CC[- ]BY([- ](NC([- ](ND|SA))?|ND|SA))([- ]\d(\.\d)?)?$', 'i')]">
<oaf:license>
<xsl:value-of select=".[not(./@uri)], .[./@uri]/@uri"/>
</oaf:license>
</xsl:for-each>
<oaf:language>
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
</oaf:language>
<xsl:call-template name="funding" />
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
<!-- oaf:container -->
<!-- ToDo: set @typ -->
<xsl:variable name="varCitation" select="//*[starts-with(local-name(), 'citation')]" />
<xsl:variable name="varSource" select="//dc:source[//oaf:datasourceprefix[.=('od______1514', 'od______3158')]]" />
<!-- test
<xsl:if test="contains($varContainerPid, ':::')">
<oaf:container>
<xsl:for-each select="tokenize(normalize-space($varContainerPid), ' ')">
<xsl:attribute name="{lower-case(substring-before(., ':::'))}" select="substring-before(substring-after(., ':::'), ':::')"/>
<xsl:attribute name="typ" select="substring-after(substring-after(., ':::'), ':::')"/>
</xsl:for-each>
<xsl:choose>
<xsl:when test="lower-case(substring-before(., ':::')) = ('issn', 'pissn', 'eissn', 'lissn')">
<xsl:attribute name="vol" select="$varCitation[local-name(.) = 'citationVolume']"/>
<xsl:attribute name="iss" select="$varCitation[local-name(.) = 'citationIssue']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
<xsl:when test="lower-case(substring-before(., ':::')) = 'isbn'">
<xsl:attribute name="edt" select="$varCitation[local-name(.) = 'citationEdition']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$varCitation[local-name(.) = 'citationTitle'], $varSource" />
</oaf:container>
</xsl:if>
test -->
<xsl:if test="$varCobjCategory = '0001' and string-length($varContainerPid) > 0">
<oaf:journal>
<xsl:attribute name='issn' select="substring-before(substring-after($varContainerPidIssn, ' ISSN:::'), ':::')" />
<xsl:attribute name='eissn' select="substring-before(substring-after($varContainerPidIssn, ' EISSN:::'), ':::')" />
<xsl:attribute name='vol' select="//*[local-name() = 'citationVolume']"/>
<xsl:attribute name='iss' select="//*[local-name() = 'citationIssue']"/>
<xsl:attribute name='sp' select="//*[local-name() = 'citationStartPage']"/>
<xsl:attribute name='ep' select="//*[local-name() = 'citationEndPage']"/>
<xsl:value-of select="//*[local-name() = 'citationTitle']" />
</oaf:journal>
</xsl:if>
<!-- Huelva marks L, E ISSNs as ISSNs, with mark within field in spaces or after blanc -->
<!-- Qeios declares many records as text, although many seem to be definitions which are also related to 'journal' volumes/issues -->
<!-- oaf:fulltext-->
<!-- toDo: clarify if fulltext should be filled when URL given and rights oa -->
<!--
<xsl:if test="//*[local-name() = 'file']">
<oaf:fulltext>
<xsl:value-of select="//*[local-name() = 'file']"/>
</oaf:fulltext>
</xsl:if>
-->
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template name="funding">
<!-- funding -->
<xsl:for-each select="//*[local-name()='fundingReference'][./*[local-name()='awardNumber']]">
<xsl:choose>
<!-- FP7 -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004963|10.13039/100011199|10.13039/100011102)\s*$')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- H2020 (Horizon 2020 Framework Programme) -->
<!-- -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100010661)\s*')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- AKA -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002341)\s*$') ]
or ./*[local-name()='funderName'][contains(., 'Suomen Akatemia') or contains(., 'Academy of Finland')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- ARC -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000923)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Australian Research Council')])
and ./*[local-name()='awardNumber'][matches(., '^\d{6}$')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, replace(./*[local-name()='awardNumber'], '.*(^\d{6}$).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- CONICYT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002848)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Comisión Nacional de Investigación Científica y Tecnológica') or contains(., 'CONICYT')]">
<oaf:projectid>
<xsl:value-of select="concat($varCONICYT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- DFG -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001659)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Deutsche Forschungsgemeinschaft') or contains(., 'DFG') or contains(., 'Deutsche Forschungsgemeinschaft (DFG)')]">
<oaf:projectid>
<xsl:value-of select="concat($varDFG, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!---->
<!-- FCT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fundação para a Ciência e a Tecnologia')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- FWF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002428)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fonds zur Förderung der Wissenschaftlichen Forschung') or contains(., 'Austrian Science Fund')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MESTD -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][(contains(., 'Ministarstvo Prosvete, Nauke i Tehnolo') and contains(., 'kog Razvoja')) or contains(., 'MESTD')]">
<oaf:projectid>
<xsl:value-of select="concat($varMESTD, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MZOS -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100006588)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Ministarstvo Znanosti, Obrazovanja i Sporta') or contains(., 'Ministry of Science, Education and Sports')]">
<oaf:projectid>
<xsl:value-of select="concat($varMZOS, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NHMRC -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000925)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Health and Medical Research Council') or contains(., 'NHMRC')]">
<oaf:projectid>
<xsl:value-of select="concat($varNHMRC, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NIH -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000002)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Institutes of Health')]">
<oaf:projectid>
<xsl:value-of select="concat($varNIH, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000001)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Science Foundation')]">
<oaf:projectid>
<xsl:value-of select="concat($varNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NWO -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100003246)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Netherlands Organisation for Scientific Research') or contains(., 'Nederlandse Organisatie voor Wetenschappelijk Onderzoek')]">
<oaf:projectid>
<xsl:value-of select="concat($varNWO, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- RCUK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000690)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Research Councils UK') or contains(., 'RCUK')]">
<oaf:projectid>
<xsl:value-of select="concat($varRCUK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- SFI -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001602)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Science Foundation Ireland')])
and ./*[local-name()='awardNumber'][matches(., '.*([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+.*')]">
<oaf:projectid>
<xsl:value-of select="concat($varSFI, replace(./*[local-name()='awardNumber'], '.*(^|\s)(([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+)($|\s).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- SNSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001711)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Swiss National Science Foundation') or contains(., 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung')]">
<oaf:projectid>
<xsl:value-of select="concat($varSNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- TUBITAK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004410)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Turkish National Science and Research Council') or (contains(., 'Türkiye Bilimsel ve Teknolojik Ara') and contains(., 'rma Kurumu'))]">
<oaf:projectid>
<xsl:value-of select="concat($varTUBITAK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- WT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100004440)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Wellcome Trust') or . = 'WT']">
<oaf:projectid>
<xsl:value-of select="concat($varWT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- toDo: improve by selecting all attributes -->
<xsl:template match="//*[local-name()='nameIdentifier']">
<datacite:nameIdentifier>
<xsl:attribute name="nameIdentifierScheme" select="./@*[local-name()=('nameIdentifierScheme')]"/>
<xsl:attribute name="schemeURI" select="./@*[local-name()=('schemeURI')]"/>
<xsl:choose>
<xsl:when test=".[contains(., 'orcid.org/')]">
<xsl:value-of select="substring-after(., 'orcid.org/')" />
</xsl:when>
<xsl:when test=".[contains(., 'researcherid.com/rid/')]">
<xsl:value-of select="substring-after(., 'researcherid.com/rid/')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</datacite:nameIdentifier>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<header xmlns="http://www.openarchives.org/OAI/2.0/">
<!--
<xsl:copy copy-namespaces="no">
-->
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
<!--
</xsl:copy>
-->
</header>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,231 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
extension-element-prefixes="TransformationFunction"
exclude-result-prefixes="TransformationFunction">
<xsl:param name="varOfficialName"/>
<xsl:param name="varDsType"/>
<xsl:param name="varDataSourceId"/>
<xsl:param name="varCorda" select="'corda_______::'"/>
<xsl:param name="varCordaH2020" select="'corda__h2020::'"/>
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
<xsl:template match="/">
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
<xsl:call-template name="validRecord"/>
</xsl:template>
<xsl:template name="validRecord">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']"/>
<metadata>
<xsl:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'resource']"/>
<xsl:copy-of
select="//*[local-name() = 'metadata']/*[local-name() = 'relatedPublication']"
copy-namespaces="no"/>
<xsl:copy-of
select="//*[local-name() = 'metadata']/*[local-name() = 'relatedDataSet']"
copy-namespaces="no"/>
<xsl:if test="//*[local-name() = 'date']/@dateType = 'Available'">
<xsl:variable name="varEmbargoEndDate"
select="TransformationFunction:convertString($tf, normalize-space(//*[local-name() = 'date'][@dateType = 'Available']), 'DateISO8601')"/>
<xsl:choose>
<xsl:when test="string-length($varEmbargoEndDate) > 0">
<oaf:embargoenddate>
<xsl:value-of select="$varEmbargoEndDate"/>
</oaf:embargoenddate>
</xsl:when>
<xsl:otherwise>
<oaf:skip>
<xsl:value-of
select="TransformationFunction:skipRecord($tf, $index)"/>
</oaf:skip>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<dr:CobjCategory>
<xsl:value-of
select="TransformationFunction:convertString($tf, //*[local-name() = 'resourceType']/@resourceTypeGeneral, 'TextTypologies')"
/>
</dr:CobjCategory>
<oaf:dateAccepted>
<xsl:value-of
select="TransformationFunction:convertString($tf, normalize-space(//*[local-name() = 'publicationYear']), 'DateISO8601')"
/>
</oaf:dateAccepted>
<xsl:choose>
<xsl:when
test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
<oaf:accessrights>
<xsl:value-of
select="TransformationFunction:convertString($tf, //*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"
/>
</oaf:accessrights>
</xsl:when>
<xsl:when
test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
<oaf:accessrights>
<xsl:value-of
select="TransformationFunction:convertString($tf, //*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"
/>
</oaf:accessrights>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when
test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'http://creativecommons.org')]">
<oaf:accessrights>
<xsl:text>OPEN</xsl:text>
</oaf:accessrights>
</xsl:when>
<xsl:otherwise>
<oaf:accessrights>
<xsl:text>CLOSED</xsl:text>
</oaf:accessrights>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<oaf:language>
<xsl:value-of
select="TransformationFunction:convert($tf, //*[local-name() = 'language'], 'Languages')"
/>
</oaf:language>
<!--
<xsl:if test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics/embargoedAccess')]">
<oaf:embargoenddate>
<xsl:value-of select="//*[local-name()='date']/@dateType='Available'"/>
</oaf:embargoenddate>
</xsl:if>
-->
<!-- I am not sure the following foreach works and it is useful...nameIdentifie seems not to be an XML element in pangaea format -->
<xsl:for-each select="//*[local-name() = 'nameIdentifier']">
<xsl:if test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')"
/>
</oaf:projectid>
</xsl:if>
<xsl:if test="starts-with(normalize-space(.), 'tar')">
<oaf:projectid>
<xsl:value-of select="normalize-space(.)"/>
</oaf:projectid>
</xsl:if>
<xsl:if test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/H2020/')) >= 6">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCordaH2020, 's/^(.*info:eu-repo\/grantAgreement\/EC\/H2020\/)//gm')" />
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//*[local-name() = 'projectid']">
<xsl:choose>
<xsl:when test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) > 0">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')" />
</oaf:projectid>
</xsl:when>
<xsl:when test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/H2020/')) > 0">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCordaH2020, 's/^(.*info:eu-repo\/grantAgreement\/EC\/H2020\/)//gm')" />
</oaf:projectid>
</xsl:when>
<xsl:otherwise>
<oaf:projectid><xsl:value-of select="normalize-space(.)"/></oaf:projectid>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!--
<xsl:for-each select="//*[local-name() = 'projectid']">
<xsl:if test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) >0">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')"
/>
</oaf:projectid>
</xsl:if>
<xsl:if test="starts-with(normalize-space(.), 'tar')">
<oaf:projectid>
<xsl:value-of select="normalize-space(.)"/>
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//*[local-name() = 'nameIdentifier']">
<xsl:choose>
<xsl:when test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) >= 6">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')" />
</oaf:projectid>
</xsl:when>
<xsl:when test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/H2020/')) >= 6">
<oaf:projectid>
<xsl:value-of
select="TransformationFunction:regExpr($tf, normalize-space(.), $varCordaH2020, 's/^(.*info:eu-repo\/grantAgreement\/EC\/H2020\/)//gm')" />
</oaf:projectid>
</xsl:when>
<xsl:otherwise>
<xsl:if test="starts-with(normalize-space(.),'info:eu-repo/grantAgreement')">
<oaf:projectid>
<xsl:value-of select="normalize-space(.)"/>
</oaf:projectid>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
-->
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']"/>
</record>
</xsl:template>
<!--
<xsl:template match="//*[local-name()='language']">
<oaf:language>
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
</oaf:language>
</xsl:template>
-->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,346 @@
<!-- original: xslt_dc2oaf_narcis from PROD 2021-11-18 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:transformExt="http://namespace.openaire.eu/java/org.apache.commons.codec.digest.DigestUtils"
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
extension-element-prefixes="transformExt TransformationFunction"
exclude-result-prefixes="transformExt TransformationFunction" >
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:param name="varOfficialName" />
<xsl:param name="varDsType" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varFP7" select="'corda_______::'"/>
<xsl:param name="varH2020" select="'corda__h2020::'"/>
<xsl:param name="repoCode" select="substring-before(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
<xsl:variable name="vCodes">
<codes>
<code key="uva" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="uvapub" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="vumc" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="cwi" value="od______2358" id="opendoar____::2358" name="Repository CWI Amsterdam"/> <!-- CWI -->
<code key="eur" value="od______1113" id="opendoar____::1113" name="Erasmus University Institutional Repository"/>
<code key="wur" value="od_______370" id="opendoar____::370" name="Wageningen Yield"/>
<code key="uu" value="od_______101" id="opendoar____::101" name="Utrecht University Repository"/>
<code key="ru" value="od______1236" id="opendoar____::1236" name="Radboud Repository"/> <!-- Radboud -->
<code key="run" value="od______1236" id="opendoar____::1236" name="Radboud Repository"/> <!-- Radboud -->
<code key="uvt" value="od_______550" id="opendoar____::550" name="Tilburg University Repository"/> <!-- Tilburg -->
<code key="aup" value="od________19" id="opendoar____::19" name="Amsterdam University Press Publications"/> <!-- amsterdam univ. press -->
<code key="rug" value="od_______189" id="opendoar____::189" name="University of Groningen Digital Archive"/> <!-- groningen -->
<code key="dans" value="r384e1237760" id="re3data_____::r3d100010214" name="EASY"/> <!--easy -->
<code key="differ" value="differ______" id="openaire____::75ee19e2-ff9e-47f7-bed6-2e3ee23e2b49" name="Dutch Institute for Fundamental Energy Research"/>
<code key="kit" value="od______1423" id="opendoar____::1423" name="Search4Dev"/> <!-- search4dev -->
<code key="ul" value="od_______202" id="opendoar____::202" name="Leiden University Repository"/> <!-- leiden -->
<code key="um" value="od________83" id="opendoar____::83" name="UM Publications"/>
<code key="knaw" value="od______1476" id="opendoar____::1476" name="KNAW Repository"/>
<code key="vu" value="od_______369" id="opendoar____::369" name="DSpace at VU"/>
<code key="ut" value="od_______354" id="opendoar____::354" name="Universiteit Twente Repository"/>
<code key="hbo" value="hbo_________" id="openaire____::79c8217f-00ee-4902-9743-9e11b4970c60" name="HBO Kennisbank"/>
<code key="kim" value="kim_________" id="openaire____::b1b15b72-bf0b-4f91-9f95-dab2e43d3eaa" name="Publicaties KiM"/>
<code key="nivel" value="nivel_____nl" id="driver______::daf0542d-1ef5-4f9d-80f1-62849b92aefa" name="NIVEL publications"/>
<code key="ntrl" value="od_______913" id="opendoar____::913" name="Naturalis Publications"/>
<code key="nyenrode" value="nyenrode____" id="openaire____::e57352f3-516b-42cb-b666-2480233c6513" name="Publications of the University Nyenrode"/>
<code key="ou" value="od_______233" id="opendoar____::233" name="DSpace at Open Universiteit Nederland "/>
<code key="ptu" value="ptu_________" id="openaire____::openaire____::f834f1fe-8198-4929-ac0b-b1c1bf166f38" name="Protestantse Theologische Universiteit"/>
<code key="rivm" value="od_______881" id="opendoar____::881" name="Web-based Archive of RIVM Publications"/>
<code key="scp" value="scp_________" id="openaire____::088a0087-4bc6-4c38-a052-b446c3b225a7" name="Sociaal en Cultureel Planbureau"/>
<code key="swov" value="swov________" id="openaire____::06d89df2-b613-4989-9dc3-f60f2fc593f6" name="Stichting Wetenschappelijk Onderzoek Verkeersveiligheid (SWOV) Library Repository"/>
<code key="tno" value="tno_________" id="openaire____::58fd0ad2-c476-11e5-80b3-0021e9e777ac" name="TNO Repository - hosted by TU Delft Library"/>
<code key="tue" value="od_______567" id="opendoar____::567" name="Repository TU/e"/>
<code key="tuk" value="tuk_________" id="openaire____::df55d991-1ebb-459c-aed6-559bcbb1d277::" name="Theological University Kampen"/>
<code key="uvh" value="uvh_______nl" id="driver______::a422c38b-73de-44bf-a340-a4fd5f0817ea" name="Universiteit voor Humanistiek"/>
<code key="tua" value="tua_________" id="openaire____::cd073e1e-2fe9-4ea7-aea5-dc6855c347f7" name="Theological University Apeldoorn"/>
<code key="tud" value="od_______571" id="opendoar____::571" name="TU Delft Repository"/>
<code key="wodc" value="wodc______nl" id="driver______::03c60250-9d65-44fe-85d3-23503b3303af" name="WODC Repository Ministerie van Veiligheid en Justitie"/>
<code key="unesco" value="unesco___ihe" id="2877c7c4-b57a-4f62-9c16-d7faa5b0b98b" name="UNESCO-IHE Institute for Water Education"/>
</codes>
</xsl:variable>
<!-- not considered
hbo added
tno added
differ added
nyenrode added
beeldengeluis todo, not yet found in metadata
philips todo, not yet found in metadata
scp added
swov added
tuk added
tua added
ptu added
ut_restricted ? merge with ut?
nda
neyenrode
-->
<xsl:key name="kCodeByName" match="code" use="string(@key)"/>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template match="/">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:title"/>
<xsl:with-param name="targetElement" select="'dc:title'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:creator/replace(., '^(.*)\|.*$', '$1')"/>
<xsl:with-param name="targetElement" select="'dc:creator'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:contributor"/>
<xsl:with-param name="targetElement" select="'dc:contributor'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:description"/>
<xsl:with-param name="targetElement" select="'dc:description'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:subject"/>
<xsl:with-param name="targetElement" select="'dc:subject'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:publisher"/>
<xsl:with-param name="targetElement" select="'dc:publisher'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:format"/>
<xsl:with-param name="targetElement" select="'dc:format'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:type"/>
<xsl:with-param name="targetElement" select="'dc:type'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:source"/>
<xsl:with-param name="targetElement" select="'dc:source'"/>
</xsl:call-template>
<dc:language>
<xsl:value-of select="TransformationFunction:convertString($tf, //dc:language, 'Languages')"/>
</dc:language>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:rights"/>
<xsl:with-param name="targetElement" select="'dc:rights'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:relation"/>
<xsl:with-param name="targetElement" select="'dc:relation'"/>
</xsl:call-template>
<xsl:if test="not(//dc:identifier[starts-with(., 'http')])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:identifier[starts-with(., 'http')]"/>
<xsl:with-param name="targetElement" select="'dc:identifier'"/>
</xsl:call-template>
<xsl:for-each select="//dc:relation">
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<!--
<xsl:if test="not(//didl:Component/didl:Resource[@mimeType='application/pdf'])">
<xsl:call-template name="terminate"/>
</xsl:if>
-->
<oaf:accessrights>
<xsl:value-of select="TransformationFunction:convert($tf, //dc:rights, 'AccessRights')"/>
</oaf:accessrights>
<!--
<dr:CobjCategory>
<xsl:value-of select="TransformationFunction:convertString($tf, //dc:type, 'TextTypologies')" />
</dr:CobjCategory>
-->
<dr:CobjCategory>
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, //dc:type, 'TextTypologies')" />
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
<xsl:attribute name="type" select="$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
<!-- review status -->
<!-- -->
<xsl:variable name="varRefereedConvt" select="for $i in (//dc:type, //dc:description, //oai:setSpec)
return TransformationFunction:convertString($tf, normalize-space($i), 'ReviewLevels')"/>
<xsl:variable name="varRefereedIdntf" select="(//*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '(^|.*[\.\-_/\s\(\)%\d#])pre[\.\-_/\s\(\)%\d#]?prints?([\.\-_/\s\(\)%\d#].*)?$')][count(//dc:identifier) = 1]/'0002', //*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '(^|.*[\.\-_/\s\(\)%\d#])refereed([\.\-_/\s\(\)\d%\d#].*)?$')]/'0001', //*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '.*-peer-reviewed-(fulltext-)?article-.*')]/'0001')"/>
<xsl:variable name="varRefereedSourc" select="//*[string(node-name(.)) = ('dc:source', 'dc:publisher') and matches(lower-case(.), '^(.*\s)?pre[\s\-_]*prints?([\s\.,].*)?$')]/'0002'"/>
<xsl:variable name="varRefereedDescr" select="(//dc:description[matches(lower-case(.), '.*(this\s*book|this\s*volume|it)\s*constitutes\s*the\s*(thoroughly\s*)?refereed') or matches(lower-case(.), '.*peer[\.\-_/\s\(\)]?review\s*under\s*responsibility\s*of.*') or matches(lower-case(.), '(this|a)\s*(article|preprint)\s*(has\s*been\s*)?(peer[\-\s]*)?reviewed\s*and\s*recommended\s*by\s*peer[\-\s]*community')]/'0001', //dc:description[matches(., '^version\s*(préliminaire.*|preliminary.*|0$)')]/'0002')"/>
<xsl:variable name="varRefereedTitle" select="(//dc:title[matches(lower-case(.), '.*\[.*peer[\s\-\._]*review\s*:.*\]\s*$')]/'0001',
//dc:title[matches(lower-case(.), '.*\(\s*pre[\s\-\._]*prints?\s*\)\s*$')]/'0002')"/>
<xsl:variable name="varRefereedSubjt" select="(//dc:subject[matches(lower-case(.), '^\s*refereed\s*$')][//oaf:datasourceprefix = 'narcis______']/'0001',
//dc:subject[matches(lower-case(.), '^\s*no[nt].{0,3}refereed\s*$')][//oaf:datasourceprefix = 'narcis______']/'0002')"/>
<xsl:variable name="varRefereed" select="($varRefereedConvt, $varRefereedIdntf, $varRefereedSourc, $varRefereedDescr, $varRefereedTitle, $varRefereedSubjt)"/>
<xsl:choose>
<xsl:when test="count($varRefereed[. = '0001']) > 0">
<oaf:refereed>
<xsl:value-of select="'0001'"/>
</oaf:refereed>
</xsl:when>
<xsl:when test="count($varRefereed[. = '0002']) > 0">
<oaf:refereed>
<xsl:value-of select="'0002'"/>
</oaf:refereed>
</xsl:when>
</xsl:choose>
<oaf:dateAccepted>
<xsl:value-of select="TransformationFunction:convertString($tf, //dc:date[1], 'DateISO8601')"/>
</oaf:dateAccepted>
<xsl:if test="//dc:relation[starts-with(., 'http')] and //dc:rights[.='info:eu-repo/semantics/openAccess']">
<oaf:fulltext>
<xsl:value-of select="//dc:relation[starts-with(., 'http')]"/>
</oaf:fulltext>
</xsl:if>
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@name"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@id"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
<!-- ID recognition incomplete -->
<xsl:variable name="varKnownFileEndings" select="('.bmp', '.doc', '.docx', '.epub', '.flv', '.jpeg', '.jpg', '.m4v', '.mp4', '.mpg', '.odp', '.pdf', '.png', '.ppt', '.tiv', '.txt', '.xls', '.xlsx', '.zip')" />
<!-- regular expression for DOIs reduced here - letters like less-than and quotation marks don't work in matches, use identiferExtract when enabled -->
<xsl:variable name="varIdDoi" select="distinct-values((//dc:identifier[starts-with(., '10.')][matches(., '(10[.][0-9]{4,}[^\s/>]*/[^\s>]+)')], //dc:identifier[starts-with(., 'http') and (contains(., '://dx.doi.org/10.') or contains(., '://doi.org/10.'))]/substring-after(., 'doi.org/'), //dc:identifier[starts-with(lower-case(.), 'doi:10.')]/substring-after(lower-case(.), 'doi:')))" />
<xsl:for-each select="$varIdDoi">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'doi'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdHdl" select="distinct-values(//dc:identifier[starts-with(., 'http') and contains(., '://hdl.handle.net/')]/substring-after(., 'hdl.handle.net/'))" />
<xsl:for-each select="$varIdHdl">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'handle'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdUrn" select="distinct-values(//dc:identifier[starts-with(., 'urn:nbn:nl:') or starts-with(., 'URN:NBN:NL:')])" />
<xsl:for-each select="$varIdUrn">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'urn'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<!-- the 2 comparison orders needed to work also for URL encoded baseURLs or item URLs -->
<xsl:variable name="varOrigBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varIdLdpg" select="distinct-values(//dc:identifier[(contains(substring-after(., '://'), '/') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)])" />
<xsl:for-each select="$varIdLdpg">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'landingPage'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdUrl" select="distinct-values(//dc:identifier[starts-with(., 'http')][not(contains(., '://dx.doi.org/') or contains(., '://doi.org/') or contains(., '://hdl.handle.net/'))][count(index-of($varIdLdpg, .)) = 0])" />
<xsl:for-each select="$varIdUrl">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'url'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<oaf:identifier>
<xsl:attribute name="identifierType" select="'oai-original'"/>
<xsl:value-of select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'identifier']"/>
</oaf:identifier>
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template name="allElements">
<xsl:param name="sourceElement"/>
<xsl:param name="targetElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="{$targetElement}">
<xsl:value-of select="normalize-space(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
</xsl:copy>
</xsl:template>
<!--
<xsl:template match="dri:objIdentifier">
<xsl:variable name="objIdentifier" select="substring-after(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:variable name="nsPrefix" select="key('kCodeByName', $repoCode, $vCodes)/@value"/>
<xsl:if test="string-length($nsPrefix) = 0">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:copy>
<xsl:value-of select="concat( $nsPrefix , '::', transformExt:md5Hex(string($objIdentifier)))"/>
</xsl:copy>
</xsl:template>
-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,376 @@
<!-- production ; 2021-10-11 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rioxxterms="http://docs.rioxx.net/schema/v2.0/rioxxterms/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:transformExt="http://namespace.openaire.eu/java/org.apache.commons.codec.digest.DigestUtils"
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
extension-element-prefixes="transformExt TransformationFunction"
exclude-result-prefixes="transformExt TransformationFunction" >
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:param name="varOfficialName" />
<xsl:param name="varDsType" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varFP7" select="'corda_______::'"/>
<xsl:param name="varH2020" select="'corda__h2020::'"/>
<xsl:param name="repoCode" select="replace(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], '^(.*):.*$', '$1')"/>
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
<xsl:variable name="vCodes">
<codes>
<code key="oai:archive.lstmed.ac.uk" value="od______2698" id="opendoar____:2698:" name="LSTM Online Archive"/>
<code key="oai:arro.anglia.ac.uk" value="od______1850" id="opendoar____::1850" name="Anglia Ruskin Research Online"/>
<code key="oai:centaur.reading.ac.uk" value="od______1731" id="opendoar____::1731" name="Central Archive at the University of Reading"/>
<code key="oai:clok.uclan.ac.uk" value="od______1882" id="opendoar____::1882" name="Central Lancashire Online Knowledge"/>
<code key="oai:collections.crest.ac.uk" value="od______1603" id="opendoar____::1603" name="Glyndŵr University Research Online"/>
<code key="oai:create.canterbury.ac.uk" value="od______2172" id="opendoar____::2172" name="Canterbury Research and Theses Environment"/>
<code key="oai:eprints.bbk.ac.uk.oai2" value="od________30" id="opendoar____::30" name="Birkbeck Institutional Research Online"/>
<code key="oai:eprints.bournemouth.ac.uk" value="od______1076" id="opendoar____::1076" name="Bournemouth University Research Online"/>
<code key="oai:eprints.chi.ac.uk" value="od______2701" id="opendoar____::2701" name="University of Chichester ChiPrints Repository"/>
<code key="oai:eprints.esc.cam.ac.uk" value="od______3280" id="opendoar____::3280" name="ESC Publications - Cambridge Univesity"/>
<code key="oai:eprints.gla.ac.uk" value="od_______162" id="opendoar____::162" name="Enlighten"/>
<code key="oai:eprints.glos.ac.uk" value="od______3160" id="opendoar____::3160" name="University of Gloucestershire Research Repository"/>
<code key="oai:eprints.gold.ac.uk" value="od______758" id="opendoar____::758" name="Goldsmiths Research Online"/>
<code key="oai:eprints.hud.ac.uk" value="od______1012" id="opendoar____::1012" name="University of Huddersfield Repository"/>
<code key="oai:eprints.keele.ac.uk" value="od______2263" id="opendoar____::2263" name="Keele Research Repository"/>
<code key="oai:eprints.kingston.ac.uk" value="od______1221" id="opendoar____::1221" name="Kingston University Research Repository"/>
<code key="oai:eprints.leedsbeckett.ac.uk" value="od______1551" id="opendoar____::1551" name="Leeds Beckett Repository"/>
<code key="oai:eprints.lse.ac.uk" value="od_______206" id="opendoar____::206" name="LSE Research Online"/>
<code key="oai:eprints.mdx.ac.uk" value="od_______213" id="opendoar____::213" name="Middlesex University Research Repository"/>
<code key="oai:eprints.nottingham.ac.uk" value="od_______226" id="opendoar____::226" name="Nottingham ePrints"/>
<code key="oai:eprints.soas.ac.uk" value="od_______285" id="opendoar____::285" name="SOAS Research Online"/>
<code key="oai:eprints.soton.ac.uk" value="od_______348" id="opendoar____::348" name="e-Prints Soton"/>
<code key="oai:eprints.staffs.ac.uk" value="od______2881" id="opendoar____::2881" name="STORE - Staffordshire Online Repository"/>
<code key="oai:eprints.uwe.ac.uk" value="od______1749" id="opendoar____::1749" name="UWE Research Repository"/>
<code key="oai:eprints.whiterose.ac.uk" value="od_______373" id="opendoar____::373" name="White Rose Research Online"/>
<code key="oai:eresearch.qmu.ac.uk" value="od______1228" id="opendoar____::1228" name="Queen Margaret University eResearch"/>
<code key="oai:gala.gre.ac.uk" value="od______1756" id="opendoar____::1756" name="Greenwich Academic Literature Archive"/>
<code key="oai:http://orca.cf.ac.uk" value="od________55" id="opendoar____::55" name="Online Research @ Cardiff"/>
<code key="oai:insight.cumbria.ac.uk" value="od______1675" id="opendoar____::1675" name="Insight - University of Cumbria"/>
<code key="oai:irep.ntu.ac.uk" value="od______1226" id="opendoar____::1226" name="Nottingham Trent Institutional Repository (IRep)"/>
<code key="oai:kar.kent.ac.uk" value="od______1328" id="opendoar____::1328" name="Kent Academic Repository"/>
<code key="oai:kultur.ucreative.ac.uk" value="od______1925" id="opendoar____::1925" name="UCA Research Online"/>
<code key="oai:lbsresearch.london.edu" value="od______3652" id="opendoar____::3652" name="LBS Research Online"/>
<code key="oai:livrepository.liverpool.ac.uk" value="od______1292" id="opendoar____::1292" name="University of Liverpool Repository"/>
<code key="oai:napier-surface.worktribe.com" value="od______1334" id="opendoar____::1334" name="Repository@Napier"/>
<code key="oai:nectar.northampton.ac.uk" value="od______1251" id="opendoar____::1251" name="NECTAR"/>
<code key="oai:nottingham-repository.worktribe.com" value="od______4162" id="opendoar____::4162" name="Nottingham Research Repository"/>
<code key="oai:nrl.northumbria.ac.uk" value="od______1448" id="opendoar____::1448" name="Northumbria Research Link"/>
<code key="oai:openaccess.city.ac.uk" value="od______2262" id="opendoar____::2262" name="City Research Online"/>
<code key="oai:openaccess.sgul.ac.uk" value="od______2556" id="opendoar____::2556" name="St George's Online Research Archive"/>
<code key="oai:open.ac.uk.OAI2" value="od_______300" id="opendoar____::300" name="Open Research Online"/>
<code key="oai:openresearch.lsbu.ac.uk" value="od______3564" id="opendoar____:3564:" name="LSBU Research Open"/>
<code key="oai:plymsea.ac.uk" value="od______3572" id="opendoar____::3572" name="Plymouth Marine Science Electronic Archive (PlyMEA)"/>
<code key="oai:publications.aston.ac.uk" value="od______1552" id="opendoar____::1552" name="Aston Publications Explorer"/>
<code key="oai:publications.heythrop.ac.uk" value="od______2697" id="opendoar____::2697" name="Heythrop College Publications"/>
<code key="oai:radar.gsa.ac.uk" value="od______2695" id="opendoar____::2695" name="Research Art Design Architecture Repository"/>
<code key="oai:ray.yorksj.ac.uk" value="od______1391" id="opendoar____::1391" name="York St John University Repository"/>
<code key="oai:repository.falmouth.ac.uk" value="od______3261" id="opendoar____::3261" name="Falmouth University Research Repository (FURR)"/>
<code key="oai:repository.londonmet.ac.uk" value="od______3367" id="opendoar____::3367" name="London Met Repository"/>
<code key="oai:repository.uwl.ac.uk" value="od______2700" id="opendoar____::2700" name="UWL Repository"/>
<code key="oai:repository.winchester.ac.uk" value="od______3794" id="opendoar____::3794" name="Winchester Research Repository"/>
<code key="oai:researchonline.bishopg.ac.uk" value="od______3650" id="opendoar____::3650" name="BG Research Online"/>
<code key="oai:researchonline.ljmu.ac.uk" value="od______3107" id="opendoar____::3107" name="LJMU Research Online"/>
<code key="oai:researchonline.lshtm.ac.uk" value="od______2377" id="opendoar____::2377" name="LSHTM Research Online"/>
<code key="oai:researchonline.rcm.ac.uk" value="rcm_ac_uk___" id="opendoar____::5143" name="Royal College of Music Research Online"/>
<code key="oai:researchonline.rvc.ac.uk" value="od______3495" id="opendoar____::3495" name="RVC Research Online"/>
<code key="oai:researchopen.lsbu.ac.uk" value="od______3564" id="opendoar____:3564:" name="LSBU Research Open"/>
<code key="oai:researchspace.bathspa.ac.uk" value="od______2694" id="opendoar____::2694" name="ResearchSPace - Bath Spa University"/>
<code key="oai:research.stmarys.ac.uk" value="od______2478" id="opendoar____::2478" name="St Mary's University Open Research Archive"/>
<code key="oai:roar.uel.ac.uk" value="od______1488" id="opendoar____::1488" name="ROAR at University of East London"/>
<code key="oai:sas-space.sas.ac.uk" value="od_______907" id="opendoar____::907" name="SAS-SPACE"/>
<code key="oai:shura.shu.ac.uk" value="od_______942" id="opendoar____::942" name="Sheffield Hallam University Research Archive"/>
<code key="oai:sro.sussex.ac.uk" value="od______2384" id="opendoar____::2384" name="Sussex Research Online"/>
<code key="oai:sro.sussex.ac.uk" value="od______897" id="opendoar____::897" name="Sussex Research Online"/>
<code key="oai:strathprints.strath.ac.uk" value="od______1181" id="opendoar____::1181" name="Strathprints"/>
<code key="oai:sure.sunderland.ac.uk" value="od______2408" id="opendoar____::2408" name="Sunderland University Institutional Repository"/>
<code key="oai:usir.salford.ac.uk" value="od_______991" id="opendoar____::991" name="University of Salford Institutional repository"/>
<code key="oai:westminsterresearch.wmin.ac.uk" value="od_______936" id="opendoar____::936" name="WestminsterResearch"/>
<code key="oai:wrap.eprints.org" value="od______1177" id="opendoar____::1177" name="University of Worcester Research and Publications"/>
<code key="oai:wrap.warwick.ac.uk" value="od______1288" id="opendoar____::1288" name="Warwick Research Archives Portal Repository"/>
</codes>
</xsl:variable>
<!--
status core-id opendoar-id repo name
na 8 30 Birkbeck Institutional Research Online
na 9 1076 Bournemouth University Research Online
ok 17 1731 Central Archive at the University of Reading
na 18 1882 Central Lancashire Online Knowledge
na 34 348 e-Prints Soton
ok 42 162 Enlighten
ok 49 1603 Glynd\u0175r University Research Online
ok 50 758 Goldsmiths Research Online
ok ? 51 1756 Greenwich Academic Literature Archive
na 53 1226 Nottingham Trent Institutional Repository (IRep)
na 57 1328 Kent Academic Repository
na 62 1551 Leeds Beckett Repository
ok 65 3107 LJMU Research Online
ok 67 206 LSE Research Online
ok 78 1251 NECTAR http://nectar.northampton.ac.uk/cgi/oai2?verb=Identify
ok 83 55 Online Research @ Cardiff
ok 86 300 Open Research Online
ok 92 1334 Repository@Napier
ok 96 1488 ROAR at University of East London
ok 103 285 SOAS Research Online
ok 109 2384 Sussex Research Online
ok 117 1925 "UCA Research Online"
ok 126 1012 University of Huddersfield Repository
ok 130 991 University of Salford Institutional repository oai:usir.salford.ac.uk
ok 134 1749 UWE Research Repository
ok 136 1288 Warwick Research Archives Portal Repository
ok 138 936 WestminsterResearch
ok 140 0 White Rose Research Online
na 147 2377 LSHTM Research Online
ok 148 2697 Heythrop College Publications
ok 162 1448 Northumbria Research Link
ok 175 2478 St Mary\u0027s University Open Research Archive
ok 253 2556 St George's Online Research Archive
ok 620 2881 STORE - Staffordshire Online Repository
ok 683 0 ! 1391 York St John University Repository http://ray.yorksj.ac.uk/cgi/oai2
ok 686 0 !2694 ResearchSPace - Bath Spa University http://researchspace.bathspa.ac.uk/cgi/oai2
ok ? 694 0 Winchester Research Repository http://repository.winchester.ac.uk/cgi/oai2 oai:repository.winchester.ac.uk
? no records so far 170 2134 LSE Theses Online http://etheses.lse.ac.uk/cgi/oai2
no longer existant: code key="oai:eprints.bucks.ac.uk" value="od______1382" id="opendoar____::1382" name="Bucks Knowledge Archive"
<code key="oai:eprints.lse.ac.uk" value="od______2134" id="opendoar____::2134" name="LSE Theses Online"/>
-->
<xsl:key name="kCodeByName" match="code" use="string(@key)"/>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template match="/">
<xsl:if test="not(//dc:identifier[starts-with(., 'http')])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:if test="not(//*[local-name()='project'] or //*[local-name()='free_to_read'])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:if test="not(//dc:title or //dc:title[string-length(.) eq 0])">
<xsl:call-template name="terminate"/>
</xsl:if>
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:title"/>
<xsl:with-param name="targetElement" select="'dc:title'"/>
</xsl:call-template>
<xsl:call-template name="authors">
<xsl:with-param name="sourceElement" select="//*[local-name() = 'author'][normalize-space(.) != ',']"/>
</xsl:call-template>
<!--
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='author']"/>
<xsl:with-param name="targetElement" select="'dc:creator'"/>
</xsl:call-template>
-->
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='contributor']"/>
<xsl:with-param name="targetElement" select="'dc:contributor'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:description"/>
<xsl:with-param name="targetElement" select="'dc:description'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:format"/>
<xsl:with-param name="targetElement" select="'dc:format'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:subject"/>
<xsl:with-param name="targetElement" select="'dc:subject'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:publisher"/>
<xsl:with-param name="targetElement" select="'dc:publisher'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:source"/>
<xsl:with-param name="targetElement" select="'dc:source'"/>
</xsl:call-template>
<dc:language>
<xsl:value-of select="TransformationFunction:convertString($tf, //dc:language, 'Languages')"/>
</dc:language>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:rights"/>
<xsl:with-param name="targetElement" select="'dc:rights'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:relation"/>
<xsl:with-param name="targetElement" select="'dc:relation'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:identifier[starts-with(., 'http')]"/>
<xsl:with-param name="targetElement" select="'dc:identifier'"/>
</xsl:call-template>
<xsl:if test="//*[local-name()='version_of_record'][starts-with(., 'http://dx.doi.org/')]">
<xsl:element name="oaf:identifier">
<xsl:attribute name="identifierType">
<xsl:text>doi</xsl:text>
</xsl:attribute>
<xsl:value-of select="substring-after(//*[local-name()='version_of_record'], 'http://dx.doi.org/')"/>
</xsl:element>
</xsl:if>
<xsl:for-each select="//*[local-name()='project']">
<xsl:if test="(contains(@funder_name, 'EU FP7') or starts-with(@funder_name, 'Europe') or contains(@funder_id, '10.13039/501100000780') or contains(@funder_id, '10.13039/501100004963') ) and not(contains(., '531245')) and not(contains(lower-case(.), 'lifelong learning programme')) and matches(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', '$1', 'i'))"/>
</oaf:projectid>
</xsl:if>
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<!--
<xsl:if test="not(//didl:Component/didl:Resource[@mimeType='application/pdf'])">
<xsl:call-template name="terminate"/>
</xsl:if>
-->
<xsl:choose>
<xsl:when test="//*[local-name()='free_to_read']" >
<oaf:accessrights>
<xsl:text>OPEN</xsl:text>
</oaf:accessrights>
</xsl:when>
<xsl:otherwise>
<oaf:accessrights>
<xsl:text>CLOSED</xsl:text>
</oaf:accessrights>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='license_ref']"/>
<xsl:with-param name="targetElement" select="'oaf:license'"/>
</xsl:call-template>
<dr:CobjCategory>
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, //rioxxterms:type, 'TextTypologies')" />
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
<xsl:attribute name="type" select="$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
<!--
<dr:CobjCategory>
<xsl:value-of
select="TransformationFunction:convertString($tf, //rioxxterms:type, 'TextTypologies')" />
</dr:CobjCategory>
select="TransformationFunction:convertString($tf, //*[local-name()='type'], 'TextTypologies')" />
-->
<oaf:dateAccepted>
<xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name()='publication_date'], 'DateISO8601')"/>
</oaf:dateAccepted>
<oaf:fulltext>
<xsl:value-of select="//dc:identifier[ends-with(., '.pdf')] | //dc:relation[ends-with(., '.pdf')]"/>
</oaf:fulltext>
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@name"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@id"/>
</xsl:attribute>
</oaf:hostedBy>
<!--
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
-->
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template name="allElements">
<xsl:param name="sourceElement"/>
<xsl:param name="targetElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="{$targetElement}">
<xsl:value-of select="normalize-space(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
</xsl:copy>
</xsl:template>
<xsl:template name="authors">
<xsl:param name="sourceElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="dc:creator">
<xsl:if test="starts-with(./@id, 'http://orcid.org')">
<xsl:attribute name="nameIdentifierScheme">
<xsl:text>ORCID</xsl:text>
</xsl:attribute>
<xsl:attribute name="schemeURI">
<xsl:text>http://orcid.org/</xsl:text>
</xsl:attribute>
<xsl:attribute name="nameIdentifier">
<xsl:value-of select="substring-after(./@id, 'http://orcid.org/')"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!--
<xsl:template match="dri:objIdentifier">
<xsl:variable name="objIdentifier" select="substring-after(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:variable name="nsPrefix" select="key('kCodeByName', $repoCode, $vCodes)/@value"/>
<xsl:if test="string-length($nsPrefix) = 0">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:copy>
<xsl:value-of select="concat( $nsPrefix , '::', transformExt:md5Hex(string($objIdentifier)))"/>
</xsl:copy>
</xsl:template>
-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,28 @@
<RESOURCE_PROFILE>
<HEADER>
<RESOURCE_IDENTIFIER value="5c777768-c164-41aa-90f1-58d17b4b272d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
<RESOURCE_KIND value="TransformationRuleDSResources"/>
<RESOURCE_URI value=""/>
<DATE_OF_CREATION value="2021-10-25T10:22:21+00:00"/>
</HEADER>
<BODY>
<CONFIGURATION>
<SOURCE_METADATA_FORMAT interpretation="cleaned" layout="store" name="odf"/>
<SINK_METADATA_FORMAT name="odf_hbase"/>
<IMPORTED/>
<SCRIPT>
<TITLE>xslt_...._hadoop</TITLE>
<CODE><!-- adaptation 2021-08-23 ; ACz/UNIBI -->
</CODE>
</SCRIPT>
</CONFIGURATION>
<STATUS/>
<SECURITY_PARAMETERS/>
</BODY>
</RESOURCE_PROFILE>

@ -8,44 +8,64 @@
xmlns:vocabulary="http://eu/dnetlib/transform/clean"
xmlns:dateCleaner="http://eu/dnetlib/transform/dateISO"
exclude-result-prefixes="xsl vocabulary dateCleaner"
version="2.0">
version="3.0">
<xsl:param name="varOfficialName" />
<xsl:param name="varDsType" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varFP7" select="'corda_______::'" />
<xsl:param name="varH2020" select="'corda__h2020::'" />
<xsl:param name="varAKA" select="'aka_________::'" />
<xsl:param name="varARC" select="'arc_________::'" />
<xsl:param name="varCONICYT" select="'conicytf____::'" />
<xsl:param name="varDFG" select="'dfgf________::'" />
<xsl:param name="varFCT" select="'fct_________::'" />
<xsl:param name="varFWF" select="'fwf_________::'" />
<xsl:param name="varHRZZ" select="'irb_hr______::'" /> <!-- HRZZ not found -->
<xsl:param name="varMESTD" select="'mestd_______::'" />
<xsl:param name="varMZOS" select="'irb_hr______::'" />
<xsl:param name="varNHMRC" select="'nhmrc_______::'" />
<xsl:param name="varNIH" select="'nih_________::'" />
<xsl:param name="varNSF" select="'nsf_________::'" />
<xsl:param name="varNWO" select="'nwo_________::'" />
<xsl:param name="varRCUK" select="'rcuk________::'" />
<xsl:param name="varSFI" select="'sfi_________::'" />
<xsl:param name="varSGOV" select="'sgov________::'" /> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select="'snsf________::'" />
<xsl:param name="varTARA" select="'taraexp_____::'" /> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select="'tubitakf____::'" />
<xsl:param name="varWT" select="'wt__________::'" />
<xsl:param name="varAKA" select = "'aka_________::'"/>
<xsl:param name="varARC" select = "'arc_________::'"/>
<xsl:param name="varANR" select = "'anr_________::'"/>
<xsl:param name="varCHISTERA" select = "'chistera____::'"/>
<xsl:param name="varCONICYT" select = "'conicytf____::'"/>
<xsl:param name="varDFG" select = "'dfgf________::'"/>
<xsl:param name="varEUENVAGENCY" select = "'euenvagency_::'"/>
<xsl:param name="varFCT" select = "'fct_________::'"/>
<xsl:param name="varFP7" select = "'corda_______::'"/>
<xsl:param name="varFWF" select = "'fwf_________::'"/>
<xsl:param name="varGSRI" select = "'gsri________::'"/>
<xsl:param name="varGSRT" select = "'gsrt________::'"/>
<xsl:param name="varH2020" select = "'corda__h2020::'"/>
<xsl:param name="varHRZZ" select = "'irb_hr______::'"/> <!-- HRZZ not found -->
<xsl:param name="varINNOVIRIS" select = "'innoviris___::'"/>
<xsl:param name="varMESTD" select = "'mestd_______::'"/>
<xsl:param name="varMIUR" select = "'miur________::'"/>
<xsl:param name="varMZOS" select = "'irb_hr______::'"/>
<xsl:param name="varNHMRC" select = "'nhmrc_______::'"/>
<xsl:param name="varNIH" select = "'nih_________::'"/>
<xsl:param name="varNSF" select = "'nsf_________::'"/>
<xsl:param name="varNWO" select = "'nwo_________::'"/>
<xsl:param name="varRCUK" select = "'rcuk________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varRIF" select = "'rif_________::'"/>
<xsl:param name="varRSF" select = "'rsf_________::'"/>
<xsl:param name="varSFI" select = "'sfi_________::'"/>
<xsl:param name="varSFRS" select = "'sfrs________::'"/>
<xsl:param name="varSGOV" select = "'sgov________::'"/> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select = "'snsf________::'"/>
<xsl:param name="varTARA" select = "'taraexp_____::'"/> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select = "'tubitakf____::'"/>
<xsl:param name="varUKRI" select = "'ukri________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varWT" select = "'wt__________::'"/>
<xsl:param name="index" select="0" />
<xsl:param name="transDate" select="current-dateTime()" />
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)" />
<xsl:template match="/">
<xsl:call-template name="validRecord" />
</xsl:template>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template name="validRecord">
<xsl:value-of select="if(string(replace(normalize-space(.), '([0-9]{2})\D([0-9]{2})\D([0-9]{4})', '$3-$1-$2')) castable as xs:date) then normalize-space(.) else ''"></xsl:value-of>
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
@ -85,7 +105,7 @@
<xsl:variable name="varEmbargoEndDate" select="dateCleaner:dateISO( normalize-space(//*[local-name()='date'][@dateType='Available']))" />
<xsl:choose>
<xsl:when test="string-length($varEmbargoEndDate) &gt; 0">
<xsl:when test="string-length($varEmbargoEndDate) > 0">
<oaf:embargoenddate>
<xsl:value-of select="$varEmbargoEndDate" />
</oaf:embargoenddate>
@ -158,6 +178,10 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="not($theDate castable as xs:date))">
<xsl:call-template name="terminate" />
</xsl:if>
<xsl:value-of select="dateCleaner:dateISO( normalize-space($theDate) )" />
</oaf:dateAccepted>
<xsl:choose>

@ -0,0 +1,811 @@
<!-- adaptation 2021-08-23 ; ACz/UNIBI -->
<xsl:stylesheet version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dateCleaner="http://eu/dnetlib/transform/dateISO"
xmlns:vocabulary="http://eu/dnetlib/transform/clean"
exclude-result-prefixes="xsl vocabulary dateCleaner">
<xsl:param name="varOfficialName" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varAKA" select = "'aka_________::'"/>
<xsl:param name="varARC" select = "'arc_________::'"/>
<xsl:param name="varANR" select = "'anr_________::'"/>
<xsl:param name="varCHISTERA" select = "'chistera____::'"/>
<xsl:param name="varCONICYT" select = "'conicytf____::'"/>
<xsl:param name="varDFG" select = "'dfgf________::'"/>
<xsl:param name="varEUENVAGENCY" select = "'euenvagency_::'"/>
<xsl:param name="varFCT" select = "'fct_________::'"/>
<xsl:param name="varFP7" select = "'corda_______::'"/>
<xsl:param name="varFWF" select = "'fwf_________::'"/>
<xsl:param name="varGSRI" select = "'gsri________::'"/>
<xsl:param name="varGSRT" select = "'gsrt________::'"/>
<xsl:param name="varH2020" select = "'corda__h2020::'"/>
<xsl:param name="varHRZZ" select = "'irb_hr______::'"/> <!-- HRZZ not found -->
<xsl:param name="varINNOVIRIS" select = "'innoviris___::'"/>
<xsl:param name="varMESTD" select = "'mestd_______::'"/>
<xsl:param name="varMIUR" select = "'miur________::'"/>
<xsl:param name="varMZOS" select = "'irb_hr______::'"/>
<xsl:param name="varNHMRC" select = "'nhmrc_______::'"/>
<xsl:param name="varNIH" select = "'nih_________::'"/>
<xsl:param name="varNSF" select = "'nsf_________::'"/>
<xsl:param name="varNWO" select = "'nwo_________::'"/>
<xsl:param name="varRCUK" select = "'rcuk________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varRIF" select = "'rif_________::'"/>
<xsl:param name="varRSF" select = "'rsf_________::'"/>
<xsl:param name="varSFI" select = "'sfi_________::'"/>
<xsl:param name="varSFRS" select = "'sfrs________::'"/>
<xsl:param name="varSGOV" select = "'sgov________::'"/> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select = "'snsf________::'"/>
<xsl:param name="varTARA" select = "'taraexp_____::'"/> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select = "'tubitakf____::'"/>
<xsl:param name="varUKRI" select = "'ukri________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varWT" select = "'wt__________::'"/>
<xsl:param name="index" select = "0"/>
<xsl:param name="transDate" select = "current-dateTime()"/>
<xsl:template match="/">
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)" />
<xsl:if test="//oai:header/@status='deleted'">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:call-template name="validRecord" />
</xsl:template>
<!--
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
-->
<xsl:template name="validRecord">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<!-- ~~~~~ pre-detect resourceType, superType and store in variable ~~~~~ -->
<!-- optimize resourceType, superType in case of several statements (e.g. FU Berlin unfortunately contains record with several) -->
<!--
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, distinct-values(//*[local-name()='resourceType'][1]/@uri), 'TextTypologies')" />
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
-->
<xsl:variable name="varTypLst" select="distinct-values((//*[local-name()='resourceType']/(., @*)))"/>
<xsl:variable name="varCobjCatLst" select="distinct-values((for $i in $varTypLst return vocabulary:clean( normalize-space($i), 'dnet:publication_resource')))"/>
<xsl:variable name="varCobjSupLst" select="for $i in $varCobjCatLst return concat($i, '###', vocabulary:clean( normalize-space($i), 'dnet:result_typologies'))"/>
<xsl:variable name="varCobjSup" select="(
$varCobjSupLst[not(substring-after(., '###') = 'other') and not(substring-before(., '###') = ('0038', '0039', '0040'))][1],
$varCobjSupLst[not(substring-after(., '###') = 'other')][1],
$varCobjSupLst[not(substring-before(., '###') = ('0020', '0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
'0000')[1]"/>
<xsl:variable name="varSuperType" select="substring-after($varCobjSup, '###')"/>
<xsl:variable name="varCobjCategory" select="substring-before($varCobjSup, '###')"/>
<!-- ~~~~~ pre-detect, -clean, -deduplicat PIDs and store in variable ~~~~~ -->
<xsl:variable name="varKnownFileEndings" select="('.bmp', '.doc', '.docx', '.epub', '.flv', '.jpeg', '.jpg', '.m4v', '.mp4', '.mpg', '.odp', '.pdf', '.png', '.ppt', '.tiv', '.txt', '.xls', '.xlsx', '.zip')" />
<!-- landingPage URL -->
<!-- either generate landing pages (as often not given), or compare URL with baseURL -->
<!--
// covered in comparison: URL encoded baseURLs, item URL und baseURL differing only in prefix www. or postfix port
// not covered in comparison: URL encoded item URL, URLs being a substring of URLs (like item URL http://def.br/... and baseURL http://abcdef.br/...), ports when only in baseURL or only in item URL
// tries to not consider higher level URLs as item URLs (e.g. journal URLs) by enforcing something after /
-->
<xsl:variable name="varOrigBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varAggrBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and (./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varLandingPage" select="(
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//oaf:datasourceprefix[. = 'od_______268']/concat('https://qspace.library.queensu.ca/handle/', substring-after(//dri:recordIdentifier, 'oai:qspace.library.queensu.ca:')),
//oaf:datasourceprefix[. = 'od_______307']/concat('http://repositorium.sdum.uminho.pt/handle/', substring-after(//dri:recordIdentifier, 'oai:repositorium.sdum.uminho.pt:')),
//oaf:datasourceprefix[. = 'od_______317']/concat('https://papyrus.bib.umontreal.ca/xmlui/handle/', substring-after(//dri:recordIdentifier, 'oai:papyrus.bib.umontreal.ca:')),
//oaf:datasourceprefix[. = 'od______1318']/concat('https://orbi.uliege.be/handle/', substring-after(//dri:recordIdentifier, 'oai:orbi.ulg.ac.be:')),
//oaf:datasourceprefix[. = 'od______1388']/concat('http://rabida.uhu.es/dspace/handle/', substring-after(//dri:recordIdentifier, 'oai:rabida.uhu.es:')),
//oaf:datasourceprefix[. = 'od______1472']/concat('https://gredos.usal.es/handle/', substring-after(//dri:recordIdentifier, 'oai:gredos.usal.es:')),
//oaf:datasourceprefix[. = 'od______1560']/concat('https://riunet.upv.es/handle/', substring-after(//dri:recordIdentifier, 'oai:riunet.upv.es:')),
//oaf:datasourceprefix[. = 'od______3158']/concat('https://open.uct.ac.za/handle/', substring-after(//dri:recordIdentifier, 'oai:localhost:')),
//oaf:datasourceprefix[. = 'od______4225']/concat('https://repository.rothamsted.ac.uk/item/', substring-after(//dri:recordIdentifier, 'oai:repository.rothamsted.ac.uk:')),
//oaf:datasourceprefix[. = 'od______9626']/(//datacite:identifier)[@identifierType='Handle'][not(contains(., '/handle/123456789/'))],
//oaf:datasourceprefix[not(. = ('od_______268', 'od_______307', 'od______1318', 'od______1388', 'od______1472', 'od______4225'))]/(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*) = ('url', 'uri')][not(contains(., 'doi.org/')) and not(contains(., '/doi/')) and not(contains(., '/pmc/'))][starts-with(., 'http')]
)[1]"/>
<!-- IDs (identifier and alternateIdentifier, not relatedIdentifier) -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'doi.org/10.')]/lower-case(substring-after(., 'doi.org/')),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:doi:')]/substring-after(., 'info:doi:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='doi'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/lower-case(.),
(//datacite:identifier, //datacite:alternateIdentifier)[matches(., '.*/doi/.*/10\..*')]/replace(., '.*/doi/.*/(10\..*)$', '$1')
)), ' DOI:::'))"/>
<xsl:variable name="varPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'hdl.handle.net/')][not(contains(., '123456789'))]/substring-after(., 'hdl.handle.net/'),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:hdl:')][not(contains(., '123456789'))]/substring-after(., 'info:hdl:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='handle'][not(starts-with(., 'http')) and not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:')) and not(contains(., '/handle/123456789/'))]
)), ' Handle:::'))"/>
<xsl:variable name="varPidUrn" select="concat(' URN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'urn:nbn:')]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:')),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'http') and (contains(lower-case(.), '://nbn-resolving.org/urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn/resolver.pl?urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn:nbn:') or contains(lower-case(.), '://resolver.obvsg.at/urn:nbn:') or contains(lower-case(.), '://urn.fi/urn:nbn:') or contains(lower-case(.), '://urn.kb.se/resolve?urn=urn:nbn:'))]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:'))
)), ' URN:::'))"/>
<xsl:variable name="varPidArk" select="concat(' ARK:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '/ark:/')]/concat('ark:/', substring-after(., '/ark:/'))
)), ' ARK:::'))"/>
<xsl:variable name="varPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'info:pmid/')]/substring-after(., 'info:pmid/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmid:') or starts-with(lower-case(.), 'pubmed:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))][not(contains(., ':'))],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmid'][not(contains(., ':'))]
)), ' PMID:::'))"/>
<xsl:variable name="varPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(lower-case(.), '://www.ncbi.nlm.nih.gov/pmc/articles/pmc') or contains(lower-case(.), '://europepmc.org/articles/pmc'))]/substring-after(., '/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmcid:') or starts-with(lower-case(.), 'pmc:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmcid']
)), ' PMCID:::'))"/>
<xsl:variable name="varPidHal" select="concat(' HAL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='hal' and (starts-with(., 'hal-') or starts-with(., 'halshs-') or starts-with(., 'halsde-'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(., '://hal.archives-ouvertes.fr/hal') or contains(., '://hal.inria.fr/hal') or contains(., '://halshs.archives-ouvertes.fr/hal') or contains(., '://halsde.archives-ouvertes.fr/hal'))]/substring-after(., '.fr/')
)), ' HAL:::'))"/>
<xsl:variable name="varPidBibc" select="concat(' BIBC:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'bibcode:')]/substring-after(lower-case(.), 'bibcode:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(lower-case(.), 'bibcode=')]/substring(substring-after(lower-case(.), 'bibcode='), 1, 19)
)), ' BIBC:::'))"/>
<xsl:variable name="varPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'arxiv:')]/substring-after(lower-case(.), 'arxiv:'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/abs/')]/substring-after(., '://arxiv.org/abs/'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/pdf/')]/substring-before(substring-after(lower-case(.), '://arxiv.org/pdf/'), '.pdf'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='arxiv']
)), ' arXiv:::'))"/>
<xsl:variable name="varPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos:') and not(starts-with(lower-case(.), 'wos: wos:'))]/substring-after(lower-case(.), 'wos:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos: wos:')]/substring-after(lower-case(.), 'wos: wos:')
)), ' WOS:::'))"/>
<xsl:variable name="varPidScp" select="concat(' SCP:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'scopus_id:') or starts-with(lower-case(.), 'scopus:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'scopus: eid=')]/substring-after(., 'eid=2-s2.0-'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'scp=')]/substring-after(., 'scp='),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'eid=2-s2.0-')]/substring-after(., 'eid=2-s2.0-')
)), ' SCP:::'))"/>
<xsl:variable name="varPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
[not(. = $varLandingPage)]
)), ' URL:::'))"/>
<xsl:variable name="varPidIsbn" select="concat(' ISBN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and not(contains(., ':')) and not($varCobjCategory = '0013')],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and starts-with(lower-case(.), 'urn:isbn') and not($varCobjCategory = '0013')]/substring-after(lower-case(.), 'urn:isbn:')
)), ' ISBN:::'))"/>
<xsl:variable name="varPidIssn" select="string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)=('issn', 'pissn', 'eissn', 'lissn') and matches(., '.*\d{4}[\s-]?\d{3}[\dXx].*') and not($varCobjCategory = '0001')]/concat(' ', upper-case((@identifierType, @alternateIdentifierType)), ':::', replace(., '^.*(\d{4})[\s-]?(\d{3}[\dXx]).*$', '$1-$2'))
)), '')"/>
<!-- heap all IDs, drop landingPage URL -->
<xsl:variable name="varPidPre" select="concat($varPidDoi[not(. = ' DOI:::')], $varPidHandle[not(. = ' Handle:::')], $varPidUrn[not(. = ' URN:::')], $varPidArk[not(. = ' ARK:::')], $varPidPmid[not(. = ' PMID:::')], $varPidPmcid[not(. = ' PMCID:::')], $varPidHal[not(. = ' HAL:::')], $varPidBibc[not(. = ' BIBC:::')], $varPidArxiv[not(. = ' arXiv:::')], $varPidWos[not(. = ' WOS:::')], $varPidScp[not(. = ' SCP:::')], $varPidUrl[not(. = ' URL:::')], $varPidIsbn[not(. = ' ISBN:::')], $varPidIssn[not(. = ' ISSN:::')])"/>
<!--
<xsl:variable name="varPid" select="concat($varPidPre, $varLandingPage[string-length($varPidPre) = 0]/concat('landingPage:::', .))"/>
<xsl:variable name="varPid" select="concat($varPidPre, concat(' landingPage:::', $varLandingPage[string-length($varPidPre) = 0], .))"/>
-->
<xsl:variable name="varPid" select="concat($varPidPre, //oaf:datasourceprefix[string-length($varPidPre) = 0]/concat(' landingPage:::', $varLandingPage))"/>
<!-- relatedIdentifier -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varRelPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'doi.org/10.')]/concat(lower-case(substring-after(., 'doi.org/')), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:doi:')]/concat(substring-after(., 'info:doi:'), ':::', @relationType),
(//datacite:relatedIdentifier)[@relatedIdentifierType='DOI'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/concat(lower-case(.), ':::', @relationType),
(//datacite:relatedIdentifier)[matches(., '.*/doi/.*/10\..*')]/concat(replace(., '.*/doi/.*/(10\..*)$', '$1'), ':::', @relationType)
)), ' DOI:::'))"/>
<xsl:variable name="varRelPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'hdl.handle.net/')]/concat(substring-after(., 'hdl.handle.net/'), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:hdl:')]/concat(substring-after(., 'info:hdl:'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@relatedIdentifierType)='handle'][not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]/concat(., ':::', @relationType)
)), ' Handle:::'))"/>
<xsl:variable name="varRelPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/concat(substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))]/concat(., ':::', @relationType)
)), ' PMID:::'))"/>
<xsl:variable name="varRelPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='pmcid']
/concat(., ':::', @relationType)
)), ' PMCID:::'))"/>
<xsl:variable name="varRelPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='arxiv']
/concat(., ':::', @relationType)
)), ' arXiv:::'))"/>
<xsl:variable name="varRelPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))]/concat(., ':::', @relationType),
(//datacite:relatedIdentifier)[starts-with(lower-case(.), 'wos:')]/concat(substring-after(lower-case(.), 'wos:'), ':::', @relationType)
)), ' WOS:::'))"/>
<xsl:variable name="varRelPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
/concat(., ':::', @relationType)
)), ' URL:::'))"/>
<xsl:variable name="varRelPid" select="concat($varRelPidDoi[not(. = ' DOI:::')], $varRelPidHandle[not(. = ' Handle:::')], $varRelPidPmid[not(. = ' PMID:::')], $varRelPidPmcid[not(. = ' PMCID:::')], $varRelPidArxiv[not(. = ' arXiv:::')], $varRelPidWos[not(. = ' WOS:::')], $varRelPidUrl[not(. = ' URL:::')])"/>
<!-- container PIDs -->
<!-- TODO -->
<!-- drop oaire resource -->
<!-- <oaire:resource xmlns="http://namespace.openaire.eu/schema/oaire/"> -->
<datacite:resource>
<!-- ~~~~~ IDs ~~~~~ -->
<!-- choose 'best' PID among identifiers and alternateIdentifers, and cut off DOI resolver prefix to just get the number part -->
<datacite:identifier>
<xsl:attribute name="identifierType" select="substring-before(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
<xsl:value-of select="substring-after(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
</datacite:identifier>
<datacite:alternateIdentifiers>
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[position() > 1][string-length(substring-after(., ':::')) > 0]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="substring-before(., ':::')"/>
<xsl:value-of select="substring-after(., ':::')" />
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:for-each select="(//datacite:alternateIdentifier, //datacite:identifier)
[not($varCobjCategory = '0001' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))]
[not($varCobjCategory = '0013' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = 'isbn')]
[not(ends-with(., 'pdf'))]
[not(@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('doi', 'handle', 'urn', 'pmid', 'pmcid', 'arxiv', 'wos', 'url', 'isbn', 'issn', 'eissn', 'lissn', 'pissn'))]
[not(. = $varLandingPage)]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="./@*[local-name()=('identifierType', 'alternateIdentifierType')]"/>
<xsl:value-of select="."/>
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</datacite:alternateIdentifier>
</xsl:if>
</datacite:alternateIdentifiers>
<datacite:relatedIdentifiers>
<xsl:for-each select="(//datacite:relatedIdentifier)
[not(@relatedIdentifierType/lower-case(.) = ('doi', 'handle', 'pmid', 'pmcid', 'wos', 'url'))]
[not(starts-with(lower-case(.), 'wos:') or contains(., 'hdl.handle.net/') or contains(., 'doi.org/10.'))]
[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn', 'isbn') and @relationType/lower-case(.) = 'ispartof')]">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="./@relatedIdentifierType"/>
<xsl:attribute name="relationType" select="./@relationType"/>
<xsl:value-of select=".[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))],
.[@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn')]/concat(substring(., 1, 4), '-', substring(., string-length(.)-3, 4))"/>
</datacite:relatedIdentifier>
</xsl:for-each>
</datacite:relatedIdentifiers>
<!-- change namespace/format from oaire to datacite for description, language, rights, ... -->
<xsl:for-each select="//oaire:resourceType">
<datacite:resourceType>
<xsl:attribute name="xs:anyURI" select="@uri"/>
<xsl:value-of select="."/>
</datacite:resourceType>
</xsl:for-each>
<xsl:for-each select="distinct-values(//oaire:version)">
<datacite:version>
<xsl:value-of select="."/>
</datacite:version>
</xsl:for-each>
<xsl:if test="(//datacite:rights, //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rightsList>
<xsl:for-each select="(//datacite:rights | //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rights>
<xsl:attribute name="rightsURI" select="(@rightsURI, @uri)[1]"/>
<xsl:value-of select="."/>
</datacite:rights>
</xsl:for-each>
</datacite:rightsList>
</xsl:if>
<xsl:if test="//datacite:title">
<datacite:titles>
<xsl:for-each select="//datacite:title">
<datacite:title>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:title>
</xsl:for-each>
</datacite:titles>
</xsl:if>
<xsl:if test="//dc:description">
<datacite:descriptions>
<xsl:for-each select="//dc:description">
<datacite:description>
<xsl:attribute name="descriptionType" select="'Abstract'"/>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:description>
</xsl:for-each>
</datacite:descriptions>
</xsl:if>
<xsl:for-each select="distinct-values(//dc:language)[string-length(normalize-space(.)) > 0]">
<datacite:language>
<xsl:value-of select="normalize-space(.)"/>
</datacite:language>
</xsl:for-each>
<xsl:for-each select="distinct-values(//dc:publisher)[string-length(normalize-space(.)) > 0]">
<datacite:publisher>
<xsl:value-of select="normalize-space(.)"/>
</datacite:publisher>
</xsl:for-each>
<xsl:if test="//dc:format[string-length(normalize-space(.)) > 0]">
<datacite:formats>
<xsl:for-each select="distinct-values(//dc:format)[string-length(normalize-space(.)) > 0]">
<datacite:format>
<xsl:value-of select="normalize-space(.)"/>
</datacite:format>
</xsl:for-each>
</datacite:formats>
</xsl:if>
<xsl:if test="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReferences>
<xsl:for-each select="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReference>
<datacite:funderName>
<xsl:value-of select="./oaire:funderName"/>
</datacite:funderName>
<datacite:funderIdentifier>
<xsl:attribute name="funderIdentifierType" select="'Crossref Funder ID'"/>
<xsl:value-of select="./oaire:funderIdentifier"/>
</datacite:funderIdentifier>
<datacite:awardNumber>
<xsl:value-of select="./oaire:awardNumber"/>
</datacite:awardNumber>
<!--<xsl:value-of select="."/>-->
</datacite:fundingReference>
</xsl:for-each>
</datacite:fundingReferences>
</xsl:if>
<xsl:apply-templates select="(//*[local-name()='resource'], //*[local-name() = 'oai_openaire'])/*[not(local-name() = ('identifier', 'alternateIdentifiers', 'alternateIdentifier', 'relatedIdentifiers', 'relatedIdentifier', 'description', 'titles', 'title', 'language', 'publisher', 'resourceType', 'version', 'fundingReferences', 'fundingReference', 'rights', 'licenseCondition', 'file', 'format', 'audience', 'source', 'coverage'))][not(starts-with(local-name(), 'citation'))]"/>
<!-- </oaire:resource> -->
</datacite:resource>
<!-- ~~~~~ put oaf elements below datacite:resource ~~~~~ -->
<!-- oaf:identifier -->
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[string-length(substring-after(normalize-space(.), ':::')) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="substring-before(normalize-space(.), ':::')"/>
<xsl:value-of select="substring-after(normalize-space(.), ':::')"/>
</oaf:identifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</oaf:identifier>
</xsl:if>
<xsl:if test="//*[local-name() = 'about']/*[local-name() = 'provenance']/*[local-name() = 'originDescription']/*[local-name() = 'originDescription']/*[local-name() = 'identifier' and string-length(.) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'oai-original'"/>
<xsl:value-of select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'identifier']"/>
</oaf:identifier>
</xsl:if>
<xsl:variable name='varEmbargoEndDate' select="dateCleaner:dateISO(normalize-space(//*[local-name()='date'][@dateType='Available']))"/>
<!-- resourceType, superType -->
<xsl:choose>
<xsl:when test="lower-case(//*[local-name()='resourceType']/@resourceTypeGeneral) = ('dataset', 'software', 'literature', 'publication', 'other research product') or not(//*[local-name()='resourceType']/@resourceTypeGeneral)">
<dr:CobjCategory>
<xsl:variable name="varCobjCategory" select="vocabulary:clean( //*[local-name()='resourceType']/@resourceTypeGeneral, 'dnet:publication_resource')"/>
<xsl:variable name="varSuperType" select="vocabulary:clean( $varCobjCategory, 'dnet:result_typologies')"/>
<xsl:attribute name="type">
<xsl:value-of select="$varSuperType"/>
</xsl:attribute>
<xsl:value-of select="$varCobjCategory"/>
</dr:CobjCategory>
<!-- <dr:CobjCategory>
<xsl:attribute name="type" select="//oaf:datasourceprefix[. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/')]/'other', //oaf:datasourceprefix[not(. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/'))]/$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
-->
</xsl:when>
<!-- drop journals -->
<!--
<xsl:when test="lower-case(//*[local-name()='resourceType']/@uri) = 'http://purl.org/coar/resource_type/c_0640'">
<xsl:call-template name="terminate"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="terminate"/>
</xsl:otherwise>
-->
</xsl:choose>
<!-- review status -->
<xsl:variable name="varRefereedConvt" select="for $i in (
//*[local-name()='resourceType']/(., @uri), //oai:setSpec, //*[local-name()='description'])
return vocabulary:clean( normalize-space($i), 'dnet:review_levels')"/>
<xsl:variable name="varRefereedIdntf" select="(
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])pre[\.\-_\\/\s\(\)%\d#:]?prints?([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0002',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])refereed([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0001',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '.*-peer-reviewed-(fulltext-)?article-.*')]/'0001')"/>
<xsl:variable name="varRefereedSourc" select="(//*[local-name()=('publisher', 'source', 'citationTitle')][matches(lower-case(.), '.*[\s\-\.\\_/:%]pre[\s\-\.\\_/:%]?prints?([\s\-\.\\_/:%].*|$)')]/'0002')"/>
<xsl:variable name="varRefereedReltn" select="//*[local-name() = 'relatedIdentifier'][./@relationType/lower-case(.)='isreviewedby']/'0001'"/>
<xsl:variable name="varRefereedDesct" select="(//*[local-name() = 'description']
[matches(lower-case(.), '.*(this\s*book|this\s*volume|it)\s*(constitutes|presents)\s*the\s*(thoroughly\s*)?refereed') or
matches(lower-case(.), '.*peer[\.\-_/\s\(\)]?review\s*under\s*responsibility\s*of.*') or
matches(lower-case(.), '(this|a)\s*(article|preprint)\s*(has\s*been\s*)?(peer[\-\s]*)?reviewed\s*and\s*recommended\s*by\s*peer[\-\s]*community')]/'0001')"/>
<xsl:variable name="varRefereedTitle" select="(//*[local-name()=('title')][matches(lower-case(.), '.*\[.*peer[\s\-\._]*review\s*:.*\]\s*$')]/'0001')"/>
<xsl:variable name="varRefereedVersn" select="vocabulary:clean( normalize-space( //*[local-name()='version']), 'dnet:review_levels')"/>
<xsl:variable name="varRefereed" select="($varRefereedConvt, $varRefereedIdntf, $varRefereedSourc, $varRefereedReltn, $varRefereedDesct, $varRefereedTitle, $varRefereedVersn)"/>
<xsl:choose>
<xsl:when test="count($varRefereed[. = '0001']) > 0">
<oaf:refereed>
<xsl:value-of select="'0001'"/>
</oaf:refereed>
</xsl:when>
<xsl:when test="count($varRefereed[. = '0002']) > 0">
<oaf:refereed>
<xsl:value-of select="'0002'"/>
</oaf:refereed>
</xsl:when>
</xsl:choose>
<oaf:dateAccepted>
<xsl:value-of
select="dateCleaner:dateISO( normalize-space(//datacite:date[@dateType = 'Issued']))"/>
</oaf:dateAccepted>
<!--
<oaf:accessrights>
<xsl:variable name='varAccessRights' select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')" />
</oaf:accessrights>
<xsl:choose>
<xsl:when test="not($varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())))">
<xsl:value-of select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')"/>
</xsl:when>
<xsl:when test="$varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
</xsl:choose>
-->
<xsl:variable name='varAccessRights' select="string-join((for $i in ((//*[local-name() = 'rights'], //*[lower-case(local-name())='licensecondition'])/(@*, .)) return vocabulary:clean( $i, 'dnet:access_modes')), ' ')" />
<oaf:accessrights>
<xsl:choose>
<xsl:when test="contains($varAccessRights, 'OPEN SOURCE')">
<xsl:value-of select="'OPEN SOURCE'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'OPEN')">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and (xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())">
<xsl:value-of select="'EMBARGO'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'RESTRICTED')">
<xsl:value-of select="'RESTRICTED'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'CLOSED')">
<xsl:value-of select="'CLOSED'"/>
</xsl:when>
</xsl:choose>
</oaf:accessrights>
<xsl:for-each select="//*[local-name()='licenseCondition']
[string-length(.) > 0 or string-length(@uri) > 0]
[(starts-with(@uri, 'http') and (contains(@uri, '://creativecommons.org/licenses/') or contains(@uri, '://creativecommons.org/publicdomain/') or contains(@uri, '://opensource.org/licenses/') or contains(@uri, '://opendatacommons.org/licenses/') or contains(@uri, '://rightsstatements.org/page/') or contains(@uri, '://rightsstatements.org/vocab/') or contains(@uri, '://www.opendefinition.org/licenses/') or contains(@uri, '://www.gnu.org/licenses/') or contains(@uri, '://artlibre.org/licence/') or contains(@uri, '://repositorio.uca.edu.sv/jspui/licencias/') or contains(@uri, '://bibliotecavirtual.unl.edu.ar/licencia/'))) or matches(., '^CC[- ]BY([- ](NC([- ](ND|SA))?|ND|SA))([- ]\d(\.\d)?)?$', 'i')]">
<oaf:license>
<xsl:value-of select=".[not(./@uri)], .[./@uri]/@uri"/>
</oaf:license>
</xsl:for-each>
<oaf:language>
<xsl:value-of select="vocabulary:clean( //*[local-name()='language'], 'dnet:languages')" />
</oaf:language>
<xsl:call-template name="funding" />
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
<!-- oaf:container -->
<!-- TODO: set @typ -->
<!--
<xsl:variable name="varCitation" select="//*[starts-with(local-name(), 'citation')]" />
<xsl:variable name="varSource" select="//dc:source[//oaf:datasourceprefix[.=('od______1514', 'od______3158')]]" />
-->
<!-- test
<xsl:if test="contains($varContainerPid, ':::')">
<oaf:container>
<xsl:for-each select="tokenize(normalize-space($varContainerPid), ' ')">
<xsl:attribute name="{lower-case(substring-before(., ':::'))}" select="substring-before(substring-after(., ':::'), ':::')"/>
<xsl:attribute name="typ" select="substring-after(substring-after(., ':::'), ':::')"/>
</xsl:for-each>
<xsl:choose>
<xsl:when test="lower-case(substring-before(., ':::')) = ('issn', 'pissn', 'eissn', 'lissn')">
<xsl:attribute name="vol" select="$varCitation[local-name(.) = 'citationVolume']"/>
<xsl:attribute name="iss" select="$varCitation[local-name(.) = 'citationIssue']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
<xsl:when test="lower-case(substring-before(., ':::')) = 'isbn'">
<xsl:attribute name="edt" select="$varCitation[local-name(.) = 'citationEdition']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$varCitation[local-name(.) = 'citationTitle'], $varSource" />
</oaf:container>
</xsl:if>
test -->
<!-- Huelva marks L, E ISSNs as ISSNs, with mark within field in spaces or after blanc -->
<!-- Qeios declares many records as text, although many seem to be definitions which are also related to 'journal' volumes/issues -->
<!-- oaf:fulltext-->
<!-- toDo: clarify if fulltext should be filled when URL given and rights oa -->
<!--
<xsl:if test="//*[local-name() = 'file']">
<oaf:fulltext>
<xsl:value-of select="//*[local-name() = 'file']"/>
</oaf:fulltext>
</xsl:if>
-->
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template name="funding">
<!-- funding -->
<xsl:for-each select="//*[local-name()='fundingReference'][./*[local-name()='awardNumber']]">
<xsl:choose>
<!-- FP7 -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004963|10.13039/100011199|10.13039/100011102)\s*$')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- H2020 (Horizon 2020 Framework Programme) -->
<!-- -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100010661)\s*')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- AKA -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002341)\s*$') ]
or ./*[local-name()='funderName'][contains(., 'Suomen Akatemia') or contains(., 'Academy of Finland')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- ARC -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000923)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Australian Research Council')])
and ./*[local-name()='awardNumber'][matches(., '^\d{6}$')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, replace(./*[local-name()='awardNumber'], '.*(^\d{6}$).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- CONICYT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002848)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Comisión Nacional de Investigación Científica y Tecnológica') or contains(., 'CONICYT')]">
<oaf:projectid>
<xsl:value-of select="concat($varCONICYT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- DFG -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001659)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Deutsche Forschungsgemeinschaft') or contains(., 'DFG') or contains(., 'Deutsche Forschungsgemeinschaft (DFG)')]">
<oaf:projectid>
<xsl:value-of select="concat($varDFG, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!---->
<!-- FCT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fundação para a Ciência e a Tecnologia')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- FWF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002428)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fonds zur Förderung der Wissenschaftlichen Forschung') or contains(., 'Austrian Science Fund')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MESTD -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][(contains(., 'Ministarstvo Prosvete, Nauke i Tehnolo') and contains(., 'kog Razvoja')) or contains(., 'MESTD')]">
<oaf:projectid>
<xsl:value-of select="concat($varMESTD, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MZOS -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100006588)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Ministarstvo Znanosti, Obrazovanja i Sporta') or contains(., 'Ministry of Science, Education and Sports')]">
<oaf:projectid>
<xsl:value-of select="concat($varMZOS, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NHMRC -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000925)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Health and Medical Research Council') or contains(., 'NHMRC')]">
<oaf:projectid>
<xsl:value-of select="concat($varNHMRC, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NIH -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000002)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Institutes of Health')]">
<oaf:projectid>
<xsl:value-of select="concat($varNIH, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000001)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Science Foundation')]">
<oaf:projectid>
<xsl:value-of select="concat($varNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NWO -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100003246)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Netherlands Organisation for Scientific Research') or contains(., 'Nederlandse Organisatie voor Wetenschappelijk Onderzoek')]">
<oaf:projectid>
<xsl:value-of select="concat($varNWO, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- RCUK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000690)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Research Councils UK') or contains(., 'RCUK')]">
<oaf:projectid>
<xsl:value-of select="concat($varRCUK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- SFI -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001602)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Science Foundation Ireland')])
and ./*[local-name()='awardNumber'][matches(., '.*([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+.*')]">
<oaf:projectid>
<xsl:value-of select="concat($varSFI, replace(./*[local-name()='awardNumber'], '.*(^|\s)(([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+)($|\s).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- SNSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001711)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Swiss National Science Foundation') or contains(., 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung')]">
<oaf:projectid>
<xsl:value-of select="concat($varSNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- TUBITAK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004410)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Turkish National Science and Research Council') or (contains(., 'Türkiye Bilimsel ve Teknolojik Ara') and contains(., 'rma Kurumu'))]">
<oaf:projectid>
<xsl:value-of select="concat($varTUBITAK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- WT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100004440)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Wellcome Trust') or . = 'WT']">
<oaf:projectid>
<xsl:value-of select="concat($varWT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- toDo: improve by selecting all attributes -->
<xsl:template match="//*[local-name()='nameIdentifier']">
<datacite:nameIdentifier>
<xsl:attribute name="nameIdentifierScheme" select="./@*[local-name()=('nameIdentifierScheme')]"/>
<xsl:attribute name="schemeURI" select="./@*[local-name()=('schemeURI')]"/>
<xsl:choose>
<xsl:when test=".[contains(., 'orcid.org/')]">
<xsl:value-of select="substring-after(., 'orcid.org/')" />
</xsl:when>
<xsl:when test=".[contains(., 'researcherid.com/rid/')]">
<xsl:value-of select="substring-after(., 'researcherid.com/rid/')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</datacite:nameIdentifier>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<header xmlns="http://www.openarchives.org/OAI/2.0/">
<!--
<xsl:copy copy-namespaces="no">
-->
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
<!--
</xsl:copy>
-->
</header>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,848 @@
<!-- adaptation 2021-08-23 -->
<xsl:stylesheet version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dateCleaner="http://eu/dnetlib/transform/dateISO"
xmlns:vocabulary="http://eu/dnetlib/transform/clean"
exclude-result-prefixes="xsl vocabulary dateCleaner">
<xsl:param name="varOfficialName" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varAKA" select = "'aka_________::'"/>
<xsl:param name="varARC" select = "'arc_________::'"/>
<xsl:param name="varANR" select = "'anr_________::'"/>
<xsl:param name="varCHISTERA" select = "'chistera____::'"/>
<xsl:param name="varCONICYT" select = "'conicytf____::'"/>
<xsl:param name="varDFG" select = "'dfgf________::'"/>
<xsl:param name="varEUENVAGENCY" select = "'euenvagency_::'"/>
<xsl:param name="varFCT" select = "'fct_________::'"/>
<xsl:param name="varFP7" select = "'corda_______::'"/>
<xsl:param name="varFWF" select = "'fwf_________::'"/>
<xsl:param name="varGSRI" select = "'gsri________::'"/>
<xsl:param name="varGSRT" select = "'gsrt________::'"/>
<xsl:param name="varH2020" select = "'corda__h2020::'"/>
<xsl:param name="varHRZZ" select = "'irb_hr______::'"/> <!-- HRZZ not found -->
<xsl:param name="varINNOVIRIS" select = "'innoviris___::'"/>
<xsl:param name="varMESTD" select = "'mestd_______::'"/>
<xsl:param name="varMIUR" select = "'miur________::'"/>
<xsl:param name="varMZOS" select = "'irb_hr______::'"/>
<xsl:param name="varNHMRC" select = "'nhmrc_______::'"/>
<xsl:param name="varNIH" select = "'nih_________::'"/>
<xsl:param name="varNSF" select = "'nsf_________::'"/>
<xsl:param name="varNWO" select = "'nwo_________::'"/>
<xsl:param name="varRCUK" select = "'rcuk________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varRIF" select = "'rif_________::'"/>
<xsl:param name="varRSF" select = "'rsf_________::'"/>
<xsl:param name="varSFI" select = "'sfi_________::'"/>
<xsl:param name="varSFRS" select = "'sfrs________::'"/>
<xsl:param name="varSGOV" select = "'sgov________::'"/> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select = "'snsf________::'"/>
<xsl:param name="varTARA" select = "'taraexp_____::'"/> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select = "'tubitakf____::'"/>
<xsl:param name="varUKRI" select = "'ukri________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varWT" select = "'wt__________::'"/>
<xsl:param name="index" select = "0"/>
<xsl:param name="transDate" select = "current-dateTime()"/>
<xsl:template match="/">
<xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)" />
<xsl:if test="//oai:header/@status='deleted'">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:call-template name="validRecord" />
</xsl:template>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template name="validRecord">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<!-- ~~~~~ pre-detect resourceType, superType and store in variable ~~~~~ -->
<!-- optimize resourceType, superType in case of several statements (e.g. FU Berlin unfortunately contains record with several) -->
<!--
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, distinct-values(//*[local-name()='resourceType'][1]/@uri), 'TextTypologies')" />
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
-->
<xsl:variable name="varTypLst" select="distinct-values((//*[local-name()='resourceType']/(., @*)))"/>
<xsl:variable name="varCobjCatLst" select="distinct-values((for $i in $varTypLst return vocabulary:clean( normalize-space($i), 'dnet:publication_resource')))"/>
<xsl:variable name="varCobjSupLst" select="for $i in $varCobjCatLst return concat($i, '###', vocabulary:clean( normalize-space($i), 'dnet:result_typologies'))"/>
<xsl:variable name="varCobjSup" select="(
$varCobjSupLst[not(substring-after(., '###') = 'other') and not(substring-before(., '###') = ('0038', '0039', '0040'))][1],
$varCobjSupLst[not(substring-after(., '###') = 'other')][1],
$varCobjSupLst[not(substring-before(., '###') = ('0020', '0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
$varCobjSupLst[not(substring-before(., '###') = ('0000'))][1],
'0000')[1]"/>
<xsl:variable name="varSuperType" select="substring-after($varCobjSup, '###')"/>
<xsl:variable name="varCobjCategory" select="substring-before($varCobjSup, '###')"/>
<!-- ~~~~~ pre-detect, -clean, -deduplicat PIDs and store in variable ~~~~~ -->
<xsl:variable name="varKnownFileEndings" select="('.avi', '.bmp', '.doc', '.docx', '.epub', '.flv', '.jpeg', '.jpg', '.m4v', '.mp4', '.mpg', '.odp', '.pdf', '.png', '.ppt', '.tiv', '.txt', '.xls', '.xlsx', '.zip')" />
<!-- landingPage URL -->
<!-- either generate landing pages (as often not given), or compare URL with baseURL -->
<!--
// covered in comparison: URL encoded baseURLs, item URL und baseURL differing only in prefix www. or postfix port
// not covered in comparison: URL encoded item URL, URLs being a substring of URLs (like item URL http://def.br/... and baseURL http://abcdef.br/...), ports when only in baseURL or only in item URL
// tries to not consider higher level URLs as item URLs (e.g. journal URLs) by enforcing something after /
-->
<xsl:variable name="varOrigBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varAggrBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and (./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varLandingPage" select="(
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//datacite:identifier[(contains(substring-after(., '://'), '/') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varAggrBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)],
//oaf:datasourceprefix[. = 'od_______268']/concat('https://qspace.library.queensu.ca/handle/', substring-after(//dri:recordIdentifier, 'oai:qspace.library.queensu.ca:')),
//oaf:datasourceprefix[. = 'od_______307']/concat('http://repositorium.sdum.uminho.pt/handle/', substring-after(//dri:recordIdentifier, 'oai:repositorium.sdum.uminho.pt:')),
//oaf:datasourceprefix[. = 'od_______317']/concat('https://papyrus.bib.umontreal.ca/xmlui/handle/', substring-after(//dri:recordIdentifier, 'oai:papyrus.bib.umontreal.ca:')),
//oaf:datasourceprefix[. = 'od______1318']/concat('https://orbi.uliege.be/handle/', substring-after(//dri:recordIdentifier, 'oai:orbi.ulg.ac.be:')),
//oaf:datasourceprefix[. = 'od______1388']/concat('http://rabida.uhu.es/dspace/handle/', substring-after(//dri:recordIdentifier, 'oai:rabida.uhu.es:')),
//oaf:datasourceprefix[. = 'od______1472']/concat('https://gredos.usal.es/handle/', substring-after(//dri:recordIdentifier, 'oai:gredos.usal.es:')),
//oaf:datasourceprefix[. = 'od______1560']/concat('https://riunet.upv.es/handle/', substring-after(//dri:recordIdentifier, 'oai:riunet.upv.es:')),
//oaf:datasourceprefix[. = 'od______3158']/concat('https://open.uct.ac.za/handle/', substring-after(//dri:recordIdentifier, 'oai:localhost:')),
//oaf:datasourceprefix[. = 'od______4225']/concat('https://repository.rothamsted.ac.uk/item/', substring-after(//dri:recordIdentifier, 'oai:repository.rothamsted.ac.uk:')),
//oaf:datasourceprefix[. = 'od______9626']/(//datacite:identifier)[@identifierType='Handle'][not(contains(., '/handle/123456789/'))],
//oaf:datasourceprefix[not(. = ('od_______268', 'od_______307', 'od______1318', 'od______1388', 'od______1472', 'od______4225'))]/(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*) = ('url', 'uri')][not(contains(., 'doi.org/')) and not(contains(., '/doi/')) and not(contains(., '/pmc/'))][starts-with(., 'http')]
)[1]"/>
<!-- IDs (identifier and alternateIdentifier, not relatedIdentifier) -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'doi.org/10.')]/lower-case(substring-after(., 'doi.org/')),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:doi:')]/substring-after(., 'info:doi:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='doi'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/lower-case(.),
(//datacite:identifier, //datacite:alternateIdentifier)[matches(., '.*/doi/.*/10\..*')]/replace(., '.*/doi/.*/(10\..*)$', '$1')
)), ' DOI:::'))"/>
<xsl:variable name="varPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'hdl.handle.net/')][not(contains(., '123456789'))]/substring-after(., 'hdl.handle.net/'),
(//datacite:identifier, //datacite:alternateIdentifier)[contains(., 'info:hdl:')][not(contains(., '123456789'))]/substring-after(., 'info:hdl:'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='handle'][not(starts-with(., 'http')) and not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:')) and not(contains(., '/handle/123456789/'))]
)), ' Handle:::'))"/>
<xsl:variable name="varPidUrn" select="concat(' URN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'urn:nbn:')]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:')),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'http') and (contains(lower-case(.), '://nbn-resolving.org/urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn/resolver.pl?urn:nbn:') or contains(lower-case(.), '://nbn-resolving.de/urn:nbn:') or contains(lower-case(.), '://resolver.obvsg.at/urn:nbn:') or contains(lower-case(.), '://urn.fi/urn:nbn:') or contains(lower-case(.), '://urn.kb.se/resolve?urn=urn:nbn:'))]/concat('urn:nbn:', substring-after(lower-case(.), 'urn:nbn:'))
)), ' URN:::'))"/>
<xsl:variable name="varPidArk" select="concat(' ARK:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '/ark:/')]/concat('ark:/', substring-after(., '/ark:/'))
)), ' ARK:::'))"/>
<xsl:variable name="varPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'info:pmid/')]/substring-after(., 'info:pmid/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmid:') or starts-with(lower-case(.), 'pubmed:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))][not(contains(., ':'))],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmid'][not(contains(., ':'))]
)), ' PMID:::'))"/>
<xsl:variable name="varPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(lower-case(.), '://www.ncbi.nlm.nih.gov/pmc/articles/pmc') or contains(lower-case(.), '://europepmc.org/articles/pmc'))]/substring-after(., '/articles/'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'pmcid:') or starts-with(lower-case(.), 'pmc:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='pmcid']
)), ' PMCID:::'))"/>
<xsl:variable name="varPidHal" select="concat(' HAL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='hal' and (starts-with(., 'hal-') or starts-with(., 'halshs-') or starts-with(., 'halsde-'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and (contains(., '://hal.archives-ouvertes.fr/hal') or contains(., '://hal.inria.fr/hal') or contains(., '://halshs.archives-ouvertes.fr/hal') or contains(., '://halsde.archives-ouvertes.fr/hal'))]/substring-after(., '.fr/')
)), ' HAL:::'))"/>
<xsl:variable name="varPidBibc" select="concat(' BIBC:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'bibcode:')]/substring-after(lower-case(.), 'bibcode:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(., 'http') and contains(lower-case(.), 'bibcode=')]/substring(substring-after(lower-case(.), 'bibcode='), 1, 19)
)), ' BIBC:::'))"/>
<xsl:variable name="varPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'arxiv:')]/substring-after(lower-case(.), 'arxiv:'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/abs/')]/substring-after(., '://arxiv.org/abs/'),
(//datacite:identifier, //datacite:alternateIdentifier)[(starts-with(., 'http') or starts-with(lower-case(.), 'arxiv: http')) and contains(., '://arxiv.org/pdf/')]/substring-before(substring-after(lower-case(.), '://arxiv.org/pdf/'), '.pdf'),
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='arxiv']
)), ' arXiv:::'))"/>
<xsl:variable name="varPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))],
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos:') and not(starts-with(lower-case(.), 'wos: wos:'))]/substring-after(lower-case(.), 'wos:'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'wos: wos:')]/substring-after(lower-case(.), 'wos: wos:')
)), ' WOS:::'))"/>
<xsl:variable name="varPidScp" select="concat(' SCP:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(lower-case(.), 'scopus_id:') or starts-with(lower-case(.), 'scopus:')]/substring-after(., ':'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'scopus: eid=')]/substring-after(., 'eid=2-s2.0-'),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'scp=')]/substring-after(., 'scp='),
(//datacite:identifier, //datacite:alternateIdentifier)[starts-with(normalize-space(.), 'http') and contains(., '://www.scopus.com/inward/record.ur') and contains(., 'eid=2-s2.0-')]/substring-after(., 'eid=2-s2.0-')
)), ' SCP:::'))"/>
<xsl:variable name="varPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
[not(. = $varLandingPage)]
)), ' URL:::'))"/>
<xsl:variable name="varPidIsbn" select="concat(' ISBN:::', string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and not(contains(., ':')) and not($varCobjCategory = '0013')],
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)='isbn' and starts-with(lower-case(.), 'urn:isbn') and not($varCobjCategory = '0013')]/substring-after(lower-case(.), 'urn:isbn:')
)), ' ISBN:::'))"/>
<xsl:variable name="varPidIssn" select="string-join(distinct-values((
(//datacite:identifier, //datacite:alternateIdentifier)[lower-case(@*)=('issn', 'pissn', 'eissn', 'lissn') and matches(., '.*\d{4}[\s-]?\d{3}[\dXx].*') and not($varCobjCategory = '0001')]/concat(' ', upper-case((@identifierType, @alternateIdentifierType)), ':::', replace(., '^.*(\d{4})[\s-]?(\d{3}[\dXx]).*$', '$1-$2'))
)), '')"/>
<!-- heap all IDs, drop landingPage URL -->
<xsl:variable name="varPidPre" select="concat($varPidDoi[not(. = ' DOI:::')], $varPidHandle[not(. = ' Handle:::')], $varPidUrn[not(. = ' URN:::')], $varPidArk[not(. = ' ARK:::')], $varPidPmid[not(. = ' PMID:::')], $varPidPmcid[not(. = ' PMCID:::')], $varPidHal[not(. = ' HAL:::')], $varPidBibc[not(. = ' BIBC:::')], $varPidArxiv[not(. = ' arXiv:::')], $varPidWos[not(. = ' WOS:::')], $varPidScp[not(. = ' SCP:::')], $varPidUrl[not(. = ' URL:::')], $varPidIsbn[not(. = ' ISBN:::')], $varPidIssn[not(. = ' ISSN:::')])"/>
<!--
<xsl:variable name="varPid" select="concat($varPidPre, $varLandingPage[string-length($varPidPre) = 0]/concat('landingPage:::', .))"/>
<xsl:variable name="varPid" select="concat($varPidPre, concat(' landingPage:::', $varLandingPage[string-length($varPidPre) = 0], .))"/>
-->
<xsl:variable name="varPid" select="concat($varPidPre, //oaf:datasourceprefix[string-length($varPidPre) = 0]/concat(' landingPage:::', $varLandingPage))"/>
<!-- relatedIdentifier -->
<!-- container PIDs (ISSNs, ISBNs) often erroneously stuffed in alternateIdentifier for contained items (journal articles, book chapters, ...), are to be shifted into relatedIdentifier instead -->
<xsl:variable name="varRelPidDoi" select="concat(' DOI:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'doi.org/10.')]/concat(lower-case(substring-after(., 'doi.org/')), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:doi:')]/concat(substring-after(., 'info:doi:'), ':::', @relationType),
(//datacite:relatedIdentifier)[@relatedIdentifierType='DOI'][not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(contains(., '/doi/'))]/concat(lower-case(.), ':::', @relationType),
(//datacite:relatedIdentifier)[matches(., '.*/doi/.*/10\..*')]/concat(replace(., '.*/doi/.*/(10\..*)$', '$1'), ':::', @relationType)
)), ' DOI:::'))"/>
<xsl:variable name="varRelPidHandle" select="concat(' Handle:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., 'hdl.handle.net/')]/concat(substring-after(., 'hdl.handle.net/'), ':::', @relationType),
(//datacite:relatedIdentifier)[contains(., 'info:hdl:')]/concat(substring-after(., 'info:hdl:'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@relatedIdentifierType)='handle'][not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]/concat(., ':::', @relationType)
)), ' Handle:::'))"/>
<xsl:variable name="varRelPidPmid" select="concat(' PMID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/')]/concat(substring-after(., '://www.ncbi.nlm.nih.gov/pmc/articles/'), ':::', @relationType),
(//datacite:relatedIdentifier)[lower-case(@*)='pmc'][not(contains(., 'ncbi.nlm.nih.gov'))]/concat(., ':::', @relationType)
)), ' PMID:::'))"/>
<xsl:variable name="varRelPidPmcid" select="concat(' PMCID:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='pmcid']
/concat(., ':::', @relationType)
)), ' PMCID:::'))"/>
<xsl:variable name="varRelPidArxiv" select="concat(' arXiv:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='arxiv']
/concat(., ':::', @relationType)
)), ' arXiv:::'))"/>
<xsl:variable name="varRelPidWos" select="concat(' WOS:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='wos'][not(starts-with(lower-case(.), 'wos:'))]/concat(., ':::', @relationType),
(//datacite:relatedIdentifier)[starts-with(lower-case(.), 'wos:')]/concat(substring-after(lower-case(.), 'wos:'), ':::', @relationType)
)), ' WOS:::'))"/>
<xsl:variable name="varRelPidUrl" select="concat(' URL:::', string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*)='url']
[not(contains(., 'doi.org/10.')) and not(contains(., 'info:doi:')) and not(matches(., '.*/doi/.*/10\..*'))]
[not(contains(., 'hdl.handle.net/')) and not(contains(., 'info:hdl:'))]
[not(contains(., '://www.ncbi.nlm.nih.gov/pmc/articles/'))]
/concat(., ':::', @relationType)
)), ' URL:::'))"/>
<xsl:variable name="varRelPid" select="concat($varRelPidDoi[not(. = ' DOI:::')], $varRelPidHandle[not(. = ' Handle:::')], $varRelPidPmid[not(. = ' PMID:::')], $varRelPidPmcid[not(. = ' PMCID:::')], $varRelPidArxiv[not(. = ' arXiv:::')], $varRelPidWos[not(. = ' WOS:::')], $varRelPidUrl[not(. = ' URL:::')])"/>
<!-- container PIDs -->
<xsl:variable name="varContainerPidIssn" select="string-join(distinct-values((
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0001' and lower-case(@*) = ('issn', 'pissn', 'eissn', 'lissn')]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', substring(normalize-space(.), 1, 4), '-', substring(normalize-space(.), string-length(normalize-space(replace(., '\(.*$', '')))-3, 4), ':::0043'),
(//datacite:relatedIdentifier)[lower-case(@*) = ('issn', 'pissn', 'eissn', 'lissn') and lower-case(.[1]/@relationType) = 'ispartof' and not(contains(lower-case(.), 'doi')) and matches(., '.*\d{4}[\-\s]*\d{3}[\dXx].*') and not(contains(lower-case(.), 'edition'))]/concat(' ', upper-case(@relatedIdentifierType), ':::', substring(normalize-space(replace(., 'ISSN:?', '')), 1, 4), '-', substring(normalize-space(.), string-length(normalize-space(replace(., '\(.*$', '')))-3, 4), (.[$varCobjCategory = '0001' or //*[local-name()='resourceType' and contains(@uri, 'c_dcae04bc')]]/':::0043', .[$varCobjCategory = '0013']/'0002', //*[local-name()='resourceType'][./@uri=('http://purl.org/coar/resource_type/c_5794', 'http://purl.org/coar/resource_type/c_6670')]/'0004')[1])
)), '')"/>
<xsl:variable name="varContainerPidIsbn" select="string-join(distinct-values((
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0013' and lower-case(@*) = 'isbn'][not(contains(., ':'))][not(contains(normalize-space(.), ' '))]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', normalize-space(.), ':::0002'),
(//datacite:alternateIdentifier, //datacite:identifier)[$varCobjCategory = '0013' and starts-with(lower-case(.), 'urn:isbn:')][not(contains(normalize-space(.), ' '))]/concat(' ', @*[local-name() = ('identifierType', 'alternateIdentifierType')]/upper-case(.), ':::', substring-after(normalize-space(.), 'urn:isbn:'), ':::0002'),
(//datacite:relatedIdentifier)[lower-case(@*) = 'isbn' and lower-case(./@relationType) = 'ispartof']/concat(' ', upper-case(@relatedIdentifierType), ':::', normalize-space(.), ':::', (.[$varCobjCategory = '0001']/':::0043', .[$varCobjCategory = '0013']/'0002', //*[local-name()='resourceType'][./@uri=('http://purl.org/coar/resource_type/c_5794', 'http://purl.org/coar/resource_type/c_6670')]/'0004')[1])
)), '')"/>
<xsl:variable name="varContainerPidUrl" select="string-join(distinct-values((
(//datacite:relatedIdentifier)[lower-case(@*) = 'url' and lower-case(./@relationType) = 'ispartof'][not(contains(normalize-space(.), ' ')) and not(contains(., 'doi/'))]/concat(' ', upper-case(@relatedIdentifierType), ':::', normalize-space(.), ':::', (.[$varCobjCategory = ('0024', '0025', '0030', '0033')]/':::0022')[1])
)), '')"/>
<xsl:variable name="varContainerPid" select="concat($varContainerPidIssn[not(. = ' ISSN:::')], $varContainerPidIsbn[not(. = ' ISBN:::')], $varContainerPidUrl[not(. = ' URL:::')])"/>
<!-- drop oaire resource -->
<!-- <oaire:resource xmlns="http://namespace.openaire.eu/schema/oaire/"> -->
<datacite:resource>
<!-- ~~~~~ IDs ~~~~~ -->
<!-- choose 'best' PID among identifiers and alternateIdentifers, and cut off DOI resolver prefix to just get the number part -->
<datacite:identifier>
<xsl:attribute name="identifierType" select="substring-before(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
<xsl:value-of select="substring-after(tokenize(normalize-space($varPid), ' ')[1], ':::')"/>
</datacite:identifier>
<datacite:alternateIdentifiers>
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[position() > 1][string-length(substring-after(., ':::')) > 0]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="substring-before(., ':::')"/>
<xsl:value-of select="substring-after(., ':::')" />
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:for-each select="(//datacite:alternateIdentifier, //datacite:identifier)
[not($varCobjCategory = '0001' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))]
[not($varCobjCategory = '0013' and ./@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = 'isbn')]
[not(ends-with(., 'pdf'))]
[not(@*[local-name()=('identifierType', 'alternateIdentifierType')]/lower-case(.) = ('doi', 'handle', 'urn', 'pmid', 'pmcid', 'arxiv', 'wos', 'url', 'isbn', 'issn', 'eissn', 'lissn', 'pissn'))]
[not(. = $varLandingPage)]">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="./@*[local-name()=('identifierType', 'alternateIdentifierType')]"/>
<xsl:value-of select="."/>
</datacite:alternateIdentifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<datacite:alternateIdentifier>
<xsl:attribute name="alternateIdentifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</datacite:alternateIdentifier>
</xsl:if>
</datacite:alternateIdentifiers>
<datacite:relatedIdentifiers>
<xsl:for-each select="tokenize(normalize-space($varRelPid), ' ')
[not(contains(lower-case($varContainerPid), lower-case(substring-before(substring-after(., ':::'), ':::'))))]">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="substring-before(., ':::')"/>
<xsl:attribute name="relationType" select="substring-after(substring-after(., ':::'), ':::')"/>
<xsl:value-of select="substring-before(substring-after(., ':::'), ':::')" />
</datacite:relatedIdentifier>
</xsl:for-each>
<xsl:for-each select="(//datacite:relatedIdentifier)
[not(@relatedIdentifierType/lower-case(.) = ('doi', 'handle', 'pmid', 'pmcid', 'wos', 'url'))]
[not(starts-with(lower-case(.), 'wos:') or contains(., 'hdl.handle.net/') or contains(., 'doi.org/10.'))]
[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn', 'isbn') and @relationType/lower-case(.) = 'ispartof')]">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="./@relatedIdentifierType"/>
<xsl:attribute name="relationType" select="./@relationType"/>
<xsl:value-of select=".[not(@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn'))],
.[@relatedIdentifierType/lower-case(.) = ('issn', 'pissn', 'eissn', 'lissn')]/concat(substring(., 1, 4), '-', substring(., string-length(.)-3, 4))"/>
</datacite:relatedIdentifier>
</xsl:for-each>
<xsl:for-each select="tokenize(normalize-space($varContainerPid), ' ')">
<datacite:relatedIdentifier>
<xsl:attribute name="relatedIdentifierType" select="substring-before(., ':::')"/>
<xsl:attribute name="relationType" select="'IsPartOf'"/>
<xsl:value-of select="substring-before(substring-after(., ':::'), ':::')" />
<!-- <xsl:value-of select="substring-after(., ':::')" /> -->
</datacite:relatedIdentifier>
</xsl:for-each>
</datacite:relatedIdentifiers>
<!-- change namespace/format from oaire to datacite for description, language, rights, ... -->
<xsl:for-each select="//oaire:resourceType">
<datacite:resourceType>
<xsl:attribute name="xs:anyURI" select="@uri"/>
<xsl:value-of select="."/>
</datacite:resourceType>
</xsl:for-each>
<xsl:for-each select="distinct-values(//oaire:version)">
<datacite:version>
<xsl:value-of select="."/>
</datacite:version>
</xsl:for-each>
<xsl:if test="(//datacite:rights, //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rightsList>
<xsl:for-each select="(//datacite:rights | //oaire:licenseCondition)[string-length(.) > 0 or string-length(@rightsURI) > 0 or string-length(@uri) > 0]">
<datacite:rights>
<xsl:attribute name="rightsURI" select="(@rightsURI, @uri)[1]"/>
<xsl:value-of select="."/>
</datacite:rights>
</xsl:for-each>
</datacite:rightsList>
</xsl:if>
<xsl:if test="//datacite:title">
<datacite:titles>
<xsl:for-each select="//datacite:title">
<datacite:title>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:title>
</xsl:for-each>
</datacite:titles>
</xsl:if>
<xsl:if test="//dc:description">
<datacite:descriptions>
<xsl:for-each select="//dc:description">
<datacite:description>
<xsl:attribute name="descriptionType" select="'Abstract'"/>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:value-of select="."/>
</datacite:description>
</xsl:for-each>
</datacite:descriptions>
</xsl:if>
<xsl:for-each select="distinct-values(//dc:language)[string-length(normalize-space(.)) > 0]">
<datacite:language>
<xsl:value-of select="normalize-space(.)"/>
</datacite:language>
</xsl:for-each>
<xsl:for-each select="distinct-values(//dc:publisher)[string-length(normalize-space(.)) > 0]">
<datacite:publisher>
<xsl:value-of select="normalize-space(.)"/>
</datacite:publisher>
</xsl:for-each>
<xsl:if test="//dc:format[string-length(normalize-space(.)) > 0]">
<datacite:formats>
<xsl:for-each select="distinct-values(//dc:format)[string-length(normalize-space(.)) > 0]">
<datacite:format>
<xsl:value-of select="normalize-space(.)"/>
</datacite:format>
</xsl:for-each>
</datacite:formats>
</xsl:if>
<xsl:if test="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReferences>
<xsl:for-each select="//oaire:fundingReference[./oaire:awardNumber]">
<datacite:fundingReference>
<datacite:funderName>
<xsl:value-of select="./oaire:funderName"/>
</datacite:funderName>
<datacite:funderIdentifier>
<xsl:attribute name="funderIdentifierType" select="'Crossref Funder ID'"/>
<xsl:value-of select="./oaire:funderIdentifier"/>
</datacite:funderIdentifier>
<datacite:awardNumber>
<xsl:value-of select="./oaire:awardNumber"/>
</datacite:awardNumber>
<!--<xsl:value-of select="."/>-->
</datacite:fundingReference>
</xsl:for-each>
</datacite:fundingReferences>
</xsl:if>
<xsl:apply-templates select="(//*[local-name()='resource'], //*[local-name() = 'oai_openaire'])/*[not(local-name() = ('identifier', 'alternateIdentifiers', 'alternateIdentifier', 'relatedIdentifiers', 'relatedIdentifier', 'description', 'titles', 'title', 'language', 'publisher', 'resourceType', 'version', 'fundingReferences', 'fundingReference', 'rights', 'licenseCondition', 'file', 'format', 'audience', 'source', 'coverage'))][not(starts-with(local-name(), 'citation'))]"/>
<!-- </oaire:resource> -->
</datacite:resource>
<!-- ~~~~~ put oaf elements below datacite:resource ~~~~~ -->
<!-- oaf:identifier -->
<xsl:for-each select="tokenize(normalize-space($varPid), ' ')[string-length(substring-after(normalize-space(.), ':::')) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="substring-before(normalize-space(.), ':::')"/>
<xsl:value-of select="substring-after(normalize-space(.), ':::')"/>
</oaf:identifier>
</xsl:for-each>
<xsl:if test="not(starts-with(normalize-space(lower-case($varPid)), 'landingpage')) and string-length($varLandingPage) > 0">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'landingPage'"/>
<xsl:value-of select="$varLandingPage"/>
</oaf:identifier>
</xsl:if>
<xsl:if test="//*[local-name() = 'about']/*[local-name() = 'provenance']/*[local-name() = 'originDescription']/*[local-name() = 'originDescription']/*[local-name() = 'identifier' and string-length(.) > 0]">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'oai-original'"/>
<xsl:value-of select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'identifier']"/>
</oaf:identifier>
</xsl:if>
<xsl:variable name='varEmbargoEndDate' select="dateCleaner:dateISO(normalize-space(//*[local-name()='date'][@dateType='Available']))"/>
<!-- resourceType, superType -->
<xsl:choose>
<xsl:when test="lower-case(//*[local-name()='resourceType']/@resourceTypeGeneral) = ('dataset', 'software', 'literature', 'publication', 'other research product') or not(//*[local-name()='resourceType']/@resourceTypeGeneral)">
<dr:CobjCategory>
<xsl:variable name="varCobjCategory"
select="vocabulary:clean( //*[local-name()='resourceType']/@resourceTypeGeneral, 'dnet:publication_resource')"/>
<xsl:variable name="varSuperType"
select="vocabulary:clean( $varCobjCategory, 'dnet:result_typologies')"/>
<xsl:attribute name="type">
<xsl:value-of select="$varSuperType"/>
</xsl:attribute>
<xsl:value-of select="$varCobjCategory"/>
</dr:CobjCategory>
<!-- <dr:CobjCategory>
<xsl:attribute name="type" select="//oaf:datasourceprefix[. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/')]/'other', //oaf:datasourceprefix[not(. = '_______qeios' and contains(//dri:recordIdentifier, '/definition/'))]/$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
-->
</xsl:when>
<!-- drop journals -->
<xsl:when test="lower-case(//*[local-name()='resourceType']/@uri) = 'http://purl.org/coar/resource_type/c_0640'">
<xsl:call-template name="terminate"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="terminate"/>
</xsl:otherwise>
</xsl:choose>
<!-- review status -->
<xsl:variable name="varRefereedConvt" select="for $i in (
//*[local-name()='resourceType']/(., @uri), //oai:setSpec, //*[local-name()='description'])
return vocabulary:clean( normalize-space($i), 'dnet:review_levels')"/>
<xsl:variable name="varRefereedIdntf" select="(
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])pre[\.\-_\\/\s\(\)%\d#:]?prints?([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0002',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '(^|.*[\.\-_\\/\s\(\)%\d#:])refereed([\.\-_\\/\s\(\)%\d#:].*)?$')]/'0001',
//*[local-name()=('identifier', 'alternateIdentifier', 'file')][count(//*[local-name()=('metadata', 'resource')]//*[local-name()=('identifier', 'alternateIdentifier', 'file')]) = 1][matches(lower-case(.), '.*-peer-reviewed-(fulltext-)?article-.*')]/'0001')"/>
<xsl:variable name="varRefereedSourc" select="(//*[local-name()=('publisher', 'source', 'citationTitle')][matches(lower-case(.), '.*[\s\-\.\\_/:%]pre[\s\-\.\\_/:%]?prints?([\s\-\.\\_/:%].*|$)')]/'0002')"/>
<xsl:variable name="varRefereedReltn" select="//*[local-name() = 'relatedIdentifier'][./@relationType/lower-case(.)='isreviewedby']/'0001'"/>
<xsl:variable name="varRefereedDesct" select="(//*[local-name() = 'description']
[matches(lower-case(.), '.*(this\s*book|this\s*volume|it)\s*(constitutes|presents)\s*the\s*(thoroughly\s*)?refereed') or
matches(lower-case(.), '.*peer[\.\-_/\s\(\)]?review\s*under\s*responsibility\s*of.*') or
matches(lower-case(.), '(this|a)\s*(article|preprint)\s*(has\s*been\s*)?(peer[\-\s]*)?reviewed\s*and\s*recommended\s*by\s*peer[\-\s]*community')]/'0001')"/>
<xsl:variable name="varRefereedTitle" select="(//*[local-name()=('title')][matches(lower-case(.), '.*\[.*peer[\s\-\._]*review\s*:.*\]\s*$')]/'0001')"/>
<xsl:variable name="varRefereedVersn" select="vocabulary:clean( normalize-space( //*[local-name()='version']), 'dnet:review_levels')"/>
<xsl:variable name="varRefereed" select="($varRefereedConvt, $varRefereedIdntf, $varRefereedSourc, $varRefereedReltn, $varRefereedDesct, $varRefereedTitle, $varRefereedVersn)"/>
<xsl:choose>
<xsl:when test="count($varRefereed[. = '0001']) > 0">
<oaf:refereed>
<xsl:value-of select="'0001'"/>
</oaf:refereed>
</xsl:when>
<xsl:when test="count($varRefereed[. = '0002']) > 0">
<oaf:refereed>
<xsl:value-of select="'0002'"/>
</oaf:refereed>
</xsl:when>
</xsl:choose>
<oaf:dateAccepted>
<xsl:value-of
select="dateCleaner:dateISO( normalize-space(//datacite:date[@dateType = 'Issued']))"/>
</oaf:dateAccepted>
<!--
<oaf:accessrights>
<xsl:variable name='varAccessRights' select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')" />
</oaf:accessrights>
<xsl:choose>
<xsl:when test="not($varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())))">
<xsl:value-of select="TransformationFunction:convertString($tf, (//*[local-name() = 'rights']/(@uri, @rightsURI))[1], 'AccessRights')"/>
</xsl:when>
<xsl:when test="$varAccessRights = 'EMBARGO' and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
</xsl:choose>
-->
<xsl:variable name='varAccessRights' select="string-join((for $i in ((//*[local-name() = 'rights'], //*[lower-case(local-name())='licensecondition'])/(@*, .)) return vocabulary:clean( $i, 'dnet:access_modes')), ' ')" />
<oaf:accessrights>
<xsl:choose>
<xsl:when test="contains($varAccessRights, 'OPEN SOURCE')">
<xsl:value-of select="'OPEN SOURCE'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'OPEN')">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and not((xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date()))">
<xsl:value-of select="'OPEN'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'EMBARGO') and (xs:date( max( ($varEmbargoEndDate, '0001-01-01') ) ) gt current-date())">
<xsl:value-of select="'EMBARGO'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'RESTRICTED')">
<xsl:value-of select="'RESTRICTED'"/>
</xsl:when>
<xsl:when test="contains($varAccessRights, 'CLOSED')">
<xsl:value-of select="'CLOSED'"/>
</xsl:when>
</xsl:choose>
</oaf:accessrights>
<xsl:for-each select="//*[local-name()='licenseCondition']
[string-length(.) > 0 or string-length(@uri) > 0]
[(starts-with(@uri, 'http') and (contains(@uri, '://creativecommons.org/licenses/') or contains(@uri, '://creativecommons.org/publicdomain/') or contains(@uri, '://opensource.org/licenses/') or contains(@uri, '://opendatacommons.org/licenses/') or contains(@uri, '://rightsstatements.org/page/') or contains(@uri, '://rightsstatements.org/vocab/') or contains(@uri, '://www.opendefinition.org/licenses/') or contains(@uri, '://www.gnu.org/licenses/') or contains(@uri, '://artlibre.org/licence/') or contains(@uri, '://repositorio.uca.edu.sv/jspui/licencias/') or contains(@uri, '://bibliotecavirtual.unl.edu.ar/licencia/'))) or matches(., '^CC[- ]BY([- ](NC([- ](ND|SA))?|ND|SA))([- ]\d(\.\d)?)?$', 'i')]">
<oaf:license>
<xsl:value-of select=".[not(./@uri)], .[./@uri]/@uri"/>
</oaf:license>
</xsl:for-each>
<oaf:language>
<xsl:value-of select="vocabulary:clean( //*[local-name()='language'], 'dnet:languages')" />
</oaf:language>
<xsl:call-template name="funding" />
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
<!-- oaf:container -->
<!-- ToDo: set @typ -->
<xsl:variable name="varCitation" select="//*[starts-with(local-name(), 'citation')]" />
<xsl:variable name="varSource" select="//dc:source[//oaf:datasourceprefix[.=('od______1514', 'od______3158')]]" />
<!-- test
<xsl:if test="contains($varContainerPid, ':::')">
<oaf:container>
<xsl:for-each select="tokenize(normalize-space($varContainerPid), ' ')">
<xsl:attribute name="{lower-case(substring-before(., ':::'))}" select="substring-before(substring-after(., ':::'), ':::')"/>
<xsl:attribute name="typ" select="substring-after(substring-after(., ':::'), ':::')"/>
</xsl:for-each>
<xsl:choose>
<xsl:when test="lower-case(substring-before(., ':::')) = ('issn', 'pissn', 'eissn', 'lissn')">
<xsl:attribute name="vol" select="$varCitation[local-name(.) = 'citationVolume']"/>
<xsl:attribute name="iss" select="$varCitation[local-name(.) = 'citationIssue']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
<xsl:when test="lower-case(substring-before(., ':::')) = 'isbn'">
<xsl:attribute name="edt" select="$varCitation[local-name(.) = 'citationEdition']"/>
<xsl:attribute name="sp" select="$varCitation[local-name(.) = 'citationStartPage']"/>
<xsl:attribute name="ep" select="$varCitation[local-name(.) = 'citationEndPage']"/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$varCitation[local-name(.) = 'citationTitle'], $varSource" />
</oaf:container>
</xsl:if>
test -->
<xsl:if test="$varCobjCategory = '0001' and string-length($varContainerPid) > 0">
<oaf:journal>
<xsl:attribute name='issn' select="substring-before(substring-after($varContainerPidIssn, ' ISSN:::'), ':::')" />
<xsl:attribute name='eissn' select="substring-before(substring-after($varContainerPidIssn, ' EISSN:::'), ':::')" />
<xsl:attribute name='vol' select="//*[local-name() = 'citationVolume']"/>
<xsl:attribute name='iss' select="//*[local-name() = 'citationIssue']"/>
<xsl:attribute name='sp' select="//*[local-name() = 'citationStartPage']"/>
<xsl:attribute name='ep' select="//*[local-name() = 'citationEndPage']"/>
<xsl:value-of select="//*[local-name() = 'citationTitle']" />
</oaf:journal>
</xsl:if>
<!-- Huelva marks L, E ISSNs as ISSNs, with mark within field in spaces or after blanc -->
<!-- Qeios declares many records as text, although many seem to be definitions which are also related to 'journal' volumes/issues -->
<!-- oaf:fulltext-->
<!-- toDo: clarify if fulltext should be filled when URL given and rights oa -->
<!--
<xsl:if test="//*[local-name() = 'file']">
<oaf:fulltext>
<xsl:value-of select="//*[local-name() = 'file']"/>
</oaf:fulltext>
</xsl:if>
-->
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template name="funding">
<!-- funding -->
<xsl:for-each select="//*[local-name()='fundingReference'][./*[local-name()='awardNumber']]">
<xsl:choose>
<!-- FP7 -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004963|10.13039/100011199|10.13039/100011102)\s*$')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Framework Programme Seven', 'FP7')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- H2020 (Horizon 2020 Framework Programme) -->
<!-- -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100010661)\s*')]
or (./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000780)$')] and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020'))
or (./*[local-name()='funderName'] = 'European Commission' and ./*[local-name()='fundingStream'] = ('Horizon 2020 Framework Programme', 'H2020')))
and ./*[local-name()='awardNumber'][matches(., '.*(^|[^\d])\d\d\d\d\d\d($|[^\d]).*')]">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(./*[local-name()='awardNumber'], '.*(^|[^\d])(\d\d\d\d\d\d)($|[^\d]).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- AKA -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002341)\s*$') ]
or ./*[local-name()='funderName'][contains(., 'Suomen Akatemia') or contains(., 'Academy of Finland')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- ARC -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000923)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Australian Research Council')])
and ./*[local-name()='awardNumber'][matches(., '^\d{6}$')]">
<oaf:projectid>
<xsl:value-of select="concat($varAKA, replace(./*[local-name()='awardNumber'], '.*(^\d{6}$).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- CONICYT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002848)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Comisión Nacional de Investigación Científica y Tecnológica') or contains(., 'CONICYT')]">
<oaf:projectid>
<xsl:value-of select="concat($varCONICYT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- DFG -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001659)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Deutsche Forschungsgemeinschaft') or contains(., 'DFG') or contains(., 'Deutsche Forschungsgemeinschaft (DFG)')]">
<oaf:projectid>
<xsl:value-of select="concat($varDFG, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!---->
<!-- FCT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fundação para a Ciência e a Tecnologia')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- FWF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100002428)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Fonds zur Förderung der Wissenschaftlichen Forschung') or contains(., 'Austrian Science Fund')]">
<oaf:projectid>
<xsl:value-of select="concat($varFCT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MESTD -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001871)\s*$')]
or ./*[local-name()='funderName'][(contains(., 'Ministarstvo Prosvete, Nauke i Tehnolo') and contains(., 'kog Razvoja')) or contains(., 'MESTD')]">
<oaf:projectid>
<xsl:value-of select="concat($varMESTD, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- MZOS -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100006588)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Ministarstvo Znanosti, Obrazovanja i Sporta') or contains(., 'Ministry of Science, Education and Sports')]">
<oaf:projectid>
<xsl:value-of select="concat($varMZOS, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NHMRC -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000925)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Health and Medical Research Council') or contains(., 'NHMRC')]">
<oaf:projectid>
<xsl:value-of select="concat($varNHMRC, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NIH -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000002)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Institutes of Health')]">
<oaf:projectid>
<xsl:value-of select="concat($varNIH, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100000001)\s*$')]
or ./*[local-name()='funderName'][contains(., 'National Science Foundation')]">
<oaf:projectid>
<xsl:value-of select="concat($varNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- NWO -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100003246)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Netherlands Organisation for Scientific Research') or contains(., 'Nederlandse Organisatie voor Wetenschappelijk Onderzoek')]">
<oaf:projectid>
<xsl:value-of select="concat($varNWO, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- RCUK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100000690)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Research Councils UK') or contains(., 'RCUK')]">
<oaf:projectid>
<xsl:value-of select="concat($varRCUK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- SFI -->
<xsl:when test="(./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001602)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Science Foundation Ireland')])
and ./*[local-name()='awardNumber'][matches(., '.*([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+.*')]">
<oaf:projectid>
<xsl:value-of select="concat($varSFI, replace(./*[local-name()='awardNumber'], '.*(^|\s)(([\dA-Za-z\.\-]+/)+[\dA-Za-z\.\-]+)($|\s).*', '$2'))"/>
</oaf:projectid>
</xsl:when>
<!-- SNSF -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100001711)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Swiss National Science Foundation') or contains(., 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung')]">
<oaf:projectid>
<xsl:value-of select="concat($varSNSF, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- TUBITAK -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/501100004410)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Turkish National Science and Research Council') or (contains(., 'Türkiye Bilimsel ve Teknolojik Ara') and contains(., 'rma Kurumu'))]">
<oaf:projectid>
<xsl:value-of select="concat($varTUBITAK, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
<!-- WT -->
<xsl:when test="./*[local-name()='funderIdentifier'][matches(., '.*(doi.org/)?(10.13039/100004440)\s*$')]
or ./*[local-name()='funderName'][contains(., 'Wellcome Trust') or . = 'WT']">
<oaf:projectid>
<xsl:value-of select="concat($varWT, ./*[local-name()='awardNumber'])"/>
</oaf:projectid>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- toDo: improve by selecting all attributes -->
<xsl:template match="//*[local-name()='nameIdentifier']">
<datacite:nameIdentifier>
<xsl:attribute name="nameIdentifierScheme" select="./@*[local-name()=('nameIdentifierScheme')]"/>
<xsl:attribute name="schemeURI" select="./@*[local-name()=('schemeURI')]"/>
<xsl:choose>
<xsl:when test=".[contains(., 'orcid.org/')]">
<xsl:value-of select="substring-after(., 'orcid.org/')" />
</xsl:when>
<xsl:when test=".[contains(., 'researcherid.com/rid/')]">
<xsl:value-of select="substring-after(., 'researcherid.com/rid/')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</datacite:nameIdentifier>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<header xmlns="http://www.openarchives.org/OAI/2.0/">
<!--
<xsl:copy copy-namespaces="no">
-->
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
<!--
</xsl:copy>
-->
</header>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,351 @@
<!-- original: xslt_dc2oaf_narcis from PROD 2021-11-18 -->
<xsl:stylesheet
version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dateCleaner="http://eu/dnetlib/transform/dateISO"
xmlns:vocabulary="http://eu/dnetlib/transform/clean"
exclude-result-prefixes="xsl vocabulary dateCleaner">
<xsl:param name="varOfficialName" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varFP7" select="'corda_______::'"/>
<xsl:param name="varH2020" select="'corda__h2020::'"/>
<xsl:param name="repoCode" select="substring-before(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="vCodes">
<codes>
<code key="uva" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="uvapub" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="vumc" value="od_______323" id="opendoar____::323" name="Universiteit van Amsterdam Digital Academic Repository"/>
<code key="cwi" value="od______2358" id="opendoar____::2358" name="Repository CWI Amsterdam"/> <!-- CWI -->
<code key="eur" value="od______1113" id="opendoar____::1113" name="Erasmus University Institutional Repository"/>
<code key="wur" value="od_______370" id="opendoar____::370" name="Wageningen Yield"/>
<code key="uu" value="od_______101" id="opendoar____::101" name="Utrecht University Repository"/>
<code key="ru" value="od______1236" id="opendoar____::1236" name="Radboud Repository"/> <!-- Radboud -->
<code key="run" value="od______1236" id="opendoar____::1236" name="Radboud Repository"/> <!-- Radboud -->
<code key="uvt" value="od_______550" id="opendoar____::550" name="Tilburg University Repository"/> <!-- Tilburg -->
<code key="aup" value="od________19" id="opendoar____::19" name="Amsterdam University Press Publications"/> <!-- amsterdam univ. press -->
<code key="rug" value="od_______189" id="opendoar____::189" name="University of Groningen Digital Archive"/> <!-- groningen -->
<code key="dans" value="r384e1237760" id="re3data_____::r3d100010214" name="EASY"/> <!--easy -->
<code key="differ" value="differ______" id="openaire____::75ee19e2-ff9e-47f7-bed6-2e3ee23e2b49" name="Dutch Institute for Fundamental Energy Research"/>
<code key="kit" value="od______1423" id="opendoar____::1423" name="Search4Dev"/> <!-- search4dev -->
<code key="ul" value="od_______202" id="opendoar____::202" name="Leiden University Repository"/> <!-- leiden -->
<code key="um" value="od________83" id="opendoar____::83" name="UM Publications"/>
<code key="knaw" value="od______1476" id="opendoar____::1476" name="KNAW Repository"/>
<code key="vu" value="od_______369" id="opendoar____::369" name="DSpace at VU"/>
<code key="ut" value="od_______354" id="opendoar____::354" name="Universiteit Twente Repository"/>
<code key="hbo" value="hbo_________" id="openaire____::79c8217f-00ee-4902-9743-9e11b4970c60" name="HBO Kennisbank"/>
<code key="kim" value="kim_________" id="openaire____::b1b15b72-bf0b-4f91-9f95-dab2e43d3eaa" name="Publicaties KiM"/>
<code key="nivel" value="nivel_____nl" id="driver______::daf0542d-1ef5-4f9d-80f1-62849b92aefa" name="NIVEL publications"/>
<code key="ntrl" value="od_______913" id="opendoar____::913" name="Naturalis Publications"/>
<code key="nyenrode" value="nyenrode____" id="openaire____::e57352f3-516b-42cb-b666-2480233c6513" name="Publications of the University Nyenrode"/>
<code key="ou" value="od_______233" id="opendoar____::233" name="DSpace at Open Universiteit Nederland "/>
<code key="ptu" value="ptu_________" id="openaire____::openaire____::f834f1fe-8198-4929-ac0b-b1c1bf166f38" name="Protestantse Theologische Universiteit"/>
<code key="rivm" value="od_______881" id="opendoar____::881" name="Web-based Archive of RIVM Publications"/>
<code key="scp" value="scp_________" id="openaire____::088a0087-4bc6-4c38-a052-b446c3b225a7" name="Sociaal en Cultureel Planbureau"/>
<code key="swov" value="swov________" id="openaire____::06d89df2-b613-4989-9dc3-f60f2fc593f6" name="Stichting Wetenschappelijk Onderzoek Verkeersveiligheid (SWOV) Library Repository"/>
<code key="tno" value="tno_________" id="openaire____::58fd0ad2-c476-11e5-80b3-0021e9e777ac" name="TNO Repository - hosted by TU Delft Library"/>
<code key="tue" value="od_______567" id="opendoar____::567" name="Repository TU/e"/>
<code key="tuk" value="tuk_________" id="openaire____::df55d991-1ebb-459c-aed6-559bcbb1d277::" name="Theological University Kampen"/>
<code key="uvh" value="uvh_______nl" id="driver______::a422c38b-73de-44bf-a340-a4fd5f0817ea" name="Universiteit voor Humanistiek"/>
<code key="tua" value="tua_________" id="openaire____::cd073e1e-2fe9-4ea7-aea5-dc6855c347f7" name="Theological University Apeldoorn"/>
<code key="tud" value="od_______571" id="opendoar____::571" name="TU Delft Repository"/>
<code key="wodc" value="wodc______nl" id="driver______::03c60250-9d65-44fe-85d3-23503b3303af" name="WODC Repository Ministerie van Veiligheid en Justitie"/>
<code key="unesco" value="unesco___ihe" id="2877c7c4-b57a-4f62-9c16-d7faa5b0b98b" name="UNESCO-IHE Institute for Water Education"/>
</codes>
</xsl:variable>
<!-- not considered
hbo added
tno added
differ added
nyenrode added
beeldengeluis todo, not yet found in metadata
philips todo, not yet found in metadata
scp added
swov added
tuk added
tua added
ptu added
ut_restricted ? merge with ut?
nda
neyenrode
-->
<xsl:key name="kCodeByName" match="code" use="string(@key)"/>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template match="/">
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:title"/>
<xsl:with-param name="targetElement" select="'dc:title'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:creator/replace(., '^(.*)\|.*$', '$1')"/>
<xsl:with-param name="targetElement" select="'dc:creator'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:contributor"/>
<xsl:with-param name="targetElement" select="'dc:contributor'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:description"/>
<xsl:with-param name="targetElement" select="'dc:description'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:subject"/>
<xsl:with-param name="targetElement" select="'dc:subject'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:publisher"/>
<xsl:with-param name="targetElement" select="'dc:publisher'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:format"/>
<xsl:with-param name="targetElement" select="'dc:format'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:type"/>
<xsl:with-param name="targetElement" select="'dc:type'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:source"/>
<xsl:with-param name="targetElement" select="'dc:source'"/>
</xsl:call-template>
<dc:language>
<xsl:value-of select="vocabulary:clean( //dc:language, 'dnet:languages')"/>
</dc:language>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:rights"/>
<xsl:with-param name="targetElement" select="'dc:rights'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:relation"/>
<xsl:with-param name="targetElement" select="'dc:relation'"/>
</xsl:call-template>
<xsl:if test="not(//dc:identifier[starts-with(., 'http')])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:identifier[starts-with(., 'http')]"/>
<xsl:with-param name="targetElement" select="'dc:identifier'"/>
</xsl:call-template>
<xsl:for-each select="//dc:relation">
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<!--
<xsl:if test="not(//didl:Component/didl:Resource[@mimeType='application/pdf'])">
<xsl:call-template name="terminate"/>
</xsl:if>
-->
<oaf:accessrights>
<xsl:value-of select="vocabulary:clean( //dc:rights, 'dnet:access_modes')"/>
</oaf:accessrights>
<!--
<dr:CobjCategory>
<xsl:value-of select="TransformationFunction:convertString($tf, //dc:type, 'TextTypologies')" />
</dr:CobjCategory>
-->
<dr:CobjCategory>
<xsl:variable name="varCobjCategory" select="vocabulary:clean( //dc:type, 'dnet:publication_resource')" />
<xsl:variable name="varSuperType" select="vocabulary:clean( $varCobjCategory, 'dnet:result_typologies')"/>
<xsl:attribute name="type" select="$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
<!-- review status -->
<!-- -->
<xsl:variable name="varRefereedConvt" select="for $i in (//dc:type, //dc:description, //oai:setSpec)
return vocabulary:clean( normalize-space($i), 'dnet:review_levels')"/>
<xsl:variable name="varRefereedIdntf" select="(//*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '(^|.*[\.\-_/\s\(\)%\d#])pre[\.\-_/\s\(\)%\d#]?prints?([\.\-_/\s\(\)%\d#].*)?$')][count(//dc:identifier) = 1]/'0002', //*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '(^|.*[\.\-_/\s\(\)%\d#])refereed([\.\-_/\s\(\)\d%\d#].*)?$')]/'0001', //*[string(node-name(.)) = 'dc:identifier' and matches(lower-case(.), '.*-peer-reviewed-(fulltext-)?article-.*')]/'0001')"/>
<xsl:variable name="varRefereedSourc" select="//*[string(node-name(.)) = ('dc:source', 'dc:publisher') and matches(lower-case(.), '^(.*\s)?pre[\s\-_]*prints?([\s\.,].*)?$')]/'0002'"/>
<xsl:variable name="varRefereedDescr" select="(//dc:description[matches(lower-case(.), '.*(this\s*book|this\s*volume|it)\s*constitutes\s*the\s*(thoroughly\s*)?refereed') or matches(lower-case(.), '.*peer[\.\-_/\s\(\)]?review\s*under\s*responsibility\s*of.*') or matches(lower-case(.), '(this|a)\s*(article|preprint)\s*(has\s*been\s*)?(peer[\-\s]*)?reviewed\s*and\s*recommended\s*by\s*peer[\-\s]*community')]/'0001', //dc:description[matches(., '^version\s*(préliminaire.*|preliminary.*|0$)')]/'0002')"/>
<xsl:variable name="varRefereedTitle" select="(//dc:title[matches(lower-case(.), '.*\[.*peer[\s\-\._]*review\s*:.*\]\s*$')]/'0001',
//dc:title[matches(lower-case(.), '.*\(\s*pre[\s\-\._]*prints?\s*\)\s*$')]/'0002')"/>
<xsl:variable name="varRefereedSubjt" select="(//dc:subject[matches(lower-case(.), '^\s*refereed\s*$')][//oaf:datasourceprefix = 'narcis______']/'0001',
//dc:subject[matches(lower-case(.), '^\s*no[nt].{0,3}refereed\s*$')][//oaf:datasourceprefix = 'narcis______']/'0002')"/>
<xsl:variable name="varRefereed" select="($varRefereedConvt, $varRefereedIdntf, $varRefereedSourc, $varRefereedDescr, $varRefereedTitle, $varRefereedSubjt)"/>
<xsl:choose>
<xsl:when test="count($varRefereed[. = '0001']) > 0">
<oaf:refereed>
<xsl:value-of select="'0001'"/>
</oaf:refereed>
</xsl:when>
<xsl:when test="count($varRefereed[. = '0002']) > 0">
<oaf:refereed>
<xsl:value-of select="'0002'"/>
</oaf:refereed>
</xsl:when>
</xsl:choose>
<oaf:dateAccepted>
<xsl:value-of select="dateCleaner:dateISO( //dc:date[1] )"/>
</oaf:dateAccepted>
<xsl:if test="//dc:relation[starts-with(., 'http')] and //dc:rights[.='info:eu-repo/semantics/openAccess']">
<oaf:fulltext>
<xsl:value-of select="//dc:relation[starts-with(., 'http')]"/>
</oaf:fulltext>
</xsl:if>
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@name"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@id"/>
</xsl:attribute>
</oaf:hostedBy>
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
<!-- ID recognition incomplete -->
<xsl:variable name="varKnownFileEndings" select="('.bmp', '.doc', '.docx', '.epub', '.flv', '.jpeg', '.jpg', '.m4v', '.mp4', '.mpg', '.odp', '.pdf', '.png', '.ppt', '.tiv', '.txt', '.xls', '.xlsx', '.zip')" />
<!-- regular expression for DOIs reduced here - letters like less-than and quotation marks don't work in matches, use identiferExtract when enabled -->
<xsl:variable name="varIdDoi" select="distinct-values((//dc:identifier[starts-with(., '10.')][matches(., '(10[.][0-9]{4,}[^\s/>]*/[^\s>]+)')], //dc:identifier[starts-with(., 'http') and (contains(., '://dx.doi.org/10.') or contains(., '://doi.org/10.'))]/substring-after(., 'doi.org/'), //dc:identifier[starts-with(lower-case(.), 'doi:10.')]/substring-after(lower-case(.), 'doi:')))" />
<xsl:for-each select="$varIdDoi">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'doi'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdHdl" select="distinct-values(//dc:identifier[starts-with(., 'http') and contains(., '://hdl.handle.net/')]/substring-after(., 'hdl.handle.net/'))" />
<xsl:for-each select="$varIdHdl">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'handle'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdUrn" select="distinct-values(//dc:identifier[starts-with(., 'urn:nbn:nl:') or starts-with(., 'URN:NBN:NL:')])" />
<xsl:for-each select="$varIdUrn">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'urn'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<!-- the 2 comparison orders needed to work also for URL encoded baseURLs or item URLs -->
<xsl:variable name="varOrigBaseUrl" select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'baseURL']" />
<xsl:variable name="varIdLdpg" select="distinct-values(//dc:identifier[(contains(substring-after(., '://'), '/') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), '/'))) or (contains(substring-after(., '://'), ':') and contains($varOrigBaseUrl, substring-before(substring-after(., '://'), ':')))][not(replace(lower-case(.), '.*(\.[a-z]*)$', '$1') = $varKnownFileEndings)])" />
<xsl:for-each select="$varIdLdpg">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'landingPage'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<xsl:variable name="varIdUrl" select="distinct-values(//dc:identifier[starts-with(., 'http')][not(contains(., '://dx.doi.org/') or contains(., '://doi.org/') or contains(., '://hdl.handle.net/'))][count(index-of($varIdLdpg, .)) = 0])" />
<xsl:for-each select="$varIdUrl">
<oaf:identifier>
<xsl:attribute name="identifierType" select="'url'"/>
<xsl:value-of select="."/>
</oaf:identifier>
</xsl:for-each>
<oaf:identifier>
<xsl:attribute name="identifierType" select="'oai-original'"/>
<xsl:value-of select="//*[local-name() = 'about']/*[local-name() = 'provenance']//*[local-name() = 'originDescription' and not(./*[local-name() = 'originDescription'])]/*[local-name() = 'identifier']"/>
</oaf:identifier>
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template name="allElements">
<xsl:param name="sourceElement"/>
<xsl:param name="targetElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="{$targetElement}">
<xsl:value-of select="normalize-space(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
</xsl:copy>
</xsl:template>
<!--
<xsl:template match="dri:objIdentifier">
<xsl:variable name="objIdentifier" select="substring-after(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:variable name="nsPrefix" select="key('kCodeByName', $repoCode, $vCodes)/@value"/>
<xsl:if test="string-length($nsPrefix) = 0">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:copy>
<xsl:value-of select="concat( $nsPrefix , '::', transformExt:md5Hex(string($objIdentifier)))"/>
</xsl:copy>
</xsl:template>
-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<xsl:param name="varAKA" select = "'aka_________::'"/>
<xsl:param name="varARC" select = "'arc_________::'"/>
<xsl:param name="varANR" select = "'anr_________::'"/>
<xsl:param name="varCHISTERA" select = "'chistera____::'"/>
<xsl:param name="varCONICYT" select = "'conicytf____::'"/>
<xsl:param name="varDFG" select = "'dfgf________::'"/>
<xsl:param name="varEUENVAGENCY" select = "'euenvagency_::'"/>
<xsl:param name="varFCT" select = "'fct_________::'"/>
<xsl:param name="varFP7" select = "'corda_______::'"/>
<xsl:param name="varFWF" select = "'fwf_________::'"/>
<xsl:param name="varGSRI" select = "'gsri________::'"/>
<xsl:param name="varGSRT" select = "'gsrt________::'"/>
<xsl:param name="varH2020" select = "'corda__h2020::'"/>
<xsl:param name="varHRZZ" select = "'irb_hr______::'"/> <!-- HRZZ not found -->
<xsl:param name="varINNOVIRIS" select = "'innoviris___::'"/>
<xsl:param name="varMESTD" select = "'mestd_______::'"/>
<xsl:param name="varMIUR" select = "'miur________::'"/>
<xsl:param name="varMZOS" select = "'irb_hr______::'"/>
<xsl:param name="varNHMRC" select = "'nhmrc_______::'"/>
<xsl:param name="varNIH" select = "'nih_________::'"/>
<xsl:param name="varNSF" select = "'nsf_________::'"/>
<xsl:param name="varNWO" select = "'nwo_________::'"/>
<xsl:param name="varRCUK" select = "'rcuk________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varRIF" select = "'rif_________::'"/>
<xsl:param name="varRSF" select = "'rsf_________::'"/>
<xsl:param name="varSFI" select = "'sfi_________::'"/>
<xsl:param name="varSFRS" select = "'sfrs________::'"/>
<xsl:param name="varSGOV" select = "'sgov________::'"/> <!-- SGOV to be added, awaiting DOI from Pilar, found project ids not in CSV list? -->
<xsl:param name="varSNSF" select = "'snsf________::'"/>
<xsl:param name="varTARA" select = "'taraexp_____::'"/> <!-- TARA to be added, awaiting DOI from André -->
<xsl:param name="varTUBITAK" select = "'tubitakf____::'"/>
<xsl:param name="varUKRI" select = "'ukri________::'"/> <!-- RCUK getting changed to UKRI -->
<xsl:param name="varWT" select = "'wt__________::'"/>

@ -37,7 +37,7 @@
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
record is not compliant, transformation skipped this record.
</xsl:message>
</xsl:template>

@ -31,11 +31,13 @@
<xsl:variable name="year" select="format-number( ( //*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@pub-type=&apos;epub&apos;]/*[local-name()=&apos;year&apos;] | //*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@date-type=&apos;pub&apos; and @publication-format=&apos;electronic&apos;]/*[local-name()=&apos;year&apos;]), &apos;0000&apos;)" />
<xsl:variable name="month" select="format-number( (//*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@pub-type=&apos;epub&apos;]/*[local-name()=&apos;month&apos;] | //*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@date-type=&apos;pub&apos; and @publication-format=&apos;electronic&apos;]/*[local-name()=&apos;month&apos;]), &apos;00&apos;)" />
<xsl:variable name="day" select="format-number( (//*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@pub-type=&apos;epub&apos;]/*[local-name()=&apos;day&apos;] | //*[local-name()=&apos;article-meta&apos;]//*[local-name()=&apos;pub-date&apos;][@date-type=&apos;pub&apos; and @publication-format=&apos;electronic&apos;]/*[local-name()=&apos;day&apos;]), &apos;00&apos;)" />
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template match="/">
<record>
<xsl:apply-templates select="//*[local-name() = &apos;header&apos;]" />

@ -0,0 +1,383 @@
<!-- production ; 2021-10-11 -->
<xsl:stylesheet
version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datacite="http://datacite.org/schema/kernel-4"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oaire="http://namespace.openaire.eu/schema/oaire/"
xmlns:oaf="http://namespace.openaire.eu/oaf"
xmlns:dateCleaner="http://eu/dnetlib/transform/dateISO"
xmlns:vocabulary="http://eu/dnetlib/transform/clean"
exclude-result-prefixes="xsl vocabulary dateCleaner">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:param name="varOfficialName" />
<xsl:param name="varDataSourceId" />
<xsl:param name="varFP7" select="'corda_______::'"/>
<xsl:param name="varH2020" select="'corda__h2020::'"/>
<xsl:param name="repoCode" select="replace(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], '^(.*):.*$', '$1')"/>
<xsl:param name="index" select="0"/>
<xsl:param name="transDate" select="current-dateTime()"/>
<xsl:variable name="vCodes">
<codes>
<code value="od______2698" id="opendoar____:2698:" key="oai:archive.lstmed.ac.uk" name="LSTM Online Archive"/>
<code value="od______1850" id="opendoar____::1850" key="oai:arro.anglia.ac.uk" name="Anglia Ruskin Research Online"/>
<code key="oai:centaur.reading.ac.uk" value="od______1731" id="opendoar____::1731" name="Central Archive at the University of Reading"/>
<code key="oai:clok.uclan.ac.uk" value="od______1882" id="opendoar____::1882" name="Central Lancashire Online Knowledge"/>
<code key="oai:collections.crest.ac.uk" value="od______1603" id="opendoar____::1603" name="Glyndŵr University Research Online"/>
<code key="oai:create.canterbury.ac.uk" value="od______2172" id="opendoar____::2172" name="Canterbury Research and Theses Environment"/>
<code key="oai:eprints.bbk.ac.uk.oai2" value="od________30" id="opendoar____::30" name="Birkbeck Institutional Research Online"/>
<code key="oai:eprints.bournemouth.ac.uk" value="od______1076" id="opendoar____::1076" name="Bournemouth University Research Online"/>
<code key="oai:eprints.chi.ac.uk" value="od______2701" id="opendoar____::2701" name="University of Chichester ChiPrints Repository"/>
<code key="oai:eprints.esc.cam.ac.uk" value="od______3280" id="opendoar____::3280" name="ESC Publications - Cambridge Univesity"/>
<code key="oai:eprints.gla.ac.uk" value="od_______162" id="opendoar____::162" name="Enlighten"/>
<code key="oai:eprints.glos.ac.uk" value="od______3160" id="opendoar____::3160" name="University of Gloucestershire Research Repository"/>
<code key="oai:eprints.gold.ac.uk" value="od______758" id="opendoar____::758" name="Goldsmiths Research Online"/>
<code key="oai:eprints.hud.ac.uk" value="od______1012" id="opendoar____::1012" name="University of Huddersfield Repository"/>
<code key="oai:eprints.keele.ac.uk" value="od______2263" id="opendoar____::2263" name="Keele Research Repository"/>
<code key="oai:eprints.kingston.ac.uk" value="od______1221" id="opendoar____::1221" name="Kingston University Research Repository"/>
<code key="oai:eprints.leedsbeckett.ac.uk" value="od______1551" id="opendoar____::1551" name="Leeds Beckett Repository"/>
<code key="oai:eprints.lse.ac.uk" value="od_______206" id="opendoar____::206" name="LSE Research Online"/>
<code key="oai:eprints.mdx.ac.uk" value="od_______213" id="opendoar____::213" name="Middlesex University Research Repository"/>
<code key="oai:eprints.nottingham.ac.uk" value="od_______226" id="opendoar____::226" name="Nottingham ePrints"/>
<code key="oai:eprints.soas.ac.uk" value="od_______285" id="opendoar____::285" name="SOAS Research Online"/>
<code key="oai:eprints.soton.ac.uk" value="od_______348" id="opendoar____::348" name="e-Prints Soton"/>
<code key="oai:eprints.staffs.ac.uk" value="od______2881" id="opendoar____::2881" name="STORE - Staffordshire Online Repository"/>
<code key="oai:eprints.uwe.ac.uk" value="od______1749" id="opendoar____::1749" name="UWE Research Repository"/>
<code key="oai:eprints.whiterose.ac.uk" value="od_______373" id="opendoar____::373" name="White Rose Research Online"/>
<code key="oai:eresearch.qmu.ac.uk" value="od______1228" id="opendoar____::1228" name="Queen Margaret University eResearch"/>
<code key="oai:gala.gre.ac.uk" value="od______1756" id="opendoar____::1756" name="Greenwich Academic Literature Archive"/>
<code key="oai:http://orca.cf.ac.uk" value="od________55" id="opendoar____::55" name="Online Research @ Cardiff"/>
<code key="oai:insight.cumbria.ac.uk" value="od______1675" id="opendoar____::1675" name="Insight - University of Cumbria"/>
<code key="oai:irep.ntu.ac.uk" value="od______1226" id="opendoar____::1226" name="Nottingham Trent Institutional Repository (IRep)"/>
<code key="oai:kar.kent.ac.uk" value="od______1328" id="opendoar____::1328" name="Kent Academic Repository"/>
<code key="oai:kultur.ucreative.ac.uk" value="od______1925" id="opendoar____::1925" name="UCA Research Online"/>
<code key="oai:lbsresearch.london.edu" value="od______3652" id="opendoar____::3652" name="LBS Research Online"/>
<code key="oai:livrepository.liverpool.ac.uk" value="od______1292" id="opendoar____::1292" name="University of Liverpool Repository"/>
<code key="oai:napier-surface.worktribe.com" value="od______1334" id="opendoar____::1334" name="Repository@Napier"/>
<code key="oai:nectar.northampton.ac.uk" value="od______1251" id="opendoar____::1251" name="NECTAR"/>
<code key="oai:nottingham-repository.worktribe.com" value="od______4162" id="opendoar____::4162" name="Nottingham Research Repository"/>
<code key="oai:nrl.northumbria.ac.uk" value="od______1448" id="opendoar____::1448" name="Northumbria Research Link"/>
<code key="oai:openaccess.city.ac.uk" value="od______2262" id="opendoar____::2262" name="City Research Online"/>
<code key="oai:openaccess.sgul.ac.uk" value="od______2556" id="opendoar____::2556" name="St George's Online Research Archive"/>
<code key="oai:open.ac.uk.OAI2" value="od_______300" id="opendoar____::300" name="Open Research Online"/>
<code key="oai:openresearch.lsbu.ac.uk" value="od______3564" id="opendoar____:3564:" name="LSBU Research Open"/>
<code key="oai:plymsea.ac.uk" value="od______3572" id="opendoar____::3572" name="Plymouth Marine Science Electronic Archive (PlyMEA)"/>
<code key="oai:publications.aston.ac.uk" value="od______1552" id="opendoar____::1552" name="Aston Publications Explorer"/>
<code key="oai:publications.heythrop.ac.uk" value="od______2697" id="opendoar____::2697" name="Heythrop College Publications"/>
<code key="oai:radar.gsa.ac.uk" value="od______2695" id="opendoar____::2695" name="Research Art Design Architecture Repository"/>
<code key="oai:ray.yorksj.ac.uk" value="od______1391" id="opendoar____::1391" name="York St John University Repository"/>
<code key="oai:repository.falmouth.ac.uk" value="od______3261" id="opendoar____::3261" name="Falmouth University Research Repository (FURR)"/>
<code key="oai:repository.londonmet.ac.uk" value="od______3367" id="opendoar____::3367" name="London Met Repository"/>
<code key="oai:repository.uwl.ac.uk" value="od______2700" id="opendoar____::2700" name="UWL Repository"/>
<code key="oai:repository.winchester.ac.uk" value="od______3794" id="opendoar____::3794" name="Winchester Research Repository"/>
<code key="oai:researchonline.bishopg.ac.uk" value="od______3650" id="opendoar____::3650" name="BG Research Online"/>
<code key="oai:researchonline.ljmu.ac.uk" value="od______3107" id="opendoar____::3107" name="LJMU Research Online"/>
<code key="oai:researchonline.lshtm.ac.uk" value="od______2377" id="opendoar____::2377" name="LSHTM Research Online"/>
<code key="oai:researchonline.rcm.ac.uk" value="rcm_ac_uk___" id="opendoar____::5143" name="Royal College of Music Research Online"/>
<code key="oai:researchonline.rvc.ac.uk" value="od______3495" id="opendoar____::3495" name="RVC Research Online"/>
<code key="oai:researchopen.lsbu.ac.uk" value="od______3564" id="opendoar____:3564:" name="LSBU Research Open"/>
<code key="oai:researchspace.bathspa.ac.uk" value="od______2694" id="opendoar____::2694" name="ResearchSPace - Bath Spa University"/>
<code key="oai:research.stmarys.ac.uk" value="od______2478" id="opendoar____::2478" name="St Mary's University Open Research Archive"/>
<code key="oai:roar.uel.ac.uk" value="od______1488" id="opendoar____::1488" name="ROAR at University of East London"/>
<code key="oai:sas-space.sas.ac.uk" value="od_______907" id="opendoar____::907" name="SAS-SPACE"/>
<code key="oai:shura.shu.ac.uk" value="od_______942" id="opendoar____::942" name="Sheffield Hallam University Research Archive"/>
<code key="oai:sro.sussex.ac.uk" value="od______2384" id="opendoar____::2384" name="Sussex Research Online"/>
<code key="oai:sro.sussex.ac.uk" value="od______897" id="opendoar____::897" name="Sussex Research Online"/>
<code key="oai:strathprints.strath.ac.uk" value="od______1181" id="opendoar____::1181" name="Strathprints"/>
<code key="oai:sure.sunderland.ac.uk" value="od______2408" id="opendoar____::2408" name="Sunderland University Institutional Repository"/>
<code key="oai:usir.salford.ac.uk" value="od_______991" id="opendoar____::991" name="University of Salford Institutional repository"/>
<code key="oai:westminsterresearch.wmin.ac.uk" value="od_______936" id="opendoar____::936" name="WestminsterResearch"/>
<code key="oai:wrap.eprints.org" value="od______1177" id="opendoar____::1177" name="University of Worcester Research and Publications"/>
<code key="oai:wrap.warwick.ac.uk" value="od______1288" id="opendoar____::1288" name="Warwick Research Archives Portal Repository"/>
</codes>
</xsl:variable>
<!--
status core-id opendoar-id repo name
na 8 30 Birkbeck Institutional Research Online
na 9 1076 Bournemouth University Research Online
ok 17 1731 Central Archive at the University of Reading
na 18 1882 Central Lancashire Online Knowledge
na 34 348 e-Prints Soton
ok 42 162 Enlighten
ok 49 1603 Glynd\u0175r University Research Online
ok 50 758 Goldsmiths Research Online
ok ? 51 1756 Greenwich Academic Literature Archive
na 53 1226 Nottingham Trent Institutional Repository (IRep)
na 57 1328 Kent Academic Repository
na 62 1551 Leeds Beckett Repository
ok 65 3107 LJMU Research Online
ok 67 206 LSE Research Online
ok 78 1251 NECTAR http://nectar.northampton.ac.uk/cgi/oai2?verb=Identify
ok 83 55 Online Research @ Cardiff
ok 86 300 Open Research Online
ok 92 1334 Repository@Napier
ok 96 1488 ROAR at University of East London
ok 103 285 SOAS Research Online
ok 109 2384 Sussex Research Online
ok 117 1925 "UCA Research Online"
ok 126 1012 University of Huddersfield Repository
ok 130 991 University of Salford Institutional repository oai:usir.salford.ac.uk
ok 134 1749 UWE Research Repository
ok 136 1288 Warwick Research Archives Portal Repository
ok 138 936 WestminsterResearch
ok 140 0 White Rose Research Online
na 147 2377 LSHTM Research Online
ok 148 2697 Heythrop College Publications
ok 162 1448 Northumbria Research Link
ok 175 2478 St Mary\u0027s University Open Research Archive
ok 253 2556 St George's Online Research Archive
ok 620 2881 STORE - Staffordshire Online Repository
ok 683 0 ! 1391 York St John University Repository http://ray.yorksj.ac.uk/cgi/oai2
ok 686 0 !2694 ResearchSPace - Bath Spa University http://researchspace.bathspa.ac.uk/cgi/oai2
ok ? 694 0 Winchester Research Repository http://repository.winchester.ac.uk/cgi/oai2 oai:repository.winchester.ac.uk
? no records so far 170 2134 LSE Theses Online http://etheses.lse.ac.uk/cgi/oai2
no longer existant: code key="oai:eprints.bucks.ac.uk" value="od______1382" id="opendoar____::1382" name="Bucks Knowledge Archive"
<code key="oai:eprints.lse.ac.uk" value="od______2134" id="opendoar____::2134" name="LSE Theses Online"/>
-->
<xsl:key name="kCodeByName" match="code" use="string(@key)"/>
<xsl:template name="terminate">
<xsl:message terminate="yes">
record is not compliant, transformation is interrupted.
</xsl:message>
</xsl:template>
<xsl:template match="/">
<xsl:if test="not(//dc:identifier[starts-with(., 'http')])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:if test="not(//*[local-name()='project'] or //*[local-name()='free_to_read'])">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:if test="not(//dc:title or //dc:title[string-length(.) eq 0])">
<xsl:call-template name="terminate"/>
</xsl:if>
<record>
<xsl:apply-templates select="//*[local-name() = 'header']" />
<metadata>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:title"/>
<xsl:with-param name="targetElement" select="'dc:title'"/>
</xsl:call-template>
<xsl:call-template name="authors">
<xsl:with-param name="sourceElement" select="//*[local-name() = 'author'][normalize-space(.) != ',']"/>
</xsl:call-template>
<!--
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='author']"/>
<xsl:with-param name="targetElement" select="'dc:creator'"/>
</xsl:call-template>
-->
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='contributor']"/>
<xsl:with-param name="targetElement" select="'dc:contributor'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:description"/>
<xsl:with-param name="targetElement" select="'dc:description'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:format"/>
<xsl:with-param name="targetElement" select="'dc:format'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:subject"/>
<xsl:with-param name="targetElement" select="'dc:subject'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:publisher"/>
<xsl:with-param name="targetElement" select="'dc:publisher'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:source"/>
<xsl:with-param name="targetElement" select="'dc:source'"/>
</xsl:call-template>
<dc:language>
<xsl:value-of select="vocabulary:clean( //dc:language, 'dnet:languages')"/>
</dc:language>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:rights"/>
<xsl:with-param name="targetElement" select="'dc:rights'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:relation"/>
<xsl:with-param name="targetElement" select="'dc:relation'"/>
</xsl:call-template>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//dc:identifier[starts-with(., 'http')]"/>
<xsl:with-param name="targetElement" select="'dc:identifier'"/>
</xsl:call-template>
<xsl:if test="//*[local-name()='version_of_record'][starts-with(., 'http://dx.doi.org/')]">
<xsl:element name="oaf:identifier">
<xsl:attribute name="identifierType">
<xsl:text>doi</xsl:text>
</xsl:attribute>
<xsl:value-of select="substring-after(//*[local-name()='version_of_record'], 'http://dx.doi.org/')"/>
</xsl:element>
</xsl:if>
<xsl:for-each select="//*[local-name()='project']">
<xsl:if test="(contains(@funder_name, 'EU FP7') or starts-with(@funder_name, 'Europe') or contains(@funder_id, '10.13039/501100000780') or contains(@funder_id, '10.13039/501100004963') ) and not(contains(., '531245')) and not(contains(lower-case(.), 'lifelong learning programme')) and matches(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varFP7, replace(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', '$1', 'i'))"/>
</oaf:projectid>
</xsl:if>
<xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')">
<oaf:projectid>
<xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/>
</oaf:projectid>
</xsl:if>
</xsl:for-each>
<!--
<xsl:if test="not(//didl:Component/didl:Resource[@mimeType='application/pdf'])">
<xsl:call-template name="terminate"/>
</xsl:if>
-->
<xsl:choose>
<xsl:when test="//*[local-name()='free_to_read']" >
<oaf:accessrights>
<xsl:text>OPEN</xsl:text>
</oaf:accessrights>
</xsl:when>
<xsl:otherwise>
<oaf:accessrights>
<xsl:text>CLOSED</xsl:text>
</oaf:accessrights>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="allElements">
<xsl:with-param name="sourceElement" select="//*[local-name()='license_ref']"/>
<xsl:with-param name="targetElement" select="'oaf:license'"/>
</xsl:call-template>
<dr:CobjCategory>
<xsl:variable name="varCobjCategory" select="vocabulary:clean( //rioxxterms:type, 'dnet:publication_resource')" />
<xsl:variable name="varSuperType" select="vocabulary:clean( $varCobjCategory, 'dnet:result_typologies')"/>
<xsl:attribute name="type" select="$varSuperType"/>
<xsl:value-of select="$varCobjCategory" />
</dr:CobjCategory>
<!--
<dr:CobjCategory>
<xsl:value-of
select="TransformationFunction:convertString($tf, //rioxxterms:type, 'TextTypologies')" />
</dr:CobjCategory>
select="TransformationFunction:convertString($tf, //*[local-name()='type'], 'TextTypologies')" />
-->
<oaf:dateAccepted>
<xsl:value-of select="dateCleaner:dateISO( //*[local-name()='publication_date'] )"/>
</oaf:dateAccepted>
<oaf:fulltext>
<xsl:value-of select="//dc:identifier[ends-with(., '.pdf')] | //dc:relation[ends-with(., '.pdf')]"/>
</oaf:fulltext>
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@name"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@id"/>
</xsl:attribute>
</oaf:hostedBy>
<!--
<oaf:hostedBy>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:hostedBy>
-->
<oaf:collectedFrom>
<xsl:attribute name="name">
<xsl:value-of select="$varOfficialName"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="$varDataSourceId"/>
</xsl:attribute>
</oaf:collectedFrom>
</metadata>
<xsl:copy-of select="//*[local-name() = 'about']" />
</record>
</xsl:template>
<xsl:template name="allElements">
<xsl:param name="sourceElement"/>
<xsl:param name="targetElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="{$targetElement}">
<xsl:value-of select="normalize-space(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="//*[local-name() = 'header']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="dr:dateOfTransformation">
<xsl:value-of select="$transDate"/>
</xsl:element>
</xsl:copy>
</xsl:template>
<xsl:template name="authors">
<xsl:param name="sourceElement"/>
<xsl:for-each select="$sourceElement">
<xsl:element name="dc:creator">
<xsl:if test="starts-with(./@id, 'http://orcid.org')">
<xsl:attribute name="nameIdentifierScheme">
<xsl:text>ORCID</xsl:text>
</xsl:attribute>
<xsl:attribute name="schemeURI">
<xsl:text>http://orcid.org/</xsl:text>
</xsl:attribute>
<xsl:attribute name="nameIdentifier">
<xsl:value-of select="substring-after(./@id, 'http://orcid.org/')"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!--
<xsl:template match="dri:objIdentifier">
<xsl:variable name="objIdentifier" select="substring-after(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/>
<xsl:variable name="nsPrefix" select="key('kCodeByName', $repoCode, $vCodes)/@value"/>
<xsl:if test="string-length($nsPrefix) = 0">
<xsl:call-template name="terminate"/>
</xsl:if>
<xsl:copy>
<xsl:value-of select="concat( $nsPrefix , '::', transformExt:md5Hex(string($objIdentifier)))"/>
</xsl:copy>
</xsl:template>
-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

@ -1,4 +1,7 @@
<configuration>
<!-- OCEAN -->
<property>
<name>jobTracker</name>
<value>yarnRM</value>
@ -7,14 +10,6 @@
<name>nameNode</name>
<value>hdfs://nameservice1</value>
</property>
<property>
<name>oozie.use.system.libpath</name>
<value>true</value>
</property>
<property>
<name>oozie.action.sharelib.for.spark</name>
<value>spark2</value>
</property>
<property>
<name>hive_metastore_uris</name>
<value>thrift://iis-cdh5-test-m3.ocean.icm.edu.pl:9083</value>
@ -23,6 +18,41 @@
<name>spark2YarnHistoryServerAddress</name>
<value>http://iis-cdh5-test-gw.ocean.icm.edu.pl:18089</value>
</property>
<!-- GARR -->
<!-- <property>-->
<!-- <name>jobTracker</name>-->
<!-- <value>yarn</value>-->
<!-- </property>-->
<!-- <property>-->
<!-- <name>nameNode</name>-->
<!-- <value>hdfs://hadoop-rm1.garr-pa1.d4science.org:8020</value>-->
<!-- </property>-->
<!-- <property>-->
<!-- <name>hive_metastore_uris</name>-->
<!-- <value>thrift://hadoop-edge3.garr-pa1.d4science.org:9083</value>-->
<!-- </property>-->
<!-- <property>-->
<!-- <name>spark2YarnHistoryServerAddress</name>-->
<!-- <value>http://hadoop-rm2.garr-pa1.d4science.org:19888</value>-->
<!-- </property>-->
<property>
<name>oozie.launcher.mapreduce.user.classpath.first</name>
<value>true</value>
</property>
<property>
<name>oozie.use.system.libpath</name>
<value>true</value>
</property>
<property>
<name>oozie.action.sharelib.for.spark</name>
<value>spark2</value>
</property>
<property>
<name>spark2EventLogDir</name>
<value>/user/spark/spark2ApplicationHistory</value>

@ -49,6 +49,7 @@ import eu.dnetlib.dhp.oa.provision.model.XmlInstance;
import eu.dnetlib.dhp.schema.common.*;
import eu.dnetlib.dhp.schema.oaf.*;
import eu.dnetlib.dhp.schema.oaf.Result;
import eu.dnetlib.dhp.schema.oaf.Software;
import eu.dnetlib.dhp.schema.oaf.utils.IdentifierFactory;
public class XmlRecordFactory implements Serializable {

Loading…
Cancel
Save