Merge commit 'kc/master'
[koha.git] / koha-tmpl / opac-tmpl / prog / en / xslt / MARC21slim2OPACDetail.xsl
index 2e18e44..1f8e897 100644 (file)
     </xsl:template>
 
     <xsl:template match="marc:record">
+
+        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
+        <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
+
+    <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
+    <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
+    <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
+    <xsl:variable name="ShowISBD" select="marc:sysprefs/marc:syspref[@name='viewISBD']"/>
         <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)"/>
@@ -29,7 +37,8 @@
                 <xsl:when test="$leader6='m'">CF</xsl:when>
                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
-                <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
+                <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
+                <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
             </xsl:choose>
         </xsl:variable>
         <xsl:variable name="materialTypeLabel">
                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">Visual Material</xsl:when>
-                <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Sound</xsl:when>
+                <xsl:when test="$leader6='j'">Music</xsl:when>
+                <xsl:when test="$leader6='i'">Sound</xsl:when>
+                <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
             </xsl:choose>
         </xsl:variable>
 
         <!-- Title Statement -->
+        <!-- Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <h1 class="title">
+                <xsl:call-template name="m880Select">
+                    <xsl:with-param name="basetags">245</xsl:with-param>
+                    <xsl:with-param name="codes">abhfgknps</xsl:with-param>
+                </xsl:call-template>
+            </h1>
+        </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=245]">
         <h1>
             <xsl:for-each select="marc:datafield[@tag=245]">
@@ -68,6 +89,7 @@
                             <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">fgknps</xsl:with-param>
                     </xsl:call-template>
         </h1>
         </xsl:if>
 
+        <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <h5 class="author">
+                <xsl:call-template name="m880Select">
+                    <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
+                    <xsl:with-param name="codes">abc</xsl:with-param>
+                    <xsl:with-param name="index">au</xsl:with-param>
+                    <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
+                </xsl:call-template>
+            </h5>
+        </xsl:if>
+
         <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">by
                 <xsl:attribute name="href">/cgi-bin/koha/opac-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/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>      
+            <xsl:attribute name="href">/cgi-bin/koha/opac-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: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]">
+            <xsl:choose>
+            <xsl:when test="marc:subfield[@code='n']">
+               <xsl:text> </xsl:text>
+               <xsl:call-template name="subfieldSelect">
+                  <xsl:with-param name="codes">n</xsl:with-param>                              </xsl:call-template>
+               <xsl:text> </xsl:text>
+            </xsl:when>
+            </xsl:choose>
         <a>
         <xsl:choose>
             <xsl:when test="marc:subfield[@code=9]">
         <span class="view"><span id="Normalview">Normal View</span> </span>
         <span class="view"><a id="MARCviewPop" href="/cgi-bin/koha/opac-showmarc.pl?id={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC" rel="gb_page_center[600,500]">MARC View</a></span>
         <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC">Expanded MARC View</a></span>
+<xsl:if test="$ShowISBD!='0'">
         <span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}">Card View (ISBD)</a></span>
-        </div> 
-
+</xsl:if>
+        </div>
 
+   <xsl:if test="$DisplayOPACiconsXSLT!='0'">
         <xsl:if test="$materialTypeCode!=''">
         <span class="results_summary"><span class="label">Type: </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>
+   </xsl:if>
+
+        <!--Series: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">440,490</xsl:with-param>
+                <xsl:with-param name="codes">av</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Series: </xsl:with-param>
+                <xsl:with-param name="index">se</xsl:with-param>
+            </xsl:call-template>
+        </xsl:if>
+
         <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]">
         </xsl:for-each>
         </span>
         </xsl:if>
+
+        <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">260</xsl:with-param>
+                <xsl:with-param name="codes">abcg</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Publisher: </xsl:with-param>
+            </xsl:call-template>
+        </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=260]">
         <span class="results_summary"><span class="label">Publisher: </span>
             <xsl:for-each select="marc:datafield[@tag=260]">
                </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> 
+        </span>
+        </xsl:if>
+
+        <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">250</xsl:with-param>
+                <xsl:with-param name="codes">ab</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Edition: </xsl:with-param>
+            </xsl:call-template>
         </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=250]">
         <span class="results_summary"><span class="label">Edition: </span>
             <xsl:for-each select="marc:datafield[@tag=250]">
         </span>
         </xsl:if>
 
