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

Ikke splitt på kolon i *245$a #32

Open
josteinaj opened this issue Mar 15, 2024 · 1 comment
Open

Ikke splitt på kolon i *245$a #32

josteinaj opened this issue Mar 15, 2024 · 1 comment
Assignees
Labels
Liten jobb Kan gjøres innenfor en uke Middels prioritet

Comments

@josteinaj
Copy link
Member

Relevant kode:

normarc/marcxchange-to-opf.xsl

Lines 1498 to 1546 in d82be2c

<xsl:if test="count(*:subfield[@code='a'])">
<xsl:variable name="title" select="*:subfield[@code='a'][1]/normalize-space(replace(text(), '[\s&#160;]', ' '))" as="xs:string"/>
<xsl:variable name="title" select="replace(normalize-space($title), '^\[\s*(.*?)\s*\]$', '$1')"/>
<xsl:variable name="title" select="replace($title, ' *= *$', '')"/> <!-- remove trailing parallel title marker if present -->
<xsl:variable name="parallel-title" select="if (contains($title, '=')) then replace($title, '^.*= *', '') else ''" as="xs:string"/>
<xsl:variable name="title-without-parallel-title" select="if (contains($title, '=')) then replace($title, ' *=.*$', '') else $title" as="xs:string"/>
<xsl:variable name="title-without-subtitle" select="replace($title-without-parallel-title, '^([^;:]*[^;: ]).*', '$1')"/>
<xsl:variable name="title-without-subtitle" select="nlb:identifier-in-title($title-without-subtitle, $language, false())"/>
<xsl:for-each select="*:subfield[@code='a']">
<xsl:call-template name="meta">
<xsl:with-param name="property" select="'dc:title'"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="value" select="$title-without-subtitle"/>
</xsl:call-template>
<xsl:if test="string-length($parallel-title) gt 0">
<xsl:call-template name="meta">
<xsl:with-param name="property" select="'dc:title.parallel'"/>
<xsl:with-param name="context" select="."/>
<xsl:with-param name="value" select="$parallel-title"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
<xsl:variable name="subtitle" as="element()*">
<xsl:for-each select="*:subfield[@code='a']">
<xsl:variable name="subtitle" select="if (matches($title, '.*[;:].*')) then replace($title, '^[^;:]*[;:] *', '') else ()"/>
<xsl:variable name="subtitle" select="replace($subtitle, ';', ':')"/>
<xsl:if test="$subtitle">
<xsl:call-template name="meta"><xsl:with-param name="property" select="'dc:title.subTitle'"/><xsl:with-param name="value" select="$subtitle"/></xsl:call-template>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="*:subfield[@code='b']">
<xsl:call-template name="meta"><xsl:with-param name="property" select="'dc:title.subTitle'"/><xsl:with-param name="value" select="replace(text(),'[\[\]]','')"/></xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="count($subtitle) = 1">
<xsl:copy-of select="$subtitle"/>
</xsl:when>
<xsl:when test="count($subtitle) gt 1">
<xsl:variable name="subtitle_context" select="(*:subfield[@code='b'], *:subfield[@code='a'])[1]"/>
<xsl:call-template name="meta">
<xsl:with-param name="property" select="'dc:title.subTitle'"/>
<xsl:with-param name="value" select="string-join($subtitle, ' : ')"/>
<xsl:with-param name="context" select="$subtitle_context"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>

Eksempel på MARC-post (fra 610830):

*24500$aPS: jeg elsker deg!$cCecelia Ahern ; oversatt av Sølvi Marie Jacobsen$hdaisy 2.02

Her skal dc:title (og dermed "title" i APIet) være "PS: jeg elsker deg!"

@josteinaj josteinaj self-assigned this Mar 15, 2024
@josteinaj
Copy link
Member Author

Også slutte å hente ut parallelltitler. Det vil si: hente ut *245$a ubehandlet som dc:title.

@josteinaj josteinaj added Middels prioritet Liten jobb Kan gjøres innenfor en uke labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Liten jobb Kan gjøres innenfor en uke Middels prioritet
Projects
None yet
Development

No branches or pull requests

1 participant