Bug 32794: (follow-up) Replace code by new function (template)
Test plan: Same as first patch. Bonus: Remove protocol from $u. Set first ind1 to 7. Put mailto in $2. Check link. Change $2 to tel. Check link. Change $2 to https. Check link. 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:
parent
db2a8a416a
commit
c15f1d65b7
4 changed files with 20 additions and 88 deletions
|
@ -927,28 +927,11 @@
|
|||
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@ind1=7">
|
||||
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=0">
|
||||
<xsl:text>mailto:</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=1">
|
||||
<xsl:text>ftp://</xsl:text>
|
||||
</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:text>http://</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="AddMissingProtocol">
|
||||
<xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
|
||||
<xsl:with-param name="indicator1" select="@ind1"/>
|
||||
<xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="marc:subfield[@code='u']"/>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
|
|
|
@ -963,28 +963,11 @@
|
|||
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@ind1=7">
|
||||
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=0">
|
||||
<xsl:text>mailto:</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=1">
|
||||
<xsl:text>ftp://</xsl:text>
|
||||
</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:text>http://</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="AddMissingProtocol">
|
||||
<xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
|
||||
<xsl:with-param name="indicator1" select="@ind1"/>
|
||||
<xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="marc:subfield[@code='u']"/>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
|
|
|
@ -1046,28 +1046,11 @@
|
|||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@ind1=7">
|
||||
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=0">
|
||||
<xsl:text>mailto:</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=1">
|
||||
<xsl:text>ftp://</xsl:text>
|
||||
</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:text>http://</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="AddMissingProtocol">
|
||||
<xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
|
||||
<xsl:with-param name="indicator1" select="@ind1"/>
|
||||
<xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="marc:subfield[@code='u']"/>
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
|
|
|
@ -1176,28 +1176,11 @@
|
|||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:if test="not(contains(marc:subfield[@code='u'],'://') or contains(marc:subfield[@code='u'],'mailto:'))">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@ind1=7">
|
||||
<xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=0">
|
||||
<xsl:text>mailto:</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@ind1=1">
|
||||
<xsl:text>ftp://</xsl:text>
|
||||
</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:text>http://</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="AddMissingProtocol">
|
||||
<xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
|
||||
<xsl:with-param name="indicator1" select="@ind1"/>
|
||||
<xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="marc:subfield[@code='u']"/>
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
|
|
Loading…
Reference in a new issue