Skip to content

MENDELU/Update OAI-PMH to fix CitacePRO composing#1311

Closed
milanmajchrak wants to merge 2 commits into
customer/mendelufrom
mendelu/oai-citace-pro
Closed

MENDELU/Update OAI-PMH to fix CitacePRO composing#1311
milanmajchrak wants to merge 2 commits into
customer/mendelufrom
mendelu/oai-citace-pro

Conversation

@milanmajchrak

Copy link
Copy Markdown
Collaborator

Problem description

Analysis

(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)

Problems

(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

…fier> for Citace PRO

DSpace 9 nemá pôvodné dc.identifier.citation z DSpace 6, takže oai_dc crosswalk teraz citáciu zostavuje priamo z metadát (autor; rok; názov; periodikum; ročník(číslo), strany; ISSN/ISBN; URL). Bez tejto úpravy Citace PRO dostávalo iba okliesťovaný text 'Myslivost. 2024, vol. 72, č. 11, s. 0.' a generovalo nesprávny iframe.
…itace PRO format)

Citace PRO parser ocakava format z DSpace 6: 'PRIEZVISKO, Krstne; PRIEZVISKO2, Krstne2; YEAR. Title. ...' Bez uppercase priezvisk a so separatorom '. ' pred rokom Citace PRO citaciu nerozozna.
Copilot AI review requested due to automatic review settings May 12, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the OAI-PMH oai_dc crosswalk to emit a composed bibliographic citation (targeted at Citace PRO) as an additional dc:identifier value.

Changes:

  • Replaces the previous “formatted identifier” logic with a new citation composer driven by authors/title/year and type-dependent formatting.
  • Adds DOI/URI selection logic and includes ISSN/ISBN when present.
  • Introduces uppercase surname formatting (via XSLT translate) for author strings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +127
<xsl:variable name="citType">
<xsl:choose>
<xsl:when test="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element[@name='none']/doc:field[@name='value']">
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element[@name='none']/doc:field[@name='value'][1]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='type']/doc:element/doc:field[@name='value'][1]" />
</xsl:otherwise>
Comment on lines +130 to +163
<xsl:variable name="hasAuthors" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value'])" />
<xsl:variable name="hasTitle" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='title']/doc:element/doc:field[@name='value'])" />
<xsl:variable name="hasYear" select="boolean(doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value'])" />
<!-- Lower→upper mapy pre uppercase priezvisk vrátane českej diakritiky (XSLT 1.0 translate funguje na úrovni Unicode codepointov) -->
<xsl:variable name="lc">abcdefghijklmnopqrstuvwxyzáäčďéěíĺľňóôöřšťúůýžàâãåæçèêëìîïðñòõøùûüýÿ</xsl:variable>
<xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZÁÄČĎÉĚÍĹĽŇÓÔÖŘŠŤÚŮÝŽÀÂÃÅÆÇÈÊËÌÎÏÐÑÒÕØÙÛÜÝŸ</xsl:variable>
<xsl:if test="$hasAuthors or $hasTitle or $hasYear">
<dc:identifier>
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='relation']/doc:element[@name='ispartof']/doc:element/doc:field[@name='value']" />
<xsl:text>. </xsl:text>
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value']" />
<xsl:text>, vol. </xsl:text>
<xsl:value-of select="doc:metadata/doc:element[@name='local']/doc:element[@name='volume']/doc:element/doc:field[@name='value']" />
<xsl:text>, č. </xsl:text>
<xsl:value-of select="doc:metadata/doc:element[@name='local']/doc:element[@name='number']/doc:element/doc:field[@name='value']" />
<!-- We do not have any information about pages, so it is `s. 0` by default -->
<xsl:text>, s. 0.</xsl:text>
<!-- AUTHORS: "PRIEZVISKO, Krstné; PRIEZVISKO2, Krstné2; " (priezvisko VEĽKÝM PÍSMOM, ako v DSpace 6 pre Citace PRO) -->
<xsl:if test="$hasAuthors">
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value']">
<xsl:choose>
<xsl:when test="contains(., ',')">
<xsl:value-of select="translate(substring-before(., ','), $lc, $uc)" />
<xsl:text>,</xsl:text>
<xsl:value-of select="substring-after(., ',')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(., $lc, $uc)" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>; </xsl:text>
</xsl:for-each>
</xsl:if>
<!-- YEAR: "2024. " -->
<xsl:if test="$hasYear">
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='date']/doc:element[@name='issued']/doc:element/doc:field[@name='value']" />
<xsl:text>. </xsl:text>
</xsl:if>
<!-- TITLE: "Title. " -->
<xsl:if test="$hasTitle">
<xsl:value-of select="doc:metadata/doc:element[@name='dc']/doc:element[@name='title']/doc:element/doc:field[@name='value'][1]" />
<xsl:text>. </xsl:text>
</xsl:if>
Comment on lines +140 to +152
<xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='author']/doc:element/doc:field[@name='value']">
<xsl:choose>
<xsl:when test="contains(., ',')">
<xsl:value-of select="translate(substring-before(., ','), $lc, $uc)" />
<xsl:text>,</xsl:text>
<xsl:value-of select="substring-after(., ',')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(., $lc, $uc)" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>; </xsl:text>
</xsl:for-each>
Comment on lines +172 to +176
<xsl:when test="$citType = 'article' or $citType = 'conferenceObject' or contains($citType, 'J_')">
<xsl:variable name="vol" select="doc:metadata/doc:element[@name='local']/doc:element[@name='volume']/doc:element/doc:field[@name='value']" />
<xsl:variable name="num" select="doc:metadata/doc:element[@name='local']/doc:element[@name='number']/doc:element/doc:field[@name='value']" />
<xsl:variable name="pages" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element[@name='none']/doc:field[@name='value'] | doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element[not(@name='none')]/doc:field[@name='value']" />
<xsl:if test="$vol != ''">
<!-- Book / bookPart / workingPaper / other: publisher, pages -->
<xsl:otherwise>
<xsl:variable name="publisher" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='publisher']/doc:element/doc:field[@name='value']" />
<xsl:variable name="pages2" select="doc:metadata/doc:element[@name='dc']/doc:element[@name='format']/doc:element/doc:field[@name='value']" />
@milanmajchrak

Copy link
Copy Markdown
Collaborator Author

Continuing here: #1312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants