Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIR-1247 add filter for additional mods:role and mods:roleTermin #910

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions 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,6 +121,40 @@
</xsl:copy>
</xsl:template>

<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
Loading