mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Translate underscores to dashes in xml:lang attr for DIM2DataCite.xsl
Modified the DataCite crosswalk to ensure that the xml:lang attribute translates any underscores in the value of @lang to dashes. This change aligns the attribute formatting with standard language code conventions.
(cherry picked from commit a898afd5ac
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
7cbd12a19c
commit
175c3d54cd
@@ -25,6 +25,10 @@
|
||||
to register DOIs anymore. Please follow and reuse the examples
|
||||
included in this file. For more information on the DataCite
|
||||
Schema, see https://schema.datacite.org. -->
|
||||
<!-- Note regarding language codes: xml:lang regional language codes require a hyphen, whereas many
|
||||
repositories use underscores when storing these language codes (e.g. en_GB, de_CH).
|
||||
This template translates all underscores to hyphens when selecting value of @lang in an attribute
|
||||
so the output will be e.g. xml:lang="en-GB", xml:lang="de-CH". -->
|
||||
|
||||
<!-- We need the prefix to determine DOIs that were minted by ourself. -->
|
||||
<xsl:param name="prefix">10.5072/dspace-</xsl:param>
|
||||
@@ -362,20 +366,20 @@
|
||||
<!-- DataCite (3) :: Title -->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='title']">
|
||||
<xsl:element name="title">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:if test="@qualifier='alternative'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">AlternativeTitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<!-- DSpace does include niehter a dc.title.subtitle nor a
|
||||
<!-- DSpace doesn't include a dc.title.subtitle nor a
|
||||
dc.title.translated. If necessary, please create those in the
|
||||
metadata field registry. -->
|
||||
<xsl:if test="@qualifier='subtitle'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">Subtitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="@qualifier='translated'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">TranslatedTitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="." />
|
||||
@@ -394,7 +398,7 @@
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
<xsl:element name="subject">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:if test="@qualifier">
|
||||
<xsl:attribute name="subjectScheme"><xsl:value-of select="@qualifier" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
@@ -626,7 +630,7 @@
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='description' and (@qualifier='abstract' or @qualifier='tableofcontents' or not(@qualifier))]">
|
||||
<xsl:element name="description">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="descriptionType">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@qualifier='abstract'">Abstract</xsl:when>
|
||||
|
Reference in New Issue
Block a user