Bug 5810: Subject tracings search complete subfields
[koha.git] / koha-tmpl / opac-tmpl / prog / en / xslt / MARC21slim2OPACDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4 <xsl:stylesheet version="1.0"
5   xmlns:marc="http://www.loc.gov/MARC21/slim"
6   xmlns:items="http://www.koha-community.org/items"
7   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8   exclude-result-prefixes="marc items">
9     <xsl:import href="MARC21slimUtils.xsl"/>
10     <xsl:output method = "xml" indent="yes" omit-xml-declaration = "yes" />
11     <xsl:template match="/">
12             <xsl:apply-templates/>
13     </xsl:template>
14
15     <xsl:template match="marc:record">
16
17         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
18         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
19
20     <xsl:variable name="UseControlNumber" select="1"/>
21     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
22     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
23     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
24     <xsl:variable name="ShowISBD" select="marc:sysprefs/marc:syspref[@name='viewISBD']"/>
25     
26     <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
27     <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
28         <xsl:variable name="leader" select="marc:leader"/>
29         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
30         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
31         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
32         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
33         <xsl:variable name="materialTypeCode">
34             <xsl:choose>
35                 <xsl:when test="$leader19='a'">ST</xsl:when>
36                 <xsl:when test="$leader6='a'">
37                     <xsl:choose>
38                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
39                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
40                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
41                     </xsl:choose>
42                 </xsl:when>
43                 <xsl:when test="$leader6='t'">BK</xsl:when>
44                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
45                 <xsl:when test="$leader6='m'">CF</xsl:when>
46                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
47                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
48                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
49                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
50             </xsl:choose>
51         </xsl:variable>
52         <xsl:variable name="materialTypeLabel">
53             <xsl:choose>
54                 <xsl:when test="$leader19='a'">Set</xsl:when>
55                 <xsl:when test="$leader6='a'">
56                     <xsl:choose>
57                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
58                         <xsl:when test="$leader7='i' or $leader7='s'">
59                             <xsl:choose>
60                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
61                                 <xsl:otherwise>Series</xsl:otherwise>
62                             </xsl:choose>
63                         </xsl:when>
64                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
65                     </xsl:choose>
66                 </xsl:when>
67                 <xsl:when test="$leader6='t'">Book</xsl:when>
68                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
69                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
70                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
71                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
72                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual Material</xsl:when>
73                 <xsl:when test="$leader6='j'">Music</xsl:when>
74                 <xsl:when test="$leader6='i'">Sound</xsl:when>
75                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
76             </xsl:choose>
77         </xsl:variable>
78
79         <!-- Title Statement -->
80         <!-- Alternate Graphic Representation (MARC 880) -->
81         <xsl:if test="$display880">
82             <h1 class="title">
83                 <xsl:call-template name="m880Select">
84                     <xsl:with-param name="basetags">245</xsl:with-param>
85                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
86                 </xsl:call-template>
87             </h1>
88         </xsl:if>
89
90         <xsl:if test="marc:datafield[@tag=245]">
91         <h1>
92             <xsl:for-each select="marc:datafield[@tag=245]">
93                     <xsl:call-template name="subfieldSelect">
94                         <xsl:with-param name="codes">a</xsl:with-param>
95                     </xsl:call-template>
96                     <xsl:if test="marc:subfield[@code='b']">
97                         <xsl:text> </xsl:text>
98                         <xsl:call-template name="subfieldSelect">
99                             <xsl:with-param name="codes">b</xsl:with-param>
100                         </xsl:call-template>
101                     </xsl:if>
102                     <xsl:if test="marc:subfield[@code='h']">
103                         <xsl:text> </xsl:text>
104                         <xsl:call-template name="subfieldSelect">
105                             <xsl:with-param name="codes">h</xsl:with-param>
106                         </xsl:call-template>
107                     </xsl:if>
108                 <xsl:text> </xsl:text>
109                     <xsl:call-template name="subfieldSelect">
110                         <xsl:with-param name="codes">fgknps</xsl:with-param>
111                     </xsl:call-template>
112             </xsl:for-each>
113         </h1>
114         </xsl:if>
115
116         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
117         <xsl:if test="$display880">
118             <h5 class="author">
119                 <xsl:call-template name="m880Select">
120                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
121                     <xsl:with-param name="codes">abc</xsl:with-param>
122                     <xsl:with-param name="index">au</xsl:with-param>
123                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
124                 </xsl:call-template>
125             </h5>
126         </xsl:if>
127
128         <xsl:choose>
129         <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]">
130         <h5 class="author">by
131         <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
132         <a>
133         <xsl:choose>
134             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
135                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
136             </xsl:when>
137             <xsl:otherwise>
138             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
139             </xsl:otherwise>
140         </xsl:choose>
141         <xsl:call-template name="nameABCDQ"/></a>
142         <xsl:choose>
143         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
144         </xsl:for-each>
145
146         <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
147         <a>
148         <xsl:choose>
149             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
150                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
151             </xsl:when>
152             <xsl:otherwise>
153             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
154             </xsl:otherwise>
155         </xsl:choose>
156         <xsl:call-template name="nameABCDN"/></a>
157         <xsl:choose><xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
158         </xsl:for-each>
159
160         <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
161             <xsl:choose>
162             <xsl:when test="marc:subfield[@code='n']">
163                <xsl:text> </xsl:text>
164                <xsl:call-template name="subfieldSelect">
165                   <xsl:with-param name="codes">n</xsl:with-param>                              </xsl:call-template>
166                <xsl:text> </xsl:text>
167             </xsl:when>
168             </xsl:choose>
169         <a>
170         <xsl:choose>
171             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
172                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
173             </xsl:when>
174             <xsl:otherwise>
175             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
176             </xsl:otherwise>
177         </xsl:choose>
178         <xsl:call-template name="nameACDEQ"/></a>
179         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
180
181         </xsl:for-each>
182         </h5>
183         </xsl:when>
184         </xsl:choose>
185         <div id="views">
186         <span class="view"><span id="Normalview">Normal View</span> </span>
187         <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC">MARC View</a></span>
188 <xsl:if test="$ShowISBD!='0'">
189         <span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}">ISBD View</a></span>
190 </xsl:if>
191         </div>
192
193    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
194         <xsl:if test="$materialTypeCode!=''">
195         <span class="results_summary"><span class="label">Type: </span>
196         <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>
197         <xsl:value-of select="$materialTypeLabel"/>
198         </span>
199         </xsl:if>
200    </xsl:if>
201
202         <!--Series: Alternate Graphic Representation (MARC 880) -->
203         <xsl:if test="$display880">
204             <xsl:call-template name="m880Select">
205                 <xsl:with-param name="basetags">440,490</xsl:with-param>
206                 <xsl:with-param name="codes">av</xsl:with-param>
207                 <xsl:with-param name="class">results_summary</xsl:with-param>
208                 <xsl:with-param name="label">Series: </xsl:with-param>
209                 <xsl:with-param name="index">se</xsl:with-param>
210             </xsl:call-template>
211         </xsl:if>
212
213         <!-- Series -->
214         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
215         <span class="results_summary"><span class="label">Series: </span>
216         <!-- 440 -->
217         <xsl:for-each select="marc:datafield[@tag=440]">
218              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
219             <xsl:call-template name="chopPunctuation">
220                             <xsl:with-param name="chopString">
221                                 <xsl:call-template name="subfieldSelect">
222                                     <xsl:with-param name="codes">av</xsl:with-param>
223                                 </xsl:call-template>
224                             </xsl:with-param>
225                         </xsl:call-template>
226                         </a>
227                     <xsl:text> </xsl:text><xsl:call-template name="part"/>
228             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
229         </xsl:for-each>
230
231         <!-- 490 Series not traced, Ind1 = 0 -->
232         <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
233              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
234                         <xsl:call-template name="chopPunctuation">
235                             <xsl:with-param name="chopString">
236                                 <xsl:call-template name="subfieldSelect">
237                                     <xsl:with-param name="codes">av</xsl:with-param>
238                                 </xsl:call-template>
239                             </xsl:with-param>
240                         </xsl:call-template>
241             </a>
242                     <xsl:call-template name="part"/>
243         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
244         </xsl:for-each>
245         <!-- 490 Series traced, Ind1 = 1 -->
246         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
247             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
248                 <xsl:choose>
249                     <xsl:when test="marc:subfield[@code='w']">
250                         <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}">
251                             <xsl:call-template name="chopPunctuation">
252                                 <xsl:with-param name="chopString">
253                                     <xsl:call-template name="subfieldSelect">
254                                         <xsl:with-param name="codes">at</xsl:with-param>
255                                     </xsl:call-template>
256                                 </xsl:with-param>
257                             </xsl:call-template>
258                         </a>
259                     </xsl:when>
260                     <xsl:otherwise>
261                         <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='t']}">
262                             <xsl:call-template name="chopPunctuation">
263                                 <xsl:with-param name="chopString">
264                                     <xsl:call-template name="subfieldSelect">
265                                         <xsl:with-param name="codes">at</xsl:with-param>
266                                     </xsl:call-template>
267                                 </xsl:with-param>
268                             </xsl:call-template>
269                         </a>
270                         <xsl:call-template name="part"/>
271                     </xsl:otherwise>
272                 </xsl:choose>
273                 <xsl:text>: </xsl:text>
274                 <xsl:value-of  select="marc:subfield[@code='v']" />
275             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
276             </xsl:for-each>
277         </xsl:if>
278         </span>
279         </xsl:if>
280
281         <!-- Volumes of sets and traced series -->
282         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
283         <span class="results_summary"><span class="label">Volumes: </span>
284             <a>
285             <xsl:choose>
286             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
287                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
288             </xsl:when>
289             <xsl:otherwise>
290                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
291             </xsl:otherwise>
292             </xsl:choose>
293             <xsl:text>Show volumes</xsl:text>
294             </a>
295         </span>
296         </xsl:if>
297
298         <!-- Set -->
299         <xsl:if test="$leader19='c'">
300         <span class="results_summary"><span class="label">Set: </span>
301         <xsl:for-each select="marc:datafield[@tag=773]">
302             <a>
303             <xsl:choose>
304             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
305                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
306             </xsl:when>
307             <xsl:otherwise>
308                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
309             </xsl:otherwise>
310             </xsl:choose>
311             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
312             </a>
313             <xsl:choose>
314                 <xsl:when test="position()=last()"></xsl:when>
315                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
316             </xsl:choose>
317         </xsl:for-each>
318         </span>
319         </xsl:if>
320
321         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
322         <xsl:if test="$display880">
323             <xsl:call-template name="m880Select">
324                 <xsl:with-param name="basetags">260</xsl:with-param>
325                 <xsl:with-param name="codes">abcg</xsl:with-param>
326                 <xsl:with-param name="class">results_summary</xsl:with-param>
327                 <xsl:with-param name="label">Publisher: </xsl:with-param>
328             </xsl:call-template>
329         </xsl:if>
330
331         <xsl:if test="marc:datafield[@tag=260]">
332         <span class="results_summary"><span class="label">Publisher: </span>
333             <xsl:for-each select="marc:datafield[@tag=260]">
334                 <xsl:if test="marc:subfield[@code='b']">
335                 <a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}">
336                     <xsl:call-template name="subfieldSelect">
337                         <xsl:with-param name="codes">b</xsl:with-param>
338                     </xsl:call-template>
339                </a>
340                </xsl:if>
341                <xsl:text> </xsl:text>
342                 <xsl:call-template name="chopPunctuation">
343                   <xsl:with-param name="chopString">
344                     <xsl:call-template name="subfieldSelect">
345                         <xsl:with-param name="codes">acg</xsl:with-param>
346                     </xsl:call-template>
347                    </xsl:with-param>
348                </xsl:call-template>
349                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
350             </xsl:for-each>
351         </span>
352         </xsl:if>
353
354         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
355         <xsl:if test="$display880">
356             <xsl:call-template name="m880Select">
357                 <xsl:with-param name="basetags">250</xsl:with-param>
358                 <xsl:with-param name="codes">ab</xsl:with-param>
359                 <xsl:with-param name="class">results_summary</xsl:with-param>
360                 <xsl:with-param name="label">Edition: </xsl:with-param>
361             </xsl:call-template>
362         </xsl:if>
363
364         <xsl:if test="marc:datafield[@tag=250]">
365         <span class="results_summary"><span class="label">Edition: </span>
366             <xsl:for-each select="marc:datafield[@tag=250]">
367                 <xsl:call-template name="chopPunctuation">
368                   <xsl:with-param name="chopString">
369                     <xsl:call-template name="subfieldSelect">
370                         <xsl:with-param name="codes">ab</xsl:with-param>
371                     </xsl:call-template>
372                    </xsl:with-param>
373                </xsl:call-template>
374                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
375             </xsl:for-each>
376         </span>
377         </xsl:if>
378
379         <!-- Description: Alternate Graphic Representation (MARC 880) -->
380         <xsl:if test="$display880">
381             <xsl:call-template name="m880Select">
382                 <xsl:with-param name="basetags">300</xsl:with-param>
383                 <xsl:with-param name="codes">abceg</xsl:with-param>
384                 <xsl:with-param name="class">results_summary</xsl:with-param>
385                 <xsl:with-param name="label">Description: </xsl:with-param>
386             </xsl:call-template>
387         </xsl:if>
388
389         <xsl:if test="marc:datafield[@tag=300]">
390         <span class="results_summary"><span class="label">Description: </span>
391             <xsl:for-each select="marc:datafield[@tag=300]">
392                 <xsl:call-template name="chopPunctuation">
393                   <xsl:with-param name="chopString">
394                     <xsl:call-template name="subfieldSelect">
395                         <xsl:with-param name="codes">abceg</xsl:with-param>
396                     </xsl:call-template>
397                    </xsl:with-param>
398                </xsl:call-template>
399                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
400             </xsl:for-each>
401         </span>
402        </xsl:if>
403
404        <xsl:if test="marc:datafield[@tag=020]">
405         <span class="results_summary"><span class="label">ISBN: </span>
406         <xsl:for-each select="marc:datafield[@tag=020]">
407         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
408                 <xsl:value-of select="marc:subfield[@code='a']"/>
409                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
410         </xsl:for-each>
411         </span>
412         </xsl:if>
413
414         <xsl:if test="marc:datafield[@tag=022]">
415         <span class="results_summary"><span class="label">ISSN: </span>
416         <xsl:for-each select="marc:datafield[@tag=022]">
417                 <xsl:value-of select="marc:subfield[@code='a']"/>
418                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
419         </xsl:for-each>
420         </span>
421         </xsl:if>
422
423         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
424         <xsl:if test="$display880">
425             <xsl:call-template name="m880Select">
426                 <xsl:with-param name="basetags">246</xsl:with-param>
427                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
428                 <xsl:with-param name="class">results_summary</xsl:with-param>
429                 <xsl:with-param name="label">Other Title: </xsl:with-param>
430             </xsl:call-template>
431         </xsl:if>
432
433         <xsl:if test="marc:datafield[@tag=246]">
434         <span class="results_summary"><span class="label">Other Title: </span>
435             <xsl:for-each select="marc:datafield[@tag=246]">
436                 <xsl:call-template name="chopPunctuation">
437                   <xsl:with-param name="chopString">
438                     <xsl:call-template name="subfieldSelect">
439                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
440                     </xsl:call-template>
441                    </xsl:with-param>
442                </xsl:call-template>
443                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
444             </xsl:for-each>
445         </span>
446        </xsl:if>
447
448         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
449         <xsl:if test="$display880">
450             <xsl:call-template name="m880Select">
451                 <xsl:with-param name="basetags">130,240</xsl:with-param>
452                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
453                 <xsl:with-param name="class">results_summary</xsl:with-param>
454                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
455             </xsl:call-template>
456         </xsl:if>
457
458         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
459         <span class="results_summary"><span class="label">Uniform titles: </span>
460         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
461             <xsl:variable name="str">
462                 <xsl:for-each select="marc:subfield">
463                     <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
464                         <xsl:value-of select="text()"/>
465                         <xsl:text> </xsl:text>
466                      </xsl:if>
467                 </xsl:for-each>
468             </xsl:variable>
469             <xsl:call-template name="chopPunctuation">
470                 <xsl:with-param name="chopString">
471                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
472
473                 </xsl:with-param>
474             </xsl:call-template>
475             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
476         </xsl:for-each>
477         </span>
478         </xsl:if>
479
480         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
481             <span class="results_summary"><span class="label">Subject(s): </span>
482             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
483             <a>
484             <xsl:choose>
485             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
486                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
487             </xsl:when>
488             <xsl:otherwise>
489                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
490             </xsl:otherwise>
491             </xsl:choose>
492             <xsl:call-template name="chopPunctuation">
493                 <xsl:with-param name="chopString">
494                     <xsl:call-template name="subfieldSelect">
495                         <xsl:with-param name="codes">abcdtvxyz</xsl:with-param>
496                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
497                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
498                     </xsl:call-template>
499                 </xsl:with-param>
500             </xsl:call-template>
501             </a>
502             <xsl:choose>
503             <xsl:when test="position()=last()"></xsl:when>
504             <xsl:otherwise> | </xsl:otherwise>
505             </xsl:choose>
506
507             </xsl:for-each>
508             </span>
509         </xsl:if>
510
511         <xsl:if test="marc:datafield[@tag=856]">
512         <span class="results_summary"><span class="label">Online Resources: </span>
513         <xsl:for-each select="marc:datafield[@tag=856]">
514                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
515                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
516                                     <xsl:choose>
517                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
518                                         <xsl:call-template name="subfieldSelect">
519                                         <xsl:with-param name="codes">y3z</xsl:with-param>
520                                         </xsl:call-template>
521                                     </xsl:when>
522                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
523                                         <xsl:choose>
524                                         <xsl:when test="$URLLinkText!=''">
525                                                 <xsl:value-of select="$URLLinkText"/>
526                                         </xsl:when>
527                                         <xsl:otherwise>
528                                                 <xsl:text>Click here to access online</xsl:text>
529                                         </xsl:otherwise>
530                                         </xsl:choose>
531                                     </xsl:when>
532                                     </xsl:choose>
533                                     </a>
534                               </xsl:if>
535                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
536                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
537                                     <xsl:choose>
538                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
539                                         <xsl:call-template name="subfieldSelect">
540                                         <xsl:with-param name="codes">y3z</xsl:with-param>
541                                         </xsl:call-template>
542                                     </xsl:when>
543                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
544                                         <xsl:choose>
545                                         <xsl:when test="$URLLinkText!=''">
546                                                 <xsl:value-of select="$URLLinkText"/>
547                                         </xsl:when>
548                                         <xsl:otherwise>
549                                                 <xsl:text>Click here to access online</xsl:text>
550                                         </xsl:otherwise>
551                                         </xsl:choose>
552                                     </xsl:when>
553                                     </xsl:choose>
554                                     </a>
555                               </xsl:if>
556                                     <xsl:choose>
557                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
558                                     <xsl:otherwise> | </xsl:otherwise>
559                                     </xsl:choose>
560
561         </xsl:for-each>
562         </span>
563         </xsl:if>
564         <xsl:if test="marc:datafield[@tag=505]">
565         <xsl:for-each select="marc:datafield[@tag=505]">
566         <span class="results_summary">
567         <xsl:choose>
568         <xsl:when test="@ind1=1">
569             <span class="label">Incomplete contents:</span>
570         </xsl:when>
571         <xsl:when test="@ind1=1">
572             <span class="label">Partial contents:</span>
573         </xsl:when>
574         <xsl:otherwise>
575             <span class="label">Contents:</span>
576         </xsl:otherwise>
577         </xsl:choose>
578         <xsl:choose>
579         <xsl:when test="@ind2=0">
580             <xsl:for-each select="marc:subfield[@code='t']">
581                 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
582             </xsl:for-each>
583         </xsl:when>
584         <xsl:otherwise>
585             <xsl:call-template name="subfieldSelect">
586                 <xsl:with-param name="codes">au</xsl:with-param>
587             </xsl:call-template>
588         </xsl:otherwise>
589         </xsl:choose>
590         </span>
591         </xsl:for-each>
592         </xsl:if>
593
594         <!-- 773 -->
595         <xsl:if test="marc:datafield[@tag=773]">
596         <xsl:for-each select="marc:datafield[@tag=773]">
597         <xsl:if test="@ind1=0">
598         <span class="results_summary"><span class="label">
599         <xsl:choose>
600         <xsl:when test="@ind2=' '">
601             In:
602         </xsl:when>
603         <xsl:when test="@ind2=8">
604             <xsl:if test="marc:subfield[@code='i']">
605                 <xsl:value-of select="marc:subfield[@code='i']"/>
606             </xsl:if>
607         </xsl:when>
608         </xsl:choose>
609         </span>
610                 <xsl:variable name="f773">
611                     <xsl:call-template name="subfieldSelect">
612                         <xsl:with-param name="codes">at</xsl:with-param>
613                     </xsl:call-template>
614                 </xsl:variable>
615             <xsl:choose>
616                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
617                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
618                         <xsl:value-of select="translate($f773, '()', '')"/>
619                     </a>
620                 </xsl:when>
621                 <xsl:otherwise>
622                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
623                         <xsl:value-of select="$f773"/>
624                     </a>
625                 </xsl:otherwise>
626             </xsl:choose>
627         </span>
628
629         <xsl:if test="marc:subfield[@code='n']">
630             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
631         </xsl:if>
632
633         </xsl:if>
634         </xsl:for-each>
635         </xsl:if>
636
637         <xsl:for-each select="marc:datafield[@tag=520]">
638         <span class="results_summary"><span class="label">
639         <xsl:choose>
640           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
641           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
642           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
643           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
644           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
645           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
646         </xsl:choose>
647         </span>
648         <xsl:call-template name="subfieldSelect">
649           <xsl:with-param name="codes">abcu</xsl:with-param>
650         </xsl:call-template>
651         </span>
652         </xsl:for-each>
653
654         <!-- 866 holdings public note -->
655         <xsl:if test="marc:datafield[@tag=866]">
656         <span class="results_summary"><span class="label">Holdings Note: </span>
657         <xsl:for-each select="marc:datafield[@tag=866]">
658                 <xsl:value-of select="marc:subfield[@code='z']"/>
659                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
660         </xsl:for-each>
661         </span>
662         </xsl:if>
663
664         <!--  775 Other Edition  -->
665         <xsl:if test="marc:datafield[@tag=775]">
666         <span class="results_summary"><span class="label">Other Editions: </span>
667         <xsl:for-each select="marc:datafield[@tag=775]">
668             <xsl:if test="marc:subfield[@code='i']">
669                 <xsl:call-template name="subfieldSelect">
670                     <xsl:with-param name="codes">i</xsl:with-param>
671                 </xsl:call-template>
672                 <xsl:text>: </xsl:text>
673             </xsl:if>
674             <a>
675             <xsl:choose>
676             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
677                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
678             </xsl:when>
679             <xsl:otherwise>
680                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
681             </xsl:otherwise>
682             </xsl:choose>
683             <xsl:call-template name="subfieldSelect">
684                 <xsl:with-param name="codes">t</xsl:with-param>
685             </xsl:call-template>
686             </a>
687             <xsl:choose>
688                 <xsl:when test="position()=last()"></xsl:when>
689                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
690             </xsl:choose>
691         </xsl:for-each>
692         </span>
693         </xsl:if>
694
695         <!-- 780 -->
696         <xsl:if test="marc:datafield[@tag=780]">
697         <xsl:for-each select="marc:datafield[@tag=780]">
698         <xsl:if test="@ind1=0">
699         <span class="results_summary">
700         <xsl:choose>
701         <xsl:when test="@ind2=0">
702             <span class="label">Continues:</span>
703         </xsl:when>
704         <xsl:when test="@ind2=1">
705             <span class="label">Continues in part:</span>
706         </xsl:when>
707         <xsl:when test="@ind2=2">
708             <span class="label">Supersedes:</span>
709         </xsl:when>
710         <xsl:when test="@ind2=3">
711             <span class="label">Supersedes in part:</span>
712         </xsl:when>
713         <xsl:when test="@ind2=4">
714             <span class="label">Formed by the union: ... and: ...</span>
715         </xsl:when>
716         <xsl:when test="@ind2=5">
717             <span class="label">Absorbed:</span>
718         </xsl:when>
719         <xsl:when test="@ind2=6">
720             <span class="label">Absorbed in part:</span>
721         </xsl:when>
722         <xsl:when test="@ind2=7">
723             <span class="label">Separated from:</span>
724         </xsl:when>
725         </xsl:choose>
726                 <xsl:variable name="f780">
727                     <xsl:call-template name="subfieldSelect">
728                         <xsl:with-param name="codes">at</xsl:with-param>
729                     </xsl:call-template>
730                 </xsl:variable>
731             <xsl:choose>
732                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
733                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
734                         <xsl:value-of select="translate($f780, '()', '')"/>
735                     </a>
736                 </xsl:when>
737                 <xsl:otherwise>
738                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
739                         <xsl:value-of select="translate($f780, '()', '')"/>
740                     </a>
741                 </xsl:otherwise>
742             </xsl:choose>
743         </span>
744
745         <xsl:if test="marc:subfield[@code='n']">
746             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
747         </xsl:if>
748
749         </xsl:if>
750         </xsl:for-each>
751         </xsl:if>
752
753         <!-- 785 -->
754         <xsl:if test="marc:datafield[@tag=785]">
755         <xsl:for-each select="marc:datafield[@tag=785]">
756         <xsl:if test="@ind1=0">
757         <span class="results_summary">
758         <xsl:choose>
759         <xsl:when test="@ind2=0">
760             <span class="label">Continued by:</span>
761         </xsl:when>
762         <xsl:when test="@ind2=1">
763             <span class="label">Continued in part by:</span>
764         </xsl:when>
765         <xsl:when test="@ind2=2">
766             <span class="label">Superseded by:</span>
767         </xsl:when>
768         <xsl:when test="@ind2=3">
769             <span class="label">Superseded in part by:</span>
770         </xsl:when>
771         <xsl:when test="@ind2=4">
772             <span class="label">Absorbed by:</span>
773         </xsl:when>
774         <xsl:when test="@ind2=5">
775             <span class="label">Absorbed in part by:</span>
776         </xsl:when>
777         <xsl:when test="@ind2=6">
778             <span class="label">Split into .. and ...:</span>
779         </xsl:when>
780         <xsl:when test="@ind2=7">
781             <span class="label">Merged with ... to form ...</span>
782         </xsl:when>
783         <xsl:when test="@ind2=8">
784             <span class="label">Changed back to:</span>
785         </xsl:when>
786
787         </xsl:choose>
788                    <xsl:variable name="f785">
789                     <xsl:call-template name="subfieldSelect">
790                         <xsl:with-param name="codes">at</xsl:with-param>
791                     </xsl:call-template>
792                 </xsl:variable>
793
794             <xsl:choose>
795                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
796                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
797                         <xsl:value-of select="translate($f785, '()', '')"/>
798                     </a>
799                 </xsl:when>
800                 <xsl:otherwise>
801                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
802                         <xsl:value-of select="translate($f785, '()', '')"/>
803                     </a>
804                 </xsl:otherwise>
805             </xsl:choose>
806
807         </span>
808
809         <xsl:if test="marc:subfield[@code='n']">
810             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
811         </xsl:if>
812
813         </xsl:if>
814         </xsl:for-each>
815         </xsl:if>
816
817     </xsl:template>
818
819     <xsl:template name="nameABCDQ">
820             <xsl:call-template name="chopPunctuation">
821                 <xsl:with-param name="chopString">
822                     <xsl:call-template name="subfieldSelect">
823                         <xsl:with-param name="codes">aq</xsl:with-param>
824                     </xsl:call-template>
825                 </xsl:with-param>
826                 <xsl:with-param name="punctuation">
827                     <xsl:text>:,;/ </xsl:text>
828                 </xsl:with-param>
829             </xsl:call-template>
830         <xsl:call-template name="termsOfAddress"/>
831     </xsl:template>
832
833     <xsl:template name="nameABCDN">
834         <xsl:for-each select="marc:subfield[@code='a']">
835                 <xsl:call-template name="chopPunctuation">
836                     <xsl:with-param name="chopString" select="."/>
837                 </xsl:call-template>
838         </xsl:for-each>
839         <xsl:for-each select="marc:subfield[@code='b']">
840                 <xsl:value-of select="."/>
841         </xsl:for-each>
842         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
843                 <xsl:call-template name="subfieldSelect">
844                     <xsl:with-param name="codes">cdn</xsl:with-param>
845                 </xsl:call-template>
846         </xsl:if>
847     </xsl:template>
848
849     <xsl:template name="nameACDEQ">
850             <xsl:call-template name="subfieldSelect">
851                 <xsl:with-param name="codes">acdeq</xsl:with-param>
852             </xsl:call-template>
853     </xsl:template>
854     <xsl:template name="termsOfAddress">
855         <xsl:if test="marc:subfield[@code='b' or @code='c']">
856             <xsl:call-template name="chopPunctuation">
857                 <xsl:with-param name="chopString">
858                     <xsl:call-template name="subfieldSelect">
859                         <xsl:with-param name="codes">bc</xsl:with-param>
860                     </xsl:call-template>
861                 </xsl:with-param>
862             </xsl:call-template>
863         </xsl:if>
864     </xsl:template>
865
866     <xsl:template name="part">
867         <xsl:variable name="partNumber">
868             <xsl:call-template name="specialSubfieldSelect">
869                 <xsl:with-param name="axis">n</xsl:with-param>
870                 <xsl:with-param name="anyCodes">n</xsl:with-param>
871                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
872             </xsl:call-template>
873         </xsl:variable>
874         <xsl:variable name="partName">
875             <xsl:call-template name="specialSubfieldSelect">
876                 <xsl:with-param name="axis">p</xsl:with-param>
877                 <xsl:with-param name="anyCodes">p</xsl:with-param>
878                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
879             </xsl:call-template>
880         </xsl:variable>
881         <xsl:if test="string-length(normalize-space($partNumber))">
882                 <xsl:call-template name="chopPunctuation">
883                     <xsl:with-param name="chopString" select="$partNumber"/>
884                 </xsl:call-template>
885         </xsl:if>
886         <xsl:if test="string-length(normalize-space($partName))">
887                 <xsl:call-template name="chopPunctuation">
888                     <xsl:with-param name="chopString" select="$partName"/>
889                 </xsl:call-template>
890         </xsl:if>
891     </xsl:template>
892
893     <xsl:template name="specialSubfieldSelect">
894         <xsl:param name="anyCodes"/>
895         <xsl:param name="axis"/>
896         <xsl:param name="beforeCodes"/>
897         <xsl:param name="afterCodes"/>
898         <xsl:variable name="str">
899             <xsl:for-each select="marc:subfield">
900                 <xsl:if test="contains($anyCodes, @code)      or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis])      or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
901                     <xsl:value-of select="text()"/>
902                     <xsl:text> </xsl:text>
903                 </xsl:if>
904             </xsl:for-each>
905         </xsl:variable>
906         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
907     </xsl:template>
908 </xsl:stylesheet>