Commit 6324a215 authored by Jakowatz, Stefan's avatar Jakowatz, Stefan
Browse files

SAH und FQS

parent 9338c995
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:cc="http://www.d-nb.de/standards/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:ddb="http://www.d-nb.de/standards/ddb/"
xmlns:dini="http://www.d-nb.de/standards/xmetadissplus/type/"
xmlns:doi="http://www.d-nb.de/standards/doi/"
xmlns:hdl="http://www.d-nb.de/standards/hdl/"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:nlm="http://dtd.nlm.nih.gov/publishing/2.3"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:pc="http://www.d-nb.de/standards/pc/"
xmlns:thesis="http://www.ndltd.org/standards/metadata/etdms/1.0/"
xmlns:urn="http://www.d-nb.de/standards/urn/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xMetaDiss="http://www.d-nb.de/standards/xmetadissplus/"
xmlns:xoai="http://www.lyncode.com/xoai"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:zoai="http://git.gesis.org/dda/zoai">
<xsl:output indent="yes" />
<xsl:strip-space elements="*" />
<!-- <xsl:copy-of select="."/> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of
select='text()' /> </xsl:message> -->
<!-- override default template -->
<xsl:template match="*" />
<xsl:template match="/">
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:apply-templates
select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template
match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.rights.licence'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'20'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.source.journal'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="'Studies in Arts and Humanities'" />
</xsl:call-template>
<!-- xsl:call-template name="new-metadatum"> <xsl:with-param name="key"
select="'internal.identifier.journal'"/> <xsl:with-param name="language"
select="''"/> <xsl:with-param name="value" select="'1690'"/> </xsl:call-template -->
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.pubstatus'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'1'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.publisher.country'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'IRL'" />
</xsl:call-template>
<!-- <xsl:call-template name="new-metadatum"> <xsl:with-param name="key"
select="'ssoar.urn.registration'"/> <xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'false'"/> </xsl:call-template> -->
<xsl:choose>
<xsl:when
test="contains(./dc:type[@xml:lang='en-US'], 'Editorial')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.review'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'2'" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.review'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'1'" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'ssoar.urn.registration'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'false'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.identifier.issn'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'2009-8278'" />
</xsl:call-template>
<!-- xsl:call-template name="new-metadatum"> <xsl:with-param name="key"
select="'internal.identifier.ddc'"/> <xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/> </xsl:call-template> <xsl:call-template
name="new-metadatum"> <xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/> <xsl:with-param name="value"
select="'300'"/> </xsl:call-template -->
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.status'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="'formal und inhaltlich fertig erschlossen'" />
</xsl:call-template>
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="dc:language">
<xsl:variable name="sanitizedLanguage"
select="zoai:sanitizeLanguage( text() )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.language'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="$sanitizedLanguage" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:creator">
<xsl:choose>
<xsl:when test="contains(text(), ';')">
<xsl:variable name="tokenizedAuthors"
select="tokenize(text(),';')" />
<xsl:for-each select="$tokenizedAuthors">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.contributor.author'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="normalize-space(.)" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.contributor.author'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="text()" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="dc:date">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.date.issued'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="substring(text(),1,4)" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='pl-PL']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.abstract'" />
<xsl:with-param name="language" select="'pl'" />
<xsl:with-param name="value"
select="normalize-space(replace(text(),'[»«]','&quot;'))" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='en-US']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.description.abstract'" />
<xsl:with-param name="language" select="'en'" />
<xsl:with-param name="value"
select="normalize-space(replace(text(),'[»«]','&quot;'))" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:source[@xml:lang='en-US']">
<xsl:variable name="pageinfo"
select="tokenize( text(),'; ' )[last()]" />
<xsl:if
test="$pageinfo != '' and matches($pageinfo, '^\d+(-\d+)?')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.source.pageinfo'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="$pageinfo" />
</xsl:call-template>
</xsl:if>
<xsl:variable name="issue"
select="substring-before(substring-after(text(),'No '),'(')" />
<xsl:if test="$issue != '' and matches ($issue, '\d+')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.issue'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="normalize-space($issue)" />
</xsl:call-template>
</xsl:if>
<xsl:variable name="volume"
select="substring-before(substring-after(text(),'Vol '),',')" />
<xsl:if test="$volume != '' and matches ($volume, '\d+')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.source.volume'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="normalize-space($volume)" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="dc:subject[@xml:lang='en-US']">
<xsl:choose>
<xsl:when test="contains(text(), ';')">
<xsl:variable name="tokenizedSubject"
select="tokenize(text(),';')" />
<xsl:for-each select="$tokenizedSubject">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.subject.other'" />
<xsl:with-param name="language" select="'en'" />
<xsl:with-param name="value"
select="normalize-space(.)" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.subject.other'" />
<xsl:with-param name="language" select="'en'" />
<xsl:with-param name="value" select="text()" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="text()='book review'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.stock'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'recension'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.type.document'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'23'" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.stock'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'article'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.type.document'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'32'" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.stock'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'article'" />
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.document'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="'32'" />
</xsl:call-template>
</xsl:template>
<xsl:template
match="dc:identifier[matches(text(), '^10\..*')]">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.identifier.doi'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value"
select="concat('https://doi.org/', text())" />
</xsl:call-template>
</xsl:template>
<xsl:template
match="dc:identifier[matches(text(), 'sahjournal.com')]">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.identifier.url'" />
<xsl:with-param name="language" select="''" />
<xsl:with-param name="value" select="text()" />
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:title">
<xsl:variable name="sanitizedLanguage"
select="zoai:sanitizeLanguage( @xml:lang )" />
<xsl:variable name="sanitizedMainLanguage"
select="zoai:sanitizeLanguage( /oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:language )" />
<xsl:choose>
<xsl:when test="$sanitizedLanguage = $sanitizedMainLanguage">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'" />
<xsl:with-param name="language"
select="$sanitizedLanguage" />
<xsl:with-param name="value"
select="replace(text(), '\.$','')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key"
select="'dc.title.alternative'" />
<xsl:with-param name="language"
select="$sanitizedLanguage" />
<xsl:with-param name="value"
select="replace(text(), '\.$','')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="new-metadatum">
<xsl:param name="key" />
<xsl:param name="language" />
<xsl:param name="value" />
<xsl:element name="metadatum">
<xsl:element name="key">
<xsl:value-of select="$key" />
</xsl:element>
<xsl:if test="$language != ''">
<xsl:variable name="sanitizedLanguage"
select="zoai:sanitizeLanguage($language)" />
<xsl:element name="language">
<xsl:value-of select="$sanitizedLanguage" />
</xsl:element>
</xsl:if>
<xsl:element name="value">
<xsl:value-of select="$value" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:function name="zoai:sanitizeLanguage">
<xsl:param name="inputLanguage" />
<xsl:choose>
<xsl:when
test="$inputLanguage = 'ger' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE' or $inputLanguage = 'deu'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when
test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:when
test="$inputLanguage = 'pol' or $inputLanguage = 'PL' or $inputLanguage = 'pl-PL'">
<xsl:value-of select="'pl'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$inputLanguage" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment