Skip to content

Commit

Permalink
MIR-1243 support mods:note with no type or uri attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
maria-tn authored and yagee-de committed Aug 14, 2024
1 parent 7942db3 commit ede163a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2008,10 +2008,13 @@
</label>
<div class="col-md-6">
<xed:bind xpath="@type">
<select class="form-control" style="font-weight:bold;">
<xed:include uri="xslStyle:items2options,convertClassificationOptions:classification:editor:-1:children:noteTypes" />
<select class="form-control">
<option value="">
<xed:output i18n="mir.select"/>
</option>
<xed:include uri="xslStyle:items2options,convertClassificationOptions:classification:editor:-1:children:noteTypes" />
</select>
</xed:bind>
</xed:bind >
</div>
<mir:help-pmud help-text="{i18n:mir.help.comment.type}" pmud="true" />
</div>
Expand Down
37 changes: 23 additions & 14 deletions mir-module/src/main/resources/xsl/metadata/mir-metadata-box.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -294,20 +294,29 @@
<xsl:apply-templates mode="present"
select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods/mods:extension[@displayLabel='characteristics']"/>
<xsl:for-each select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods/mods:note">
<xsl:variable name="myURI"
select="concat('classification:metadata:0:children:noteTypes:',mcrxsl:regexp(@type,' ', '_'))"/>
<xsl:variable name="x-access">
<xsl:value-of select="document($myURI)//label[@xml:lang='x-access']/@text"/>
</xsl:variable>
<xsl:variable name="noteLabel">
<xsl:value-of select="document($myURI)//category/label[@xml:lang=$CurrentLang]/@text"/>
</xsl:variable>
<xsl:if test="contains($x-access, 'guest')">
<xsl:call-template name="printMetaDate.mods">
<xsl:with-param select="." name="nodes"/>
<xsl:with-param select="$noteLabel" name="label"/>
</xsl:call-template>
</xsl:if>
<xsl:choose>
<xsl:when test="@type">
<xsl:variable name="myURI"
select="concat('classification:metadata:0:children:noteTypes:',mcrxsl:regexp(@type,' ', '_'))"/>
<xsl:variable name="x-access">
<xsl:value-of select="document($myURI)//label[@xml:lang='x-access']/@text"/>
</xsl:variable>
<xsl:variable name="noteLabel">
<xsl:value-of select="document($myURI)//category/label[@xml:lang=$CurrentLang]/@text"/>
</xsl:variable>
<xsl:if test="contains($x-access, 'guest')">
<xsl:call-template name="printMetaDate.mods">
<xsl:with-param select="." name="nodes"/>
<xsl:with-param select="$noteLabel" name="label"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="printMetaDate.mods">
<xsl:with-param select="." name="nodes"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
xmlns:mods="http://www.loc.gov/mods/v3">
<xsl:include href="copynodes.xsl" />

<xsl:template match="//mods:note[not(@type)]">
<mods:note>
<xsl:attribute name="type">admin</xsl:attribute>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</mods:note>
</xsl:template>

<xsl:template match="//mods:note[@type='mcr_intern' or @type='mcr intern']">
<mods:note>
<xsl:attribute name="type">admin</xsl:attribute>
Expand Down

0 comments on commit ede163a

Please sign in to comment.