Skip to content

Commit

Permalink
UBO-319 Added rfc5646.xml, added migrate-rfc4646-to-rfc5646.xsl, upda…
Browse files Browse the repository at this point in the history
…ted <xed:template id="languages"/> to use rfc5646 in import-editor.xed (#375)
  • Loading branch information
Possommi committed Apr 15, 2024
1 parent f1cdbe8 commit be1ebd1
Show file tree
Hide file tree
Showing 16 changed files with 42,275 additions and 34 deletions.
42,213 changes: 42,213 additions & 0 deletions ubo-cli/src/main/setup/classifications/rfc5646.xml

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions ubo-common/src/main/resources/META-INF/resources/import-editor.xed
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@
<xed:bind xpath="@xml:lang">
<select class="mycore-form-input-double custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc4646" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
</xed:bind>
</div>
Expand Down Expand Up @@ -780,13 +780,13 @@
<label for="{xed:generate-id()}" class="mycore-form-label">
<xed:output value="concat(i18n:translate('ubo.language'), ': ')" />
</label>
<xed:bind xpath="mods:languageTerm[@type='code'][@authority='rfc4646']">
<select id="{xed:generate-id(..)}" class="mycore-form-input custom-select">
<xed:bind xpath="mods:languageTerm[@type='code'][@authority='rfc5646']">
<select id="{xed:generate-id(..)}" class="autocomplete mycore-form-input custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc4646" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
</xed:bind>
<xed:controls />
Expand All @@ -803,10 +803,10 @@
</label>
<select class="mycore-form-input custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc4646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc4646" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
</xed:bind>
<xed:controls />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ UBO.System.ReadOnly=false
UBO.System.ReadOnly.Message=Aufgrund von Wartungsarbeiten ist das Erstellen oder Bearbeiten von Eintr\u00E4gen zurzeit gesperrt.

# Classification that contains all languages with codes and labels
MCR.LanguageClassification=rfc4646
MCR.LanguageClassification=rfc5646

# Caching Resolver
MCR.URIResolver.ModuleResolver.cache=org.mycore.ubo.CachingResolver
Expand All @@ -292,7 +292,7 @@ MCR.URIResolver.ModuleResolver.userconnection=org.mycore.ubo.UBOUserByConnection

# Sorting rules for MCRURIResolver
MCR.URIResolver.Classification.Sort.ORIGIN=false
MCR.URIResolver.Classification.Sort.rfc4646=true
MCR.URIResolver.Classification.Sort.rfc5646=true
MCR.URIResolver.Classification.Sort.marcrelator=false
MCR.URIResolver.Classification.Sort.oa=false

Expand Down
28 changes: 28 additions & 0 deletions ubo-common/src/main/resources/migrate-rfc4646-to-rfc5646.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select='@*|node()'/>
</xsl:copy>
</xsl:template>

<xsl:template match="mods:languageTerm[@authority = 'rfc4646'][@type = 'code']">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:choose>
<xsl:when test="text() = 'hr'">
<xsl:value-of select="'sh-hr'"/>
</xsl:when>
<xsl:when test="text() = 'id'">
<xsl:value-of select="'ms-id'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</mods:languageTerm>
</xsl:template>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/import/aleph2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@

<xsl:template match="varfield[@id='037']/subfield[@label='a']">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="document(concat('language:',.))/language/@xmlCode" />
</mods:languageTerm>
</mods:language>
Expand Down
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/import/alma2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<!-- Language -->
<xsl:template match="datafield[@tag='041']/subfield[@code='a']">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="document(concat('language:',.))/language/@xmlCode" />
</mods:languageTerm>
</mods:language>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@

<xsl:template match="sprache">
<mods:language>
<mods:languageTerm type="code" authority="rfc4646">
<mods:languageTerm type="code" authority="rfc5646">
<xsl:value-of select="text()" />
</mods:languageTerm>
</mods:language>
Expand Down
4 changes: 2 additions & 2 deletions ubo-common/src/main/resources/xsl/import/datacite2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<xsl:template match="language">
<xsl:for-each select="document(concat('notnull:language:',.))/language/@xmlCode">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="." />
</mods:languageTerm>
</mods:language>
Expand All @@ -113,4 +113,4 @@

<xsl:template match="@*|*" />

</xsl:stylesheet>
</xsl:stylesheet>
4 changes: 2 additions & 2 deletions ubo-common/src/main/resources/xsl/import/evaluna2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@
<xsl:template match="language">
<!-- Find language with matching label in any language, or with matching ID in any supported code schema -->
<xsl:variable name="given" select="translate(text(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />
<xsl:for-each select="document('classification:metadata:-1:children:rfc4646')/mycoreclass/categories/category[@ID=$given or label[translate(@text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=$given]][1]">
<xsl:for-each select="document('classification:metadata:-1:children:rfc5646')/mycoreclass/categories/category[@ID=$given or label[translate(@text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=$given]][1]">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="@ID" />
</mods:languageTerm>
</mods:language>
Expand Down
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/import/lobid2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@

<xsl:template match="mab:datafield[@tag='037']/mab:subfield[@code='a']">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="document(concat('language:',.))/language/@xmlCode" />
</mods:languageTerm>
</mods:language>
Expand Down
4 changes: 2 additions & 2 deletions ubo-common/src/main/resources/xsl/import/pubmed2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

<xsl:template match="language/@xmlCode">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="." />
</mods:languageTerm>
</mods:language>
Expand Down Expand Up @@ -248,4 +248,4 @@
<xsl:apply-templates />
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/import/scopus2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

<xsl:template match="scopus:language">
<mods:language>
<mods:languageTerm authority="rfc4646" type="code">
<mods:languageTerm authority="rfc5646" type="code">
<xsl:value-of select="document(concat('language:',@xml:lang))/language/@xmlCode" />
</mods:languageTerm>
</mods:language>
Expand Down
6 changes: 3 additions & 3 deletions ubo-common/src/main/resources/xsl/import/zdb2mods.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@

<xsl:template match="marc:datafield[@tag='041']">
<mods:language>
<mods:languageTerm type="code" authority="rfc4646">
<mods:languageTerm type="code" authority="rfc5646">
<xsl:variable name="given" select="translate(marc:subfield[@code='a'],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />
<xsl:value-of select="document('classification:metadata:-1:children:rfc4646')/mycoreclass/categories/category[@ID=$given or label[translate(@text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=$given]][1]/@ID" />
<xsl:value-of select="document('classification:metadata:-1:children:rfc5646')/mycoreclass/categories/category[@ID=$given or label[translate(@text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=$given]][1]/@ID" />
</mods:languageTerm>
</mods:language>
</xsl:template>

<xsl:template match="*" />

</xsl:stylesheet>
</xsl:stylesheet>
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/mods-dc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

<!-- DC.Language -->

<xsl:template match="mods:languageTerm[@authority='rfc4646'][@type='code']" mode="dc">
<xsl:template match="mods:languageTerm[@authority='rfc5646'][@type='code']" mode="dc">
<dc:language>
<xsl:value-of select="document(concat('language:',.))/language/@termCode" />
</dc:language>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<xsl:call-template name="copy-and-apply" />
</xsl:template>

<xsl:template match="mods:language|mods:languageTerm[@type='code'][@authority='rfc4646']|mods:languageTerm/@type|mods:languageTerm/@authority">
<xsl:template match="mods:language|mods:languageTerm[@type='code'][@authority='rfc5646']|mods:languageTerm/@type|mods:languageTerm/@authority">
<xsl:call-template name="copy-and-apply" />
</xsl:template>

Expand Down
4 changes: 2 additions & 2 deletions ubo-common/src/main/resources/xsl/mods-qdc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@

<!-- language -->

<xsl:template match="mods:languageTerm[@authority='rfc4646'][@type='code']" mode="qdc">
<dcterms:language scheme="dcterms:RFC4646">
<xsl:template match="mods:languageTerm[@authority='rfc5646'][@type='code']" mode="qdc">
<dcterms:language scheme="dcterms:RFC5646">
<xsl:value-of select="text()" />
</dcterms:language>
</xsl:template>
Expand Down

0 comments on commit be1ebd1

Please sign in to comment.