- use iso639-2 for language tag for dc:language

- list mn. 100 record for ListRecords request
- add header("Content-Type", "application/xml; charset=utf-8") inside oai.controller.ts
This commit is contained in:
Arno Kaimbacher 2022-11-29 11:37:20 +01:00
parent 6944deac83
commit 3e24bdd92f
7 changed files with 57 additions and 43 deletions

View File

@ -697,24 +697,23 @@
<!-- <gmd:onLine> -->
<xsl:template name="datacite_identifier">
<xsl:if test="
starts-with(Identifier/@Value, 'doi:') or
Identifier/@Type = 'Doi' or
starts-with(Identifier/@Value, 'http://')">
<xsl:for-each select="*[name() = 'Identifier']">
<xsl:variable name="identifier" select="."/>
<xsl:if test="starts-with($identifier/@Value, 'doi:') or $identifier/@Type = 'Doi' or starts-with($identifier/@Value, 'http://')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:choose>
<xsl:when test="starts-with(Identifier/@Value, 'doi:')">
<xsl:when test="starts-with($identifier/@Value, 'doi:')">
<!-- stower http auf https gesetzt -->
<xsl:value-of select="concat('http://dx.doi.org/', substring-after(Identifier/@Value, 'doi:'))"/>
<xsl:value-of select="concat('http://dx.doi.org/', substring-after($identifier/@Value, 'doi:'))"/>
</xsl:when>
<xsl:when test="Identifier/@Type = 'Doi'">
<xsl:value-of select="concat('http://dx.doi.org/', normalize-space(Identifier/@Value))"/>
<xsl:when test="$identifier/@Type = 'Doi'">
<xsl:value-of select="concat('http://dx.doi.org/', normalize-space($identifier/@Value))"/>
</xsl:when>
<xsl:when test="starts-with(Identifier/@Value, 'http://')">
<xsl:value-of select="normalize-space(Identifier/@Value)"/>
<xsl:when test="starts-with($identifier/@Value, 'http://')">
<xsl:value-of select="normalize-space($identifier/@Value)"/>
</xsl:when>
</xsl:choose>
</gmd:URL>
@ -737,6 +736,7 @@
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- <gmd:onLine> -->

8
assets/langCodeMap.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- langCodeMap.xml -->
<langCodeMap>
<langCode iso639-1="de" iso639-2="ger"/>
<langCode iso639-1="en" iso639-2="eng"/>
<langCode iso639-1="es" iso639-2="spa"/>
<langCode iso639-1="it" iso639-2="ita"/>
</langCodeMap>

View File

@ -124,29 +124,32 @@
<!-- gmd:identifier -->
<!-- stower 2022, identifer gba https://doi.org/10.24341/tethys.53 -->
<gmd:identifier>
<xsl:for-each select="*[name() = 'Identifier']">
<!-- <xsl:variable name="datacite-identifier" select="Identifier[@Type = 'Doi']"/> -->
<xsl:variable name="datacite-identifier" select=".[@Type = 'Doi']"/>
<xsl:if test="string-length(.[@Type = 'Doi']/@Value) &gt; 0 and count([.[@Type = 'Doi']/@Type = 'Doi']) &gt; 0">
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:variable name="datacite-identifier" select="Identifier[@Type = 'Doi']"/>
<xsl:if test="string-length($datacite-identifier/@Value) &gt; 0 and count([$datacite-identifier/@Type = 'Doi']) &gt; 0">
<xsl:choose>
<xsl:when test="starts-with($datacite-identifier/@Value, 'doi:') or contains($datacite-identifier/@Value, 'doi.org')">
<xsl:value-of select="$datacite-identifier/@Value"/>
<xsl:when test="starts-with(.[@Type = 'Doi']/@Value, 'doi:') or contains(.[@Type = 'Doi']/@Value, 'doi.org')">
<xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:when>
<xsl:when test="count($datacite-identifier[@Type = 'Doi']) &gt; 0 and $datacentre='Tethys RDR'">
<xsl:when test="count(.[@Type = 'Doi']) &gt; 0 and $datacentre='Tethys RDR'">
<xsl:value-of select="concat(
'https://doi.org/',
string($datacite-identifier/@Value)
string(.[@Type = 'Doi']/@Value)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$datacite-identifier/@Value"/>
<xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</xsl:if>
</xsl:for-each>
</gmd:identifier>
<!-- gmd:citedResponsibleParty - creator -->

View File

@ -34,7 +34,7 @@
<xsl:param name="oai_error_code" />
<xsl:param name="oai_error_message" />
<xsl:param name="baseURL" />
<xsl:param name="setPubType" />
<!-- <xsl:param name="setPubType" />
<xsl:param name="downloadLink" />
<xsl:param name="doiLink" />
<xsl:param name="docId" />
@ -43,7 +43,9 @@
<xsl:param name="oai_identifier" />
<xsl:param name="oai_from" />
<xsl:param name="oai_until" />
<xsl:param name="oai_set" />
<xsl:param name="oai_set" /> -->
<xsl:variable name="langCodes" select="document('assets/langCodeMap.xml')/langCodeMap/langCode"/>
<!--create the head of oai response -->
<xsl:template match="/root">
@ -52,8 +54,7 @@
<xsl:text>type="text/xsl" href="../assets/oai2_style.xslt" title="Defaultstyle"</xsl:text>
</xsl:processing-instruction>
<OAI-PMH xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.openarchives.org/OAI/2.0/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<OAI-PMH xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>
<xsl:value-of select="$responseDate" />
</responseDate>
@ -635,8 +636,10 @@
</xsl:template>
<xsl:template match="@Language" mode="oai_dc">
<xsl:variable name="language" select="string(.)"/>
<dc:language>
<xsl:value-of select="." />
<!-- <xsl:value-of select="." /> -->
<xsl:value-of select="$langCodes[@iso639-1 = $language]/@iso639-2" />
</dc:language>
</xsl:template>

View File

@ -1,7 +1,7 @@
const config = {
max: {
listidentifiers: 100,
listrecords: 50,
listrecords: 100,
},
workspacePath: "workspace",
};

File diff suppressed because one or more lines are too long

View File

@ -95,7 +95,7 @@ export class OaiController {
oaiRequest = request.query;
} else {
this.xsltParameter["oai_error_code"] = "unknown";
this.xsltParameter["oai_error_message"] = "An internal error occured.";
this.xsltParameter["oai_error_message"] = "Only POST and GET methods are allowed for OAI-PMH.";
}
// const oaiRequest: OaiParameter = request.body;
try {
@ -157,7 +157,7 @@ export class OaiController {
}
response
.header("Content-Type", "application/xml")
.header("Content-Type", "application/xml; charset=utf-8")
.header("Access-Control-Allow-Origin", "*")
.header("Access-Control-Allow-Methods", "GET,POST");
response.status(StatusCodes.OK).send(xmlOutput);