- 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> --> <!-- <gmd:onLine> -->
<xsl:template name="datacite_identifier"> <xsl:template name="datacite_identifier">
<xsl:if test=" <xsl:for-each select="*[name() = 'Identifier']">
starts-with(Identifier/@Value, 'doi:') or <xsl:variable name="identifier" select="."/>
Identifier/@Type = 'Doi' or <xsl:if test="starts-with($identifier/@Value, 'doi:') or $identifier/@Type = 'Doi' or starts-with($identifier/@Value, 'http://')">
starts-with(Identifier/@Value, 'http://')">
<gmd:onLine> <gmd:onLine>
<gmd:CI_OnlineResource> <gmd:CI_OnlineResource>
<gmd:linkage> <gmd:linkage>
<gmd:URL> <gmd:URL>
<xsl:choose> <xsl:choose>
<xsl:when test="starts-with(Identifier/@Value, 'doi:')"> <xsl:when test="starts-with($identifier/@Value, 'doi:')">
<!-- stower http auf https gesetzt --> <!-- 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>
<xsl:when test="Identifier/@Type = 'Doi'"> <xsl:when test="$identifier/@Type = 'Doi'">
<xsl:value-of select="concat('http://dx.doi.org/', normalize-space(Identifier/@Value))"/> <xsl:value-of select="concat('http://dx.doi.org/', normalize-space($identifier/@Value))"/>
</xsl:when> </xsl:when>
<xsl:when test="starts-with(Identifier/@Value, 'http://')"> <xsl:when test="starts-with($identifier/@Value, 'http://')">
<xsl:value-of select="normalize-space(Identifier/@Value)"/> <xsl:value-of select="normalize-space($identifier/@Value)"/>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</gmd:URL> </gmd:URL>
@ -737,6 +736,7 @@
</gmd:CI_OnlineResource> </gmd:CI_OnlineResource>
</gmd:onLine> </gmd:onLine>
</xsl:if> </xsl:if>
</xsl:for-each>
</xsl:template> </xsl:template>
<!-- <gmd:onLine> --> <!-- <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 --> <!-- gmd:identifier -->
<!-- stower 2022, identifer gba https://doi.org/10.24341/tethys.53 --> <!-- stower 2022, identifer gba https://doi.org/10.24341/tethys.53 -->
<gmd:identifier> <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:MD_Identifier>
<gmd:code> <gmd:code>
<gco:CharacterString> <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:choose>
<xsl:when test="starts-with($datacite-identifier/@Value, 'doi:') or contains($datacite-identifier/@Value, 'doi.org')"> <xsl:when test="starts-with(.[@Type = 'Doi']/@Value, 'doi:') or contains(.[@Type = 'Doi']/@Value, 'doi.org')">
<xsl:value-of select="$datacite-identifier/@Value"/> <xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:when> </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( <xsl:value-of select="concat(
'https://doi.org/', 'https://doi.org/',
string($datacite-identifier/@Value) string(.[@Type = 'Doi']/@Value)
)"/> )"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$datacite-identifier/@Value"/> <xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:if>
</gco:CharacterString> </gco:CharacterString>
</gmd:code> </gmd:code>
</gmd:MD_Identifier> </gmd:MD_Identifier>
</xsl:if>
</xsl:for-each>
</gmd:identifier> </gmd:identifier>
<!-- gmd:citedResponsibleParty - creator --> <!-- gmd:citedResponsibleParty - creator -->

View File

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

View File

@ -1,7 +1,7 @@
const config = { const config = {
max: { max: {
listidentifiers: 100, listidentifiers: 100,
listrecords: 50, listrecords: 100,
}, },
workspacePath: "workspace", 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; oaiRequest = request.query;
} else { } else {
this.xsltParameter["oai_error_code"] = "unknown"; 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; // const oaiRequest: OaiParameter = request.body;
try { try {
@ -157,7 +157,7 @@ export class OaiController {
} }
response response
.header("Content-Type", "application/xml") .header("Content-Type", "application/xml; charset=utf-8")
.header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Origin", "*")
.header("Access-Control-Allow-Methods", "GET,POST"); .header("Access-Control-Allow-Methods", "GET,POST");
response.status(StatusCodes.OK).send(xmlOutput); response.status(StatusCodes.OK).send(xmlOutput);