Bug 32794: Expand tests for access method in XLST files

This patch expands the checks for 856u to check for mailto, and adds a few conditiona
checks of the first indicator to cover more methods

Reference: https://www.oclc.org/bibformats/en/8xx/856.html

To test:
1 - Edit a record and add a few 856 fields:
    856 0 0 $umailto:test@example.org
    856 0 0 $utest@example.org
    856 2 0 $utelnet://pucc.princeton.edu
    856 2 0 $upucc.princeton.edu
    856 3 0 $u8885555555
2 - View staff details and results and opac details and results
3 - Note all links have been prepended with http://
4 - Apply patch
5 - Refresh all views, ensure links are correctly formed

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-02-02 13:29:04 +00:00 committed by Tomas Cohen Arazi
parent 557a0285ca
commit 353a0a85a3
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 40 additions and 4 deletions

View file

@ -927,14 +927,23 @@
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable> <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:if test="not(contains(marc:subfield[@code='u'],'://'))"> <xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
<xsl:choose> <xsl:choose>
<xsl:when test="@ind1=7"> <xsl:when test="@ind1=7">
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text> <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="@ind1=1"> <xsl:when test="@ind1=1">
<xsl:text>ftp://</xsl:text> <xsl:text>ftp://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="@ind1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>http://</xsl:text> <xsl:text>http://</xsl:text>
</xsl:otherwise> </xsl:otherwise>

View file

@ -963,14 +963,23 @@
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable> <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:if test="not(contains(marc:subfield[@code='u'],'://'))"> <xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
<xsl:choose> <xsl:choose>
<xsl:when test="@ind1=7"> <xsl:when test="@ind1=7">
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text> <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="@ind1=1"> <xsl:when test="@ind1=1">
<xsl:text>ftp://</xsl:text> <xsl:text>ftp://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="@ind1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>http://</xsl:text> <xsl:text>http://</xsl:text>
</xsl:otherwise> </xsl:otherwise>

View file

@ -1046,14 +1046,23 @@
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:if test="not(contains(marc:subfield[@code='u'],'://'))"> <xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
<xsl:choose> <xsl:choose>
<xsl:when test="@ind1=7"> <xsl:when test="@ind1=7">
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text> <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="@ind1=1"> <xsl:when test="@ind1=1">
<xsl:text>ftp://</xsl:text> <xsl:text>ftp://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="@ind1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>http://</xsl:text> <xsl:text>http://</xsl:text>
</xsl:otherwise> </xsl:otherwise>

View file

@ -1176,14 +1176,23 @@
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:if test="not(contains(marc:subfield[@code='u'],'://'))"> <xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
<xsl:choose> <xsl:choose>
<xsl:when test="@ind1=7"> <xsl:when test="@ind1=7">
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text> <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="@ind1=1"> <xsl:when test="@ind1=1">
<xsl:text>ftp://</xsl:text> <xsl:text>ftp://</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="@ind1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="@ind1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>http://</xsl:text> <xsl:text>http://</xsl:text>
</xsl:otherwise> </xsl:otherwise>