[Patches] [PATCH] [SIGNED-OFF] Bug 7309 - Add NORMARCslim2intranetDetail.xsl
koha-patchbot at kohaaloha.com
koha-patchbot at kohaaloha.com
Sat Dec 3 22:05:03 NZDT 2011
From: Magnus Enger <magnus at enger.priv.no>
Date: Fri, 2 Dec 2011 16:08:44 +0000
Subject: [PATCH] [SIGNED-OFF] Bug 7309 - Add NORMARCslim2intranetDetail.xsl
for detail view in intranet
Adds two files, to enable XSLT for the detail view in the intranet:
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
To test:
- Set sysprefs: marcflavour = NORMARC and XSLTDetailsDisplay = "using XSLT stylesheet"
- Make sure OPACBaseURL is set correctly
- Check that detail display looks ok
- Check that automatic links for author, subjects etc work
- Check that the "Open in new window" link works as expected
- Empty the OPACBaseURL syspref and check that "Open in new window" does not display
Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Great test plan, could reproduce problem and can confirm patch fixes it.
---
.../prog/en/xslt/NORMARCslim2intranetDetail.xsl | 535 ++++++++++++++++++++
.../prog/en/xslt/NORMARCslimUtils.xsl | 205 ++++++++
2 files changed, 740 insertions(+), 0 deletions(-)
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
new file mode 100644
index 0000000..163ed29
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
@@ -0,0 +1,535 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
+<xsl:stylesheet version="1.0"
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
+ xmlns:items="http://www.koha-community.org/items"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ exclude-result-prefixes="marc items">
+ <xsl:import href="NORMARCslimUtils.xsl"/>
+ <xsl:output method = "xml" indent="yes" omit-xml-declaration = "yes" />
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="marc:record">
+
+ <!-- Sysprefs -->
+ <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
+
+ <xsl:variable name="leader" select="marc:leader"/>
+ <xsl:variable name="leader6" select="substring($leader,7,1)"/>
+ <xsl:variable name="leader7" select="substring($leader,8,1)"/>
+ <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
+ <xsl:variable name="field019b" select="marc:datafield[@tag=019]/marc:subfield[@code='b']"/>
+ <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
+ <xsl:variable name="materialTypeCode">
+ <xsl:choose>
+ <xsl:when test="$field019b='b' or $field019b='k' or $field019b='l' or $leader6='b'">Mon</xsl:when>
+ <xsl:when test="$field019b='e' or contains($field019b,'ec') or contains($field019b,'ed') or contains($field019b,'ee') or contains($field019b,'ef') or $leader6='g'">FV</xsl:when>
+ <xsl:when test="$field019b='c' or $field019b='d' or contains($field019b,'da') or contains($field019b,'db') or contains($field019b,'dc') or contains($field019b,'dd') or contains($field019b,'dg') or contains($field019b,'dh') or contains($field019b,'di') or contains($field019b,'dj') or contains($field019b,'dk') or $leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Mus</xsl:when>
+ <xsl:when test="$field019b='a' or contains($field019b,'ab') or contains($field019b,'aj') or $leader6='e' or $leader6='f'">Kar</xsl:when>
+ <xsl:when test="$field019b='f' or $field019b='i' or contains($field019b,'ib') or contains($field019b,'ic') or contains($field019b,'fd') or contains($field019b,'ff') or contains($field019b,'fi') or $leader6='k'">gra</xsl:when>
+ <xsl:when test="$field019b='g' or contains($field019b,'gb') or contains($field019b,'gd') or contains($field019b,'ge') or $leader6='m'">Fil</xsl:when>
+ <xsl:when test="$leader6='o'">kom</xsl:when>
+ <xsl:when test="$field019b='h' or $leader6='r'">trd</xsl:when>
+ <xsl:when test="$field019b='j' or $leader6='a'">
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='m' or $leader7='p'">Mon</xsl:when>
+ <xsl:when test="$field019b='j' or $leader7='b' or $leader7='s'">Per</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="materialTypeLabel">
+ <xsl:choose>
+ <xsl:when test="$field019b='b' or $field019b='k' or $field019b='l' or $leader6='b'">Bok</xsl:when>
+ <xsl:when test="$field019b='e' or contains($field019b,'ec') or contains($field019b,'ed') or contains($field019b,'ee') or contains($field019b,'ef') or $leader6='g'">Film og video</xsl:when>
+ <xsl:when test="$field019b='c' or $field019b='d' or contains($field019b,'da') or contains($field019b,'db') or contains($field019b,'dc') or contains($field019b,'dd') or contains($field019b,'dg') or contains($field019b,'dh') or contains($field019b,'di') or contains($field019b,'dj') or contains($field019b,'dk') or $leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Musikalier</xsl:when>
+ <xsl:when test="$field019b='a' or contains($field019b,'ab') or contains($field019b,'aj') or $leader6='e' or $leader6='f'">Kart</xsl:when>
+ <xsl:when test="$field019b='f' or $field019b='i' or contains($field019b,'ib') or contains($field019b,'ic') or contains($field019b,'fd') or contains($field019b,'ff') or contains($field019b,'fi') or $leader6='k'">Grafisk materiale</xsl:when>
+ <xsl:when test="$field019b='g' or contains($field019b,'gb') or contains($field019b,'gd') or contains($field019b,'ge') or $leader6='m'">Fil</xsl:when>
+ <xsl:when test="$leader6='o'">Kombidokument</xsl:when>
+ <xsl:when test="$field019b='h' or $leader6='r'">Tredimensjonal gjenstand</xsl:when>
+ <xsl:when test="$field019b='j' or $leader6='a'">
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='m' or $leader7='p'">Bok</xsl:when>
+ <xsl:when test="$field019b='j' or $leader7='b' or $leader7='s'">Periodikum</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+
+ </xsl:variable>
+
+ <!-- Tittel og ansvarsopplysninger -->
+ <xsl:if test="marc:datafield[@tag=245]">
+ <h1>
+ <xsl:for-each select="marc:datafield[@tag=245]">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="marc:subfield[@code='b']">
+ <xsl:text> : </xsl:text>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">b</xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="marc:subfield[@code='h']">
+ <xsl:text> </xsl:text>
+ (<xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">h</xsl:with-param>
+ </xsl:call-template>)
+ </xsl:if>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">np</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </h1>
+ </xsl:if>
+
+ <!-- Author Statement -->
+ <!-- 245$9 is Koha authority number -->
+ <xsl:choose>
+ <xsl:when test="marc:datafield[@tag=100] or marc:datafield[@tag=110] or marc:datafield[@tag=111] or marc:datafield[@tag=700] or marc:datafield[@tag=710] or marc:datafield[@tag=711]">
+ <h5 class="author">av
+ <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
+ <a>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code=9]">
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="nameABCDQ"/></a>
+ <xsl:choose>
+ <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
+ <a>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code=9]">
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="nameABCDN"/></a>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
+ <a>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code=9]">
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="nameACDEQ"/></a>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+
+ </xsl:for-each>
+ </h5>
+ </xsl:when>
+ </xsl:choose>
+
+
+ <xsl:if test="$materialTypeCode!=''">
+ <span class="results_summary"><span class="label">Materialtype: </span>
+ <xsl:element name="img"><xsl:attribute name="src">/opac-tmpl/prog/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
+ <xsl:value-of select="$materialTypeLabel"/>
+ </span>
+ </xsl:if>
+
+ <!--Series -->
+ <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
+ <span class="results_summary"><span class="label">Series: </span>
+ <xsl:for-each select="marc:datafield[@tag=440]">
+ <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">av</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </a>
+ <xsl:text> </xsl:text><xsl:call-template name="part"/>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
+ <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">av</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </a>
+ <xsl:call-template name="part"/>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- Publisher Statement -->
+
+ <xsl:if test="marc:datafield[@tag=260]">
+ <span class="results_summary"><span class="label">Utgiver: </span>
+ <xsl:for-each select="marc:datafield[@tag=260]">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">bcg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- Edition Statement -->
+
+ <xsl:if test="marc:datafield[@tag=250]">
+ <span class="results_summary"><span class="label">Utgave: </span>
+ <xsl:for-each select="marc:datafield[@tag=250]">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- Description -->
+
+ <xsl:if test="marc:datafield[@tag=300]">
+ <span class="results_summary"><span class="label">Beskrivelse: </span>
+ <xsl:for-each select="marc:datafield[@tag=300]">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abceg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <abbr class="unapi-id" title="koha:biblionumber:{marc:datafield[@tag=999]/marc:subfield[@code='c']}" ><!-- unAPI --></abbr>
+
+ <xsl:if test="marc:datafield[@tag=020]">
+ <span class="results_summary"><span class="label">ISBN: </span>
+ <xsl:for-each select="marc:datafield[@tag=020]">
+ <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <xsl:if test="marc:datafield[@tag=022]">
+ <span class="results_summary"><span class="label">ISSN: </span>
+ <xsl:for-each select="marc:datafield[@tag=022]">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- Other Title Statement -->
+
+ <xsl:if test="marc:datafield[@tag=246]">
+ <span class="results_summary"><span class="label">Parallelltittel: </span>
+ <xsl:for-each select="marc:datafield[@tag=246]">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abhfgnp</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- Uniform Title Statement -->
+
+ <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
+ <span class="results_summary"><span class="label">Standardtittel: </span>
+ <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="(contains('adfklmor', at code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
+ <span class="results_summary"><span class="label">Emner: </span>
+ <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
+ <a>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code=9]">
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
+ <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
+ <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template></a>
+ <xsl:choose>
+ <xsl:when test="position()=last()"></xsl:when>
+ <xsl:otherwise> | </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <xsl:if test="marc:datafield[@tag=856]">
+ <span class="results_summary"><span class="label">Nettbasert ressurs: </span>
+ <xsl:for-each select="marc:datafield[@tag=856]">
+ <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">y3z</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
+ Klikk her for tilgang
+ </xsl:when>
+ </xsl:choose>
+ </a>
+ <xsl:choose>
+ <xsl:when test="position()=last()"></xsl:when>
+ <xsl:otherwise> | </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- NORMARC does not define indicators for 505
+ <xsl:if test="marc:datafield[@tag=505]">
+ <xsl:for-each select="marc:datafield[@tag=505]">
+ <span class="results_summary"><span class="label">
+ <xsl:choose>
+ <xsl:when test="@ind1=0">
+ Contents:
+ </xsl:when>
+ <xsl:when test="@ind1=1">
+ Incomplete contents:
+ </xsl:when>
+ <xsl:when test="@ind1=1">
+ Partial contents:
+ </xsl:when>
+ </xsl:choose>
+ </span>
+ <xsl:choose>
+ <xsl:when test="@ind2=0">
+ <xsl:for-each select="marc:subfield[@code='t']">
+ <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">au</xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+ </xsl:for-each>
+ </xsl:if>
+ -->
+ <xsl:if test="marc:datafield[@tag=505]">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- 780 -->
+ <xsl:if test="marc:datafield[@tag=780]">
+ <xsl:for-each select="marc:datafield[@tag=780]">
+ <span class="results_summary"><span class="label">
+ <xsl:choose>
+ <xsl:when test="@ind2=0">
+ Fortsettelse av:
+ </xsl:when>
+ <xsl:when test="@ind2=1">
+ Delvis fortsettelse av:
+ </xsl:when>
+ <xsl:when test="@ind2=2">
+ Avløser:
+ </xsl:when>
+ <xsl:when test="@ind2=3">
+ Avløser delvis:
+ </xsl:when>
+ <xsl:when test="@ind2=4">
+ Sammenslåing av: ... ; og ...
+ </xsl:when>
+ <xsl:when test="@ind2=5">
+ Har tatt opp:
+ </xsl:when>
+ <xsl:when test="@ind2=6">
+ Har delvis tatt opp:
+ </xsl:when>
+ <xsl:when test="@ind2=7">
+ Utskilt fra:
+ </xsl:when>
+ </xsl:choose>
+ </span>
+ <xsl:variable name="f780">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a_t</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
+ <xsl:value-of select="translate($f780, '()', '')"/>
+ </a>
+ </span>
+
+ <xsl:choose>
+ <xsl:when test="@ind1=0">
+ <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+ </xsl:when>
+ </xsl:choose>
+
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- 785 -->
+ <xsl:if test="marc:datafield[@tag=785]">
+ <xsl:for-each select="marc:datafield[@tag=785]">
+ <span class="results_summary"><span class="label">
+ <xsl:choose>
+ <xsl:when test="@ind2=0">
+ Fortsettelse i:
+ </xsl:when>
+ <xsl:when test="@ind2=1">
+ Fortsettes delvis i:
+ </xsl:when>
+ <xsl:when test="@ind2=2">
+ Avløst av:
+ </xsl:when>
+ <xsl:when test="@ind2=3">
+ Delvis avløst av:
+ </xsl:when>
+ <xsl:when test="@ind2=4">
+ Gått inn i:
+ </xsl:when>
+ <xsl:when test="@ind2=5">
+ Delvis gått inn i:
+ </xsl:when>
+ <xsl:when test="@ind2=6">
+ Fortsettes av: ...; og ...
+ </xsl:when>
+ <xsl:when test="@ind2=7">
+ Slått sammen med: .., til: ...
+ </xsl:when>
+ </xsl:choose>
+ </span>
+ <xsl:variable name="f785">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a_t</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
+ <xsl:value-of select="translate($f785, '()', '')"/>
+ </a>
+
+ </span>
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- This will only work if the OPACBaseURL syspref is set. -->
+ <xsl:if test="string-length($OPACBaseURL) > 0">
+ <p>OPAC View: <a>
+ <xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
+ <xsl:attribute name="target">_blank</xsl:attribute>
+ Open in new window
+ </a></p>
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template name="part">
+ <xsl:variable name="partNumber">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">n</xsl:with-param>
+ <xsl:with-param name="anyCodes">n</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="partName">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">p</xsl:with-param>
+ <xsl:with-param name="anyCodes">p</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($partNumber))">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partNumber"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="string-length(normalize-space($partName))">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partName"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="specialSubfieldSelect">
+ <xsl:param name="anyCodes"/>
+ <xsl:param name="axis"/>
+ <xsl:param name="beforeCodes"/>
+ <xsl:param name="afterCodes"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes, at code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes, at code) and preceding-sibling::marc:subfield[@code=$axis])">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
new file mode 100644
index 0000000..7c2bf21
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
@@ -0,0 +1,205 @@
+<?xml version='1.0'?>
+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template name="datafield">
+ <xsl:param name="tag"/>
+ <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="subfields"/>
+ <xsl:element name="datafield">
+ <xsl:attribute name="tag">
+ <xsl:value-of select="$tag"/>
+ </xsl:attribute>
+ <xsl:attribute name="ind1">
+ <xsl:value-of select="$ind1"/>
+ </xsl:attribute>
+ <xsl:attribute name="ind2">
+ <xsl:value-of select="$ind2"/>
+ </xsl:attribute>
+ <xsl:copy-of select="$subfields"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="subfieldSelect">
+ <xsl:param name="codes"/>
+ <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="subdivCodes"/>
+ <xsl:param name="subdivDelimiter"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($codes, @code)">
+ <xsl:if test="contains($subdivCodes, @code)">
+ <xsl:value-of select="$subdivDelimiter"/>
+ </xsl:if>
+ <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
+ </xsl:template>
+
+ <xsl:template name="buildSpaces">
+ <xsl:param name="spaces"/>
+ <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
+ <xsl:if test="$spaces>0">
+ <xsl:value-of select="$char"/>
+ <xsl:call-template name="buildSpaces">
+ <xsl:with-param name="spaces" select="$spaces - 1"/>
+ <xsl:with-param name="char" select="$char"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="chopPunctuation">
+ <xsl:param name="chopString"/>
+ <xsl:variable name="length" select="string-length($chopString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($chopString)"/>
+ <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
+ </xsl:choose>
+<xsl:text> </xsl:text>
+ </xsl:template>
+
+<xsl:template name="nameABCDQ">
+<xsl:call-template name="chopPunctuation">
+<xsl:with-param name="chopString">
+<xsl:call-template name="subfieldSelect">
+<xsl:with-param name="codes">aq</xsl:with-param>
+</xsl:call-template>
+</xsl:with-param>
+<xsl:with-param name="punctuation">
+<xsl:text>:,;/ </xsl:text>
+</xsl:with-param>
+</xsl:call-template>
+<xsl:call-template name="termsOfAddress"/>
+</xsl:template>
+
+<xsl:template name="nameABCDN">
+<xsl:for-each select="marc:subfield[@code='a']">
+<xsl:call-template name="chopPunctuation">
+<xsl:with-param name="chopString" select="."/>
+</xsl:call-template>
+</xsl:for-each>
+<xsl:for-each select="marc:subfield[@code='b']">
+<xsl:value-of select="."/>
+</xsl:for-each>
+<xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
+<xsl:call-template name="subfieldSelect">
+<xsl:with-param name="codes">cdn</xsl:with-param>
+</xsl:call-template>
+</xsl:if>
+</xsl:template>
+
+<xsl:template name="nameACDEQ">
+<xsl:call-template name="subfieldSelect">
+<xsl:with-param name="codes">acdeq</xsl:with-param>
+</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="termsOfAddress">
+<xsl:if test="marc:subfield[@code='b' or @code='c']">
+<xsl:call-template name="chopPunctuation">
+<xsl:with-param name="chopString">
+<xsl:call-template name="subfieldSelect">
+<xsl:with-param name="codes">bc</xsl:with-param>
+</xsl:call-template>
+</xsl:with-param>
+</xsl:call-template>
+</xsl:if>
+</xsl:template>
+
+ <!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags
+ - should be called immediately before the corresonding latin tags are processed
+ - tags in right-to-left languages are displayed floating right
+ * Parameter:
+ + basetags: display these tags if found in linkage section ( subfield 6) of tag 880
+ + codes: display these subfields codes
+ * Options:
+ - class: wrap output in <span class="$class">...</span>
+ - label: prefix each(!) tag with label $label
+ - bibno: link to biblionumber $bibno
+ - index: build a search link using index $index with subfield $a as key; if subfield $9 is present use index 'an' with key $9 instead.
+ * Limitations:
+ - displays every field on a separate line (to switch between rtl and ltr)
+ * Pitfalls:
+ (!) output might be empty
+ -->
+ <xsl:template name="m880Select">
+ <xsl:param name="basetags"/> <!-- e.g. 100,700,110,710 -->
+ <xsl:param name="codes"/> <!-- e.g. abc -->
+ <xsl:param name="class"/> <!-- e.g. results_summary -->
+ <xsl:param name="label"/> <!-- e.g. Edition -->
+ <xsl:param name="bibno"/>
+ <xsl:param name="index"/> <!-- e.g. au -->
+
+ <xsl:for-each select="marc:datafield[@tag=880]">
+ <xsl:variable name="code6" select="marc:subfield[@code=6]"/>
+ <xsl:if test="contains(string($basetags), substring($code6,1,3))">
+ <span>
+ <xsl:if test="boolean($class)">
+ <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- display right-to-left tags floating right of their left-to-right counterparts -->
+ <xsl:when test="substring($code6,10,2) ='/r'">
+ <xsl:attribute name="style">display:block; text-align:right; float:right; width:50%; padding-left:20px</xsl:attribute>
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style">display:block; </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="boolean($label)">
+ <span class="label">
+ <xsl:value-of select="$label"/>
+ </span>
+ </xsl:if>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($codes, @code)">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="boolean($bibno)">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="boolean($index)">
+ <a>
+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+ <xsl:value-of select="$str"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+ </xsl:if>
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
+<metaInformation>
+<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->
--
1.7.5.4
More information about the Patches
mailing list