Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions mir-module/src/main/resources/config/mir/mycore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ MIR.Layout.Abstract.Type.Classification=

MIR.NotFullAccessInfo.Genres=
MIR.Viewer.DisableDerivateType=thumbnail

# Controls whether specific metadata should be displayed on blocked document pages. (title, authors, date, identifier)
MIR.Blocked.Detailpage=false
##############################################################################
# Canonical link for any metadata frontpage #
##############################################################################
Expand Down
29 changes: 5 additions & 24 deletions mir-module/src/main/resources/xsl/e-mail-events.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<xsl:variable name="newline" select="'&#xA;'" />
<xsl:variable name="categories" select="document('classification:metadata:1:children:mir_institutes')/mycoreclass/categories" />
<xsl:variable name="institutemember" select="$categories/category[mcrxsl:isCurrentUserInRole(concat('mir_institutes:',@ID))]" />

<xsl:include href="import/helperTemplates.xsl" />
<xsl:template match="/">
<xsl:message>
type:
Expand Down Expand Up @@ -121,7 +121,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="', '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printPersonName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="concat('Autor(en) : ',$authors,$newline)" />
Expand Down Expand Up @@ -231,26 +233,5 @@
<xsl:value-of select="concat(' (',@valueURI,')')" />
</xsl:template>

<!-- Names -->
<xsl:template match="mods:name" mode="printName">
<xsl:choose>
<xsl:when test="mods:namePart">
<xsl:choose>
<xsl:when test="mods:namePart[@type='given'] and mods:namePart[@type='family']">
<xsl:value-of select="concat(mods:namePart[@type='family'], ', ',mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="mods:displayForm">
<xsl:value-of select="mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
28 changes: 28 additions & 0 deletions mir-module/src/main/resources/xsl/import/helperTemplates.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:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mods="http://www.loc.gov/mods/v3"
exclude-result-prefixes="mods">
<!-- Names -->
<xsl:template name="printPersonName">
<xsl:param name="node" />
<xsl:choose>
<xsl:when test="$node/mods:namePart">
<xsl:choose>
<xsl:when test="$node/mods:namePart[@type='given'] and $node/mods:namePart[@type='family']">
<xsl:value-of select="concat($node/mods:namePart[@type='family'], ', ', $node/mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$node/mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$node/mods:displayForm">
<xsl:value-of select="$node/mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$node" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
170 changes: 154 additions & 16 deletions mir-module/src/main/resources/xsl/metadata/mods-metadata.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
xmlns:encoder="xalan://java.net.URLEncoder"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
exclude-result-prefixes=" i18n mods mcrmods mcrxsl xlink encoder">

<xsl:import href="xslImport:modsmeta" />
<xsl:include href="layout/mir-layout-utils.xsl" />
<xsl:include href="import/helperTemplates.xsl" />
<xsl:include href="mods-utils.xsl" />
<xsl:include href="mir-mods-utils.xsl" />
<xsl:key use="@id" name="rights" match="/mycoreobject/rights/right" />
<xsl:param name="MCR.DOI.Resolver.MasterURL" select="''"/>
<xsl:param name="MCR.URN.Resolver.MasterURL" select="''"/>
<xsl:param name="MIR.Blocked.Detailpage" select="'false'"/>
<xsl:variable name="mods-type">
<xsl:apply-templates mode="mods-type" select="." />
</xsl:variable>
Expand Down Expand Up @@ -74,22 +79,33 @@
</site>
</xsl:template>

<xsl:template name="printMirMessage">
<xsl:param name="title" />
<xsl:param name="msg" />
<div id="mir-message">
<div class="jumbotron">
<h1>
<xsl:value-of select="$title" />
</h1>
<xsl:if test="$msg">
<p>
<xsl:copy-of select="$msg" />
</p>
</xsl:if>
</div>
</div>
</xsl:template>
<xsl:template name="printMirMessage">
<xsl:param name="title" />
<xsl:param name="msg" />
<div id="mir-message">
<div class="jumbotron">
<h1>
<xsl:value-of select="$title" />
</h1>
<xsl:if test="$msg">
<p>
<xsl:copy-of select="$msg" />
</p>
</xsl:if>
<xsl:if test="$MIR.Blocked.Detailpage = 'true'">
<xsl:call-template name="renderMetadata">
<xsl:with-param name="mods"
select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods"/>
<xsl:with-param name="doiResolver" select="$MCR.DOI.Resolver.MasterURL" />
<xsl:with-param name="urnResolver" select="$MCR.URN.Resolver.MasterURL" />
</xsl:call-template>
<xsl:call-template name="printPersonName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:if>
</div>
</div>
</xsl:template>

<xsl:template name="debug-rights">
<xsl:variable name="lbr" select="'&#x0a;'" />
Expand Down Expand Up @@ -182,4 +198,126 @@
</a>
</xsl:template>


<!-- Main template: rendering -->
<xsl:template name="renderMetadata">
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The renderMetadata template is fairly large and includes hard-coded HTML structure. Consider breaking it into smaller sub-templates or adding comments to improve readability and maintainability.

Copilot uses AI. Check for mistakes.
<xsl:param name="mods" select="mycoreobject/metadata/def.modsContainer/modsContainer/mods:mods"/>
<xsl:param name="doiResolver" select="$MCR.DOI.Resolver.MasterURL"/>
<xsl:param name="urnResolver" select="$MCR.URN.Resolver.MasterURL"/>

<!-- Card for metadata -->
<div class="card shadow-sm mb-4 ">
<div class="card-body">

