Skip to content

Commit

Permalink
MIR-1247 better fix to filter mods:role
Browse files Browse the repository at this point in the history
  • Loading branch information
yagee-de authored and kkrebs committed Oct 20, 2023
1 parent 13404bd commit 6ff8cac
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion mir-module/src/main/resources/xsl/editor/mods2xeditor.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<xsl:param name="WebApplicationBaseURL" />
<xsl:param name="MIR.PPN.DatabaseList" select="'gvk'" />

<xsl:variable name="marcrelator" select="document('classification:metadata:-1:children:marcrelator')" />

<!-- put value string (after authority URI) in attribute valueURIxEditor, but only if it contains # -->
<xsl:template match="@valueURI">
<xsl:choose>
Expand Down Expand Up @@ -119,14 +121,40 @@
</xsl:copy>
</xsl:template>

<xsl:template match="mods:role[preceding-sibling::mods:role]">
<xsl:template match="mods:role[$marcrelator//category/@ID = mods:roleTerm[@authority='marcrelator']/text()][1]">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>

<xsl:template match="mods:role[position() = last()]">
<xsl:choose>
<xsl:when test="preceding-sibling::mods:role[$marcrelator//category/@ID = mods:roleTerm[@authority='marcrelator']/text()][1]">
<xsl:comment>removed additional role due to MIR-1247</xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="mods:role">
<xsl:comment>removed additional role due to MIR-1247</xsl:comment>
</xsl:template>

<xsl:template match="mods:roleTerm[@authority and @authority != 'marcrelator']">
<xsl:comment>removed additional roleTerm due to MIR-1247</xsl:comment>
</xsl:template>

<xsl:template match="mods:roleTerm[@authority = 'marcrelator' and not($marcrelator//category/@ID = text())]">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:text>oth</xsl:text>
</xsl:copy>
</xsl:template>

<!-- Remove this mods:classification entry, will be created again while saving using mods:accessCondtition (see MIR-161) -->
<xsl:template match="mods:classification[@authority='accessRestriction']">
<!-- do nothing -->
Expand Down

0 comments on commit 6ff8cac

Please sign in to comment.