Bug 32794: (follow-up) Consolidate shared code into one function (:template)

Few extra lines for the $2 exception as noted on Bugzilla.

Note: We should probably check why the utils xslt on opac and intranet
have so much differences currently.

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:
Marcel de Rooy 2023-03-22 15:17:06 +00:00 committed by Tomas Cohen Arazi
parent 353a0a85a3
commit db2a8a416a
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 64 additions and 0 deletions

View File

@ -690,6 +690,38 @@
</xsl:if>
</xsl:template>
<xsl:template name="AddMissingProtocol">
<xsl:param name="resourceLocation"/>
<xsl:param name="indicator1"/>
<xsl:param name="accessMethod"/>
<xsl:param name="delimiter" select="':'"/>
<xsl:if test="not(contains($resourceLocation, $delimiter))">
<xsl:choose>
<xsl:when test="$indicator1=7 and ( $accessMethod='mailto' or $accessMethod='tel' )">
<xsl:value-of select="$accessMethod"/><xsl:text>:</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=7">
<xsl:value-of select="$accessMethod"/><xsl:text>://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=1">
<xsl:text>ftp://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>http://</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.

View File

@ -653,6 +653,38 @@
</xsl:if>
</xsl:template>
<xsl:template name="AddMissingProtocol">
<xsl:param name="resourceLocation"/>
<xsl:param name="indicator1"/>
<xsl:param name="accessMethod"/>
<xsl:param name="delimiter" select="':'"/>
<xsl:if test="not(contains($resourceLocation, $delimiter))">
<xsl:choose>
<xsl:when test="$indicator1=7 and ( $accessMethod='mailto' or $accessMethod='tel' )">
<xsl:value-of select="$accessMethod"/><xsl:text>:</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=7">
<xsl:value-of select="$accessMethod"/><xsl:text>://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=0">
<xsl:text>mailto:</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=1">
<xsl:text>ftp://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=2">
<xsl:text>telnet://</xsl:text>
</xsl:when>
<xsl:when test="$indicator1=3">
<xsl:text>tel:</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>http://</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.