<!-- Title + contributors -->
<xsl:call-template name="renderTitleAndContributors">
<xsl:with-param name="mods" select="$mods"/>
</xsl:call-template>

<!-- Metadata list as Bootstrap description list -->
<dl class="row mt-3 mb-0">
<xsl:call-template name="renderDateIssued">
<xsl:with-param name="mods" select="$mods"/>
</xsl:call-template>
<xsl:call-template name="renderDOI">
<xsl:with-param name="mods" select="$mods"/>
<xsl:with-param name="doiResolver" select="$doiResolver"/>
</xsl:call-template>
<xsl:call-template name="renderURN">
<xsl:with-param name="mods" select="$mods"/>
<xsl:with-param name="urnResolver" select="$urnResolver"/>
</xsl:call-template>
</dl>

</div>
</div>
</xsl:template>

<!-- Title and contributors -->
<xsl:template name="renderTitleAndContributors">
<xsl:param name="mods"/>

<h2 class="card-title text-primary mb-2">
<xsl:value-of select="$mods/mods:titleInfo/mods:title"/>
</h2>

<div class="text-muted small">
<xsl:choose>
<!-- Authors -->
<xsl:when test="$mods/mods:name[mods:role/mods:roleTerm/text()='aut']">
<xsl:for-each select="$mods/mods:name[mods:role/mods:roleTerm/text()='aut']">
<xsl:if test="position()!=1">
<xsl:value-of select="'; '"/>
</xsl:if>
<xsl:apply-templates select="." mode="mirNameLink"/>
<xsl:if test="mods:etal">
<em> et.al.</em>
</xsl:if>
</xsl:for-each>
</xsl:when>

<!-- Editors -->
<xsl:when test="$mods/mods:name[mods:role/mods:roleTerm/text()='edt']">
<xsl:for-each select="$mods/mods:name[mods:role/mods:roleTerm/text()='edt']">
<xsl:if test="position()!=1">
<xsl:value-of select="'; '"/>
</xsl:if>
<xsl:apply-templates select="." mode="mirNameLink"/>
<xsl:text> </xsl:text>
<xsl:value-of select="i18n:translate('mir.abstract.editor')"/>
<xsl:if test="mods:etal">
<em> et.al.</em>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</div>
</xsl:template>

<!-- Date issued -->
<xsl:template name="renderDateIssued">
<xsl:param name="mods"/>
<xsl:if test="$mods/mods:originInfo/mods:dateIssued">
<dt class="col-sm-3 fw-bold">
<xsl:value-of select="i18n:translate('component.mods.metaData.dictionary.dateIssued')"/>
</dt>
<dd class="col-sm-9">
<xsl:value-of select="$mods/mods:originInfo/mods:dateIssued"/>
</dd>
</xsl:if>
</xsl:template>

<!-- DOI -->
<xsl:template name="renderDOI">
<xsl:param name="mods"/>
<xsl:param name="doiResolver"/>
<xsl:if test="$mods/mods:identifier[@type='doi']">
<dt class="col-sm-3 fw-bold">
<xsl:value-of select="i18n:translate('mir.identifier.doi')"/>
</dt>
<dd class="col-sm-9">
<a class="text-decoration-none" href="{concat($doiResolver, '/', $mods/mods:identifier[@type='doi'])}">
<xsl:value-of select="$mods/mods:identifier[@type='doi']"/>
</a>
</dd>
</xsl:if>
</xsl:template>

<!-- URN -->
<xsl:template name="renderURN">
<xsl:param name="mods"/>
<xsl:param name="urnResolver"/>
<xsl:if test="$mods/mods:identifier[@type='urn']">
<dt class="col-sm-3 fw-bold">
<xsl:value-of select="i18n:translate('mir.identifier.urn')"/>
</dt>
<dd class="col-sm-9">
<a class="text-decoration-none" href="{concat($urnResolver, '/', $mods/mods:identifier[@type='urn'])}">
<xsl:value-of select="$mods/mods:identifier[@type='urn']"/>
</a>
</dd>
</xsl:if>
</xsl:template>


</xsl:stylesheet>
40 changes: 14 additions & 26 deletions mir-module/src/main/resources/xsl/mods2csv.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<xsl:stylesheet version="1.0" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xalan="http://xml.apache.org/xalan" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation" exclude-result-prefixes="xalan i18n">
<xsl:param name="CurrentLang" />

<xsl:include href="import/helperTemplates.xsl" />
<xsl:output
encoding="UTF-8"
media-type="text/csv"
Expand Down Expand Up @@ -43,7 +43,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -53,7 +55,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -63,7 +67,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand All @@ -78,7 +84,9 @@
<xsl:if test="position()!=1">
<xsl:value-of select="'; '" />
</xsl:if>
<xsl:apply-templates select="." mode="printName" />
<xsl:call-template name="printAuthorName">
<xsl:with-param name="node" select="mods:name" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>&quot;;</xsl:text>

Expand Down Expand Up @@ -231,27 +239,7 @@
</xsl:choose>
</xsl:template>

<!-- copied from modsmetadata.xsl -->
<xsl:template match="mods:name" mode="printName">
<xsl:choose>
<xsl:when test="mods:namePart">
<xsl:choose>
<xsl:when test="mods:namePart[@type='given'] and mods:namePart[@type='family']">
<xsl:value-of select="concat(mods:namePart[@type='family'], ', ',mods:namePart[@type='given'])" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="mods:namePart" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="mods:displayForm">
<xsl:value-of select="mods:displayForm" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template match="mods:extent" mode="printExtent">
<xsl:choose>
Expand Down