+        <!-- Description: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">300</xsl:with-param>
+                <xsl:with-param name="codes">abceg</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Description: </xsl:with-param>
+            </xsl:call-template>
+        </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=300]">
         <span class="results_summary"><span class="label">Description: </span>
             <xsl:for-each select="marc:datafield[@tag=300]">
         </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]">
         </span>
         </xsl:if>
 
+        <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">246</xsl:with-param>
+                <xsl:with-param name="codes">abhfgnp</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Other Title: </xsl:with-param>
+            </xsl:call-template>
+        </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=246]">
         <span class="results_summary"><span class="label">Other Title: </span>
             <xsl:for-each select="marc:datafield[@tag=246]">
         </span>
        </xsl:if>
 
+        <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
+        <xsl:if test="$display880">
+            <xsl:call-template name="m880Select">
+                <xsl:with-param name="basetags">130,240</xsl:with-param>
+                <xsl:with-param name="codes">adfklmor</xsl:with-param>
+                <xsl:with-param name="class">results_summary</xsl:with-param>
+                <xsl:with-param name="label">Uniform Title: </xsl:with-param>
+            </xsl:call-template>
+        </xsl:if>
+
         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
         <span class="results_summary"><span class="label">Uniform titles: </span>
         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
             <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:if test="marc:datafield[@tag=856]">
         <span class="results_summary"><span class="label">Online Resources: </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'])">
-        Click here to access online
-        </xsl:when>
-        </xsl:choose>
-        </a>
-            <xsl:choose>
-            <xsl:when test="position()=last()"></xsl:when>
-            <xsl:otherwise> | </xsl:otherwise>
-            </xsl:choose>
-            
+                            <xsl:if test="$OPACURLOpenInNewWindow='0'">
+                                   <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'])">
+                                        <xsl:choose>
+                                        <xsl:when test="$URLLinkText!=''">
+                                                <xsl:value-of select="$URLLinkText"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                                <xsl:text>Click here to access online</xsl:text>
+                                        </xsl:otherwise>
+                                        </xsl:choose>
+                                    </xsl:when>
+                                    </xsl:choose>
+                                    </a>
+                              </xsl:if>
+                            <xsl:if test="$OPACURLOpenInNewWindow='1'">
+                                   <a target='_blank'><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'])">
+                                        <xsl:choose>
+                                        <xsl:when test="$URLLinkText!=''">
+                                                <xsl:value-of select="$URLLinkText"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                                <xsl:text>Click here to access online</xsl:text>
+                                        </xsl:otherwise>
+                                        </xsl:choose>
+                                    </xsl:when>
+                                    </xsl:choose>
+                                    </a>
+                              </xsl:if>
+                                    <xsl:choose>
+                                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
+                                    <xsl:otherwise> | </xsl:otherwise>
+                                    </xsl:choose>
+
         </xsl:for-each>
         </span>
         </xsl:if>
         <xsl:if test="marc:datafield[@tag=505]">
         <xsl:for-each select="marc:datafield[@tag=505]">
-        <span class="results_summary"><span class="label">
+        <span class="results_summary">
         <xsl:choose>
-        <xsl:when test="@ind1=0">
-            Contents:
-        </xsl:when>
         <xsl:when test="@ind1=1">
-            Incomplete contents:
+            <span class="label">Incomplete contents:</span>
         </xsl:when>
         <xsl:when test="@ind1=1">
-            Partial contents:
+            <span class="label">Partial contents:</span>
         </xsl:when>
-        </xsl:choose>  
-        </span>
+        <xsl:otherwise>
+            <span class="label">Contents:</span>
+        </xsl:otherwise>
+        </xsl:choose>
         <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:for-each>
         </xsl:when>
         <xsl:otherwise>
             <xsl:call-template name="subfieldSelect">
         </xsl:for-each>
         </xsl:if>
 
+        <!-- 773 -->
+        <xsl:if test="marc:datafield[@tag=773]">
+        <xsl:for-each select="marc:datafield[@tag=773]">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary"><span class="label">
+        <xsl:choose>
+        <xsl:when test="@ind2=' '">
+            In:
+        </xsl:when>
+        <xsl:when test="@ind2=8">
+            <xsl:if test="marc:subfield[@code='i']">
+                <xsl:value-of select="marc:subfield[@code='i']"/>
+            </xsl:if>
+        </xsl:when>
+        </xsl:choose>
+        </span>
+                <xsl:variable name="f773">
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">at</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:variable>
+             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
+                <xsl:value-of select="translate($f773, '()', '')"/>
+            </a>
+        </span>
+
+            <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+
+        </xsl:if>
+        </xsl:for-each>
+        </xsl:if>
+
+        <xsl:for-each select="marc:datafield[@tag=520]">
+        <span class="results_summary"><span class="label">
+        <xsl:choose>
+          <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
+          <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
+          <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
+          <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
+          <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
+          <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
+        </xsl:choose>
+        </span>
+        <xsl:call-template name="subfieldSelect">
+          <xsl:with-param name="codes">abcu</xsl:with-param>
+        </xsl:call-template>
+        </span>
+        </xsl:for-each>
+
+       <!-- 866 holdings public note -->
+        <xsl:if test="marc:datafield[@tag=866]">
+        <span class="results_summary"><span class="label">Holdings Note: </span>
+        <xsl:for-each select="marc:datafield[@tag=866]">
+                <xsl:value-of select="marc:subfield[@code='z']"/>
+                <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>
+
         <!-- 780 -->
         <xsl:if test="marc:datafield[@tag=780]">
         <xsl:for-each select="marc:datafield[@tag=780]">
-        <span class="results_summary"><span class="label">
+        <xsl:if test="@ind1=0">
+        <span class="results_summary">
         <xsl:choose>
         <xsl:when test="@ind2=0">
-            Continues:
+            <span class="label">Continues:</span>
         </xsl:when>
         <xsl:when test="@ind2=1">
-            Continues in part:
+            <span class="label">Continues in part:</span>
         </xsl:when>
         <xsl:when test="@ind2=2">
-            Supersedes:
+            <span class="label">Supersedes:</span>
         </xsl:when>
         <xsl:when test="@ind2=3">
-            Supersedes in part:
+            <span class="label">Supersedes in part:</span>
         </xsl:when>
         <xsl:when test="@ind2=4">
-            Formed by the union: ... and: ...
+            <span class="label">Formed by the union: ... and: ...</span>
         </xsl:when>
         <xsl:when test="@ind2=5">
-            Absorbed:
+            <span class="label">Absorbed:</span>
         </xsl:when>
         <xsl:when test="@ind2=6">
-            Absorbed in part:
+            <span class="label">Absorbed in part:</span>
         </xsl:when>
         <xsl:when test="@ind2=7">
-            Separated from:
+            <span class="label">Separated from:</span>
         </xsl:when>
         </xsl:choose>
-        </span>
                 <xsl:variable name="f780">
                     <xsl:call-template name="subfieldSelect">
                         <xsl:with-param name="codes">at</xsl:with-param>
                 <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>
 
+        <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
+
+        </xsl:if>
         </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:if test="@ind1=0">
+        <span class="results_summary">
         <xsl:choose>
         <xsl:when test="@ind2=0">
-            Continued by:
+            <span class="label">Continued by:</span>
         </xsl:when>
         <xsl:when test="@ind2=1">
-            Continued in part by:
+            <span class="label">Continued in part by:</span>
         </xsl:when>
         <xsl:when test="@ind2=2">
-            Superseded by:
+            <span class="label">Superseded by:</span>
         </xsl:when>
         <xsl:when test="@ind2=3">
-            Superseded in part by:
+            <span class="label">Superseded in part by:</span>
         </xsl:when>
         <xsl:when test="@ind2=4">
-            Absorbed by:
+            <span class="label">Absorbed by:</span>
         </xsl:when>
         <xsl:when test="@ind2=5">
-            Absorbed in part by:
+            <span class="label">Absorbed in part by:</span>
         </xsl:when>
         <xsl:when test="@ind2=6">
-            Split into .. and ...:
+            <span class="label">Split into .. and ...:</span>
         </xsl:when>
         <xsl:when test="@ind2=7">
-            Merged with ... to form ...
+            <span class="label">Merged with ... to form ...</span>
         </xsl:when>
         <xsl:when test="@ind2=8">
-            Changed back to:
+            <span class="label">Changed back to:</span>
         </xsl:when>
 
         </xsl:choose>
-        </span>
                    <xsl:variable name="f785">
                     <xsl:call-template name="subfieldSelect">
                         <xsl:with-param name="codes">at</xsl:with-param>
             </a>
 
         </span>
+        </xsl:if>
         </xsl:for-each>
         </xsl:if>