Bug 32794: (follow-up) Replace code by new function (template)
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / xslt / MARC21slim2OPACResults.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>
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   xmlns:exsl="http://exslt.org/common"
9   xmlns:str="http://exslt.org/strings"
10   exclude-result-prefixes="marc items str" extension-element-prefixes="exsl">
11     <xsl:import href="MARC21slimUtils.xsl"/>
12     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
13
14     <xsl:key name="item-by-status" match="items:item" use="items:status"/>
15
16     <xsl:template match="/">
17             <xsl:apply-templates/>
18     </xsl:template>
19     <xsl:template match="marc:record">
20
21         <xsl:variable name="itemcount" select="count(items:items/items:item)"/>
22
23         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
24         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
25
26     <xsl:variable name="OPACResultsMaxItems" select="number(marc:sysprefs/marc:syspref[@name='OPACResultsMaxItems']+0)"/>
27     <xsl:variable name="OPACResultsMaxItemsUnavailable" select="number(marc:sysprefs/marc:syspref[@name='OPACResultsMaxItemsUnavailable']+0)"/>
28     <xsl:variable name="OPACResultsUnavailableGroupingBy" select="marc:sysprefs/marc:syspref[@name='OPACResultsUnavailableGroupingBy']"/>
29     <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
30     <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
31     <xsl:variable name="OPACResultsLibrary" select="marc:sysprefs/marc:syspref[@name='OPACResultsLibrary']"/>
32     <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
33     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
34     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
35     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
36     <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
37     <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
38     <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>
39     <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>
40     <xsl:variable name="OPACItemLocation" select="marc:sysprefs/marc:syspref[@name='OPACItemLocation']"/>
41     <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
42     <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/>
43         <xsl:variable name="leader" select="marc:leader"/>
44         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
45         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
46         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
47         <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
48         <xsl:variable name="isbn" select="marc:datafield[@tag=020]/marc:subfield[@code='a']"/>
49         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
50         <xsl:variable name="typeOf008">
51             <xsl:choose>
52                 <xsl:when test="$leader19='a'">ST</xsl:when>
53                 <xsl:when test="$leader6='a'">
54                     <xsl:choose>
55                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
56                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">CR</xsl:when>
57                     </xsl:choose>
58                 </xsl:when>
59                 <xsl:when test="$leader6='t'">BK</xsl:when>
60                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
61                 <xsl:when test="$leader6='m'">CF</xsl:when>
62                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
63                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
64                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
65                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
66             </xsl:choose>
67         </xsl:variable>
68         <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
69         <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
70         <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
71         <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
72         <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
73         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
74         <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
75         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
76         <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
77
78         <xsl:variable name="physicalDescription">
79             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
80                 reformatted digital
81             </xsl:if>
82             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
83                 digitized microfilm
84             </xsl:if>
85             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
86                 digitized other analog
87             </xsl:if>
88
89             <xsl:variable name="check008-23">
90                 <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='CR' or $typeOf008='MX'">
91                     <xsl:value-of select="true()"></xsl:value-of>
92                 </xsl:if>
93             </xsl:variable>
94             <xsl:variable name="check008-29">
95                 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
96                     <xsl:value-of select="true()"></xsl:value-of>
97                 </xsl:if>
98             </xsl:variable>
99             <xsl:choose>
100                 <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
101                     braille
102                 </xsl:when>
103                 <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='CR') and ($controlField008-23=' ' or $controlField008='r'))">
104                     print
105                 </xsl:when>
106                 <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
107                     electronic
108                 </xsl:when>
109                 <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
110                     microfiche
111                 </xsl:when>
112                 <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
113                     microfilm
114                 </xsl:when>
115                 <xsl:when test="($controlField008-23='d' and ($typeOf008='BK' or $typeOf008='CR'))">
116                     large print
117                 </xsl:when>
118             </xsl:choose>
119 <!--
120             <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
121                     <xsl:call-template name="chopBrackets">
122                         <xsl:with-param name="chopString">
123                             <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"></xsl:value-of>
124                         </xsl:with-param>
125                     </xsl:call-template>
126             </xsl:if>
127             <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
128                     <xsl:call-template name="chopBrackets">
129                         <xsl:with-param name="chopString">
130                             <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"></xsl:value-of>
131                         </xsl:with-param>
132                     </xsl:call-template>
133             </xsl:if>
134             <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
135                     <xsl:call-template name="chopBrackets">
136                         <xsl:with-param name="chopString">
137                             <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"></xsl:value-of>
138                         </xsl:with-param>
139                     </xsl:call-template>
140             </xsl:if>
141             <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
142                     <xsl:call-template name="chopBrackets">
143                         <xsl:with-param name="chopString">
144                             <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"></xsl:value-of>
145                         </xsl:with-param>
146                     </xsl:call-template>
147             </xsl:if>
148             <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
149                     <xsl:call-template name="chopBrackets">
150                         <xsl:with-param name="chopString">
151                             <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"></xsl:value-of>
152                         </xsl:with-param>
153                     </xsl:call-template>
154             </xsl:if>
155             <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
156                     <xsl:call-template name="chopBrackets">
157                         <xsl:with-param name="chopString">
158                             <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"></xsl:value-of>
159                         </xsl:with-param>
160                     </xsl:call-template>
161             </xsl:if>
162             <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
163                     <xsl:value-of select="."></xsl:value-of>
164             </xsl:for-each>
165             <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
166                 <xsl:choose>
167                     <xsl:when test="substring(text(),14,1)='a'">
168                         access
169                     </xsl:when>
170                     <xsl:when test="substring(text(),14,1)='p'">
171                         preservation
172                     </xsl:when>
173                     <xsl:when test="substring(text(),14,1)='r'">
174                         replacement
175                     </xsl:when>
176                 </xsl:choose>
177             </xsl:for-each>
178 -->
179             <xsl:variable name="controlField007" select="marc:controlfield[@tag=007]"/>
180             <xsl:variable name="cf007ss11" select="substring($controlField007,1,1)"/>
181             <xsl:variable name="cf007ss21" select="substring($controlField007,2,1)"/>
182             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'b'">
183                 chip cartridge
184             </xsl:if>
185             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'c'">
186                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="computer optical disc cartridge" class="format"/>
187             </xsl:if>
188             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'j'">
189                 magnetic disc
190             </xsl:if>
191             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'm'">
192                 magneto-optical disc
193             </xsl:if>
194             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'o'">
195                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="optical disc" class="format"/>
196             </xsl:if>
197             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'r'">
198                 available online
199                 <img src="/opac-tmpl/lib/famfamfam/drive_web.png" alt="remote" class="format"/>
200             </xsl:if>
201             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'a'">
202                 tape cartridge
203             </xsl:if>
204             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'f'">
205                 tape cassette
206             </xsl:if>
207             <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'h'">
208                 tape reel
209             </xsl:if>
210
211             <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'a'">
212                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="celestial globe" class="format"/>
213             </xsl:if>
214             <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'e'">
215                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="earth moon globe" class="format"/>
216             </xsl:if>
217             <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'b'">
218                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="planetary or lunar globe" class="format"/>
219             </xsl:if>
220             <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'c'">
221                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="terrestrial globe" class="format"/>
222             </xsl:if>
223
224             <xsl:if test="$cf007ss11 = 'o' and $cf007ss21 = 'o'">
225                 kit
226             </xsl:if>
227
228             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'd'">
229                 atlas
230             </xsl:if>
231             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'g'">
232                 diagram
233             </xsl:if>
234             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'j'">
235                 map
236             </xsl:if>
237             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'q'">
238                 model
239             </xsl:if>
240             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'k'">
241                 profile
242             </xsl:if>
243             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'r'">
244                 remote-sensing image
245             </xsl:if>
246             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 's'">
247                 section
248             </xsl:if>
249             <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'y'">
250                 view
251             </xsl:if>
252
253             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'a'">
254                 aperture card
255             </xsl:if>
256             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'e'">
257                 microfiche
258             </xsl:if>
259             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'f'">
260                 microfiche cassette
261             </xsl:if>
262             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'b'">
263                 microfilm cartridge
264             </xsl:if>
265             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'c'">
266                 microfilm cassette
267             </xsl:if>
268             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'd'">
269                 microfilm reel
270             </xsl:if>
271             <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'g'">
272                 microopaque
273             </xsl:if>
274             <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'c'">
275                 film cartridge
276             </xsl:if>
277             <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'f'">
278                 film cassette
279             </xsl:if>
280             <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'r'">
281                 film reel
282             </xsl:if>
283             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'n'">
284                 <img src="/opac-tmpl/lib/famfamfam/chart_curve.png" alt="chart" class="format"/>
285             </xsl:if>
286             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'c'">
287                 collage
288             </xsl:if>
289             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'd'">
290                  <img src="/opac-tmpl/lib/famfamfam/pencil.png" alt="drawing" class="format"/>
291             </xsl:if>
292             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'o'">
293                 <img src="/opac-tmpl/lib/famfamfam/note.png" alt="flash card" class="format"/>
294             </xsl:if>
295             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'e'">
296                 <img src="/opac-tmpl/lib/famfamfam/paintbrush.png" alt="painting" class="format"/>
297             </xsl:if>
298             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'f'">
299                 photomechanical print
300             </xsl:if>
301             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'g'">
302                 photonegative
303             </xsl:if>
304             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'h'">
305                 photoprint
306             </xsl:if>
307             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'i'">
308                 <img src="/opac-tmpl/lib/famfamfam/picture.png" alt="picture" class="format"/>
309             </xsl:if>
310             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'j'">
311                 print
312             </xsl:if>
313             <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'l'">
314                 technical drawing
315             </xsl:if>
316             <xsl:if test="$cf007ss11 = 'q' and $cf007ss21 = 'q'">
317                 <img src="/opac-tmpl/lib/famfamfam/script.png" alt="notated music" class="format"/>
318             </xsl:if>
319             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'd'">
320                 filmslip
321             </xsl:if>
322             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'c'">
323                 filmstrip cartridge
324             </xsl:if>
325             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'o'">
326                 filmstrip roll
327             </xsl:if>
328             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'f'">
329                 other filmstrip type
330             </xsl:if>
331             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 's'">
332                 <img src="/opac-tmpl/lib/famfamfam/pictures.png" alt="slide" class="format"/>
333             </xsl:if>
334             <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 't'">
335                 transparency
336             </xsl:if>
337             <xsl:if test="$cf007ss11 = 'r' and $cf007ss21 = 'r'">
338                 remote-sensing image
339             </xsl:if>
340             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'e'">
341                 cylinder
342             </xsl:if>
343             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'q'">
344                 roll
345             </xsl:if>
346             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'g'">
347                 sound cartridge
348             </xsl:if>
349             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 's'">
350                 sound cassette
351             </xsl:if>
352             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'd'">
353                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="sound disc" class="format"/>
354             </xsl:if>
355             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 't'">
356                 sound-tape reel
357             </xsl:if>
358             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'i'">
359                 sound-track film
360             </xsl:if>
361             <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'w'">
362                 wire recording
363             </xsl:if>
364             <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'c'">
365                 combination
366             </xsl:if>
367             <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'b'">
368                 braille
369             </xsl:if>
370             <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'a'">
371                 moon
372             </xsl:if>
373             <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'd'">
374                 tactile, with no writing system
375             </xsl:if>
376             <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'c'">
377                 braille
378             </xsl:if>
379             <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'b'">
380                 <img src="/opac-tmpl/lib/famfamfam/magnifier.png" alt="large print" class="format"/>
381             </xsl:if>
382             <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'a'">
383                 regular print
384             </xsl:if>
385             <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'd'">
386                 text in looseleaf binder
387             </xsl:if>
388             <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'c'">
389                 videocartridge
390             </xsl:if>
391             <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'f'">
392                 videocassette
393             </xsl:if>
394             <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'd'">
395                 <img src="/opac-tmpl/lib/famfamfam/dvd.png" alt="videodisc" class="format"/>
396             </xsl:if>
397             <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'r'">
398                 videoreel
399             </xsl:if>
400 <!--
401             <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">
402                     <xsl:value-of select="."></xsl:value-of>
403             </xsl:for-each>
404             <xsl:for-each select="marc:datafield[@tag=300]">
405                     <xsl:call-template name="subfieldSelect">
406                         <xsl:with-param name="codes">abce</xsl:with-param>
407                     </xsl:call-template>
408             </xsl:for-each>
409 -->
410         </xsl:variable>
411
412         <!-- Title Statement: Alternate Graphic Representation (MARC 880) -->
413         <xsl:if test="$display880">
414            <xsl:call-template name="m880Select">
415               <xsl:with-param name="basetags">245</xsl:with-param>
416               <xsl:with-param name="codes">abhfgknps</xsl:with-param>
417               <xsl:with-param name="bibno"><xsl:value-of  select="$biblionumber"/></xsl:with-param>
418            </xsl:call-template>
419         </xsl:if>
420
421     <a>
422         <xsl:attribute name="href">
423             <xsl:call-template name="buildBiblioDefaultViewURL">
424                 <xsl:with-param name="BiblioDefaultView">
425                     <xsl:value-of select="$BiblioDefaultView"/>
426                 </xsl:with-param>
427             </xsl:call-template>
428             <xsl:value-of select="str:encode-uri($biblionumber, true())"/>
429         </xsl:attribute>
430         <xsl:attribute name="class"><xsl:value-of select="'title'" /></xsl:attribute>
431
432         <xsl:if test="marc:datafield[@tag=245]">
433             <xsl:for-each select="marc:datafield[@tag=245]">
434                 <xsl:call-template name="subfieldSelect">
435                     <xsl:with-param name="codes">a</xsl:with-param>
436                 </xsl:call-template>
437                 <xsl:text> </xsl:text>
438                 <!-- 13381 add additional subfields-->
439                 <!-- bz 17625 adding subfields f and g -->
440                 <xsl:for-each select="marc:subfield[contains('bcfghknps', @code)]">
441                     <xsl:choose>
442                         <xsl:when test="@code='h'">
443                             <!--  13381 Span class around subfield h so it can be suppressed via css -->
444                             <span class="title_medium"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
445                         </xsl:when>
446                         <xsl:when test="@code='c'">
447                             <!--  13381 Span class around subfield c so it can be suppressed via css -->
448                             <span class="title_resp_stmt"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
449                         </xsl:when>
450                         <xsl:otherwise>
451                             <xsl:apply-templates/>
452                             <xsl:text> </xsl:text>
453                         </xsl:otherwise>
454                     </xsl:choose>
455                 </xsl:for-each>
456             </xsl:for-each>
457         </xsl:if>
458     </a>
459
460     <!-- OpenURL -->
461     <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
462     <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
463     <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
464     <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
465
466     <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
467       <xsl:variable name="openurltext">
468         <xsl:choose>
469           <xsl:when test="$OpenURLText != ''">
470             <xsl:value-of select="$OpenURLText" />
471           </xsl:when>
472           <xsl:otherwise>
473             <xsl:text>OpenURL</xsl:text>
474           </xsl:otherwise>
475         </xsl:choose>
476       </xsl:variable>
477
478       <div class="results_summary"><a>
479         <xsl:attribute name="href">
480           <xsl:value-of select="$OpenURLResolverURL" />
481         </xsl:attribute>
482         <xsl:attribute name="title">
483           <xsl:value-of select="$openurltext" />
484         </xsl:attribute>
485         <xsl:attribute name="class">
486           <xsl:text>OpenURL</xsl:text>
487         </xsl:attribute>
488         <xsl:if test="$OPACURLOpenInNewWindow='1'">
489           <xsl:attribute name="target">
490             <xsl:text>_blank</xsl:text>
491           </xsl:attribute>
492         </xsl:if>
493         <xsl:choose>
494           <xsl:when test="$OpenURLImageLocation != ''">
495             <img>
496               <xsl:attribute name="src">
497                 <xsl:value-of select="$OpenURLImageLocation" />
498               </xsl:attribute>
499             </img>
500           </xsl:when>
501           <xsl:otherwise>
502             <xsl:value-of select="$openurltext" />
503           </xsl:otherwise>
504         </xsl:choose>
505       </a></div>
506     </xsl:if>
507     <!-- End of OpenURL -->
508
509     <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
510     <xsl:if test="$display880">
511       <xsl:call-template name="m880Select">
512       <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
513       <xsl:with-param name="codes">abc</xsl:with-param>
514       </xsl:call-template>
515     </xsl:if>
516
517     <xsl:choose>
518     <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]">
519
520         <span class="byAuthor">by</span><xsl:text> </xsl:text>
521         <ul class="author resource_list">
522         <!-- #13383 -->
523         <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700 or @tag=110 or @tag=710 or @tag=111 or @tag=711) and @ind1!='z']">
524             <li>
525                 <a>
526                     <xsl:choose>
527                         <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
528                             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
529                         </xsl:when>
530                         <xsl:otherwise>
531                             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
532                         </xsl:otherwise>
533                     </xsl:choose>
534                     <xsl:call-template name="chopPunctuation">
535                         <xsl:with-param name="chopString">
536                             <xsl:call-template name="subfieldSelect">
537                                 <xsl:with-param name="codes">
538                                     <xsl:choose>
539                                         <!-- #13383 include subfield e for field 111  -->
540                                         <xsl:when test="@tag=111 or @tag=711">aeq</xsl:when>
541                                         <xsl:when test="@tag=110 or @tag=710">ab</xsl:when>
542                                         <xsl:otherwise>abcjq</xsl:otherwise>
543                                     </xsl:choose>
544                                 </xsl:with-param>
545                             </xsl:call-template>
546                         </xsl:with-param>
547                         <xsl:with-param name="punctuation">
548                             <xsl:text>:,;/ </xsl:text>
549                         </xsl:with-param>
550                     </xsl:call-template>
551                     <!-- Display title portion for 110 and 710 fields -->
552                     <xsl:if test="(@tag=110 or @tag=710) and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
553                         <span class="titleportion">
554                         <xsl:choose>
555                             <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
556                             <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
557                         </xsl:choose>
558                         <xsl:call-template name="chopPunctuation">
559                             <xsl:with-param name="chopString">
560                             <xsl:call-template name="subfieldSelect">
561                                 <xsl:with-param name="codes">cdnt</xsl:with-param>
562                             </xsl:call-template>
563                             </xsl:with-param>
564                         </xsl:call-template>
565                         </span>
566                     </xsl:if>
567                     <!-- Display title portion for 111 and 711 fields -->
568                     <xsl:if test="(@tag=111 or @tag=711) and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
569                             <span class="titleportion">
570                             <xsl:choose>
571                                 <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
572                                 <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
573                             </xsl:choose>
574
575                             <xsl:call-template name="chopPunctuation">
576                                 <xsl:with-param name="chopString">
577                                 <xsl:call-template name="subfieldSelect">
578                                     <xsl:with-param name="codes">cdgnt</xsl:with-param>
579                                 </xsl:call-template>
580                                 </xsl:with-param>
581                             </xsl:call-template>
582                             </span>
583                     </xsl:if>
584                     <!-- Display dates for 100 and 700 fields -->
585                     <xsl:if test="(@tag=100 or @tag=700) and marc:subfield[@code='d']">
586                         <span class="authordates">
587                         <xsl:text>, </xsl:text>
588                         <xsl:call-template name="chopPunctuation">
589                             <xsl:with-param name="chopString">
590                                 <xsl:call-template name="subfieldSelect">
591                                 <xsl:with-param name="codes">d</xsl:with-param>
592                                 </xsl:call-template>
593                             </xsl:with-param>
594                         </xsl:call-template>
595                         </span>
596                     </xsl:if>
597                     <!-- Display title portion for 100 and 700 fields -->
598                     <xsl:if test="@tag=700 and marc:subfield[@code='t']">
599                         <span class="titleportion">
600                         <xsl:text>. </xsl:text>
601                         <xsl:call-template name="chopPunctuation">
602                             <xsl:with-param name="chopString">
603                                 <xsl:call-template name="subfieldSelect">
604                                     <xsl:with-param name="codes">t</xsl:with-param>
605                                 </xsl:call-template>
606                             </xsl:with-param>
607                         </xsl:call-template>
608                         </span>
609                     </xsl:if>
610                     <!-- Display relators for 1XX and 7XX fields -->
611                     <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
612                         <span class="relatorcode">
613                             <xsl:text> [</xsl:text>
614                             <xsl:choose>
615                                 <xsl:when test="@tag=111 or @tag=711">
616                                     <xsl:choose>
617                                         <!-- Prefer j over 4 for 111 and 711 -->
618                                         <xsl:when test="marc:subfield[@code='j']">
619                                             <xsl:for-each select="marc:subfield[@code='j']">
620                                                 <xsl:value-of select="."/>
621                                                 <xsl:if test="position() != last()">, </xsl:if>
622                                             </xsl:for-each>
623                                         </xsl:when>
624                                         <xsl:otherwise>
625                                             <xsl:for-each select="marc:subfield[@code=4]">
626                                                 <xsl:value-of select="."/>
627                                                 <xsl:if test="position() != last()">, </xsl:if>
628                                             </xsl:for-each>
629                                         </xsl:otherwise>
630                                     </xsl:choose>
631                                 </xsl:when>
632                                 <!-- Prefer e over 4 on 100 and 110 -->
633                                 <xsl:when test="marc:subfield[@code='e']">
634                                     <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
635                                         <xsl:value-of select="."/>
636                                         <xsl:if test="position() != last()">, </xsl:if>
637                                     </xsl:for-each>
638                                 </xsl:when>
639                                 <xsl:otherwise>
640                                     <xsl:for-each select="marc:subfield[@code=4]">
641                                         <xsl:value-of select="."/>
642                                         <xsl:if test="position() != last()">, </xsl:if>
643                                     </xsl:for-each>
644                                 </xsl:otherwise>
645                             </xsl:choose>
646                             <xsl:text>]</xsl:text>
647                         </span>
648                     </xsl:if>
649                 </a>
650             </li>
651         </xsl:for-each>
652         </ul>
653     </xsl:when>
654     </xsl:choose>
655
656     <xsl:call-template name="show-series">
657         <xsl:with-param name="searchurl">/cgi-bin/koha/opac-search.pl</xsl:with-param>
658         <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
659         <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
660     </xsl:call-template>
661
662     <xsl:if test="marc:datafield[@tag=250]">
663     <div class="results_summary edition">
664     <span class="label">Edition: </span>
665             <xsl:for-each select="marc:datafield[@tag=250]">
666                     <xsl:call-template name="subfieldSelect">
667                         <xsl:with-param name="codes">ab</xsl:with-param>
668                     </xsl:call-template>
669             </xsl:for-each>
670         </div>
671     </xsl:if>
672
673 <xsl:if test="$DisplayOPACiconsXSLT!='0'">
674     <div class="results_summary type">
675     <xsl:if test="$typeOf008!=''">
676     <span class="results_material_type">
677         <span class="label">Material type: </span>
678             <xsl:choose>
679                 <xsl:when test="$leader19='a'"><img src="/opac-tmpl/lib/famfamfam/ST.png" alt="Set" class="materialtype mt_icon_ST"/> Set</xsl:when>
680                 <xsl:when test="$leader6='a'">
681                     <xsl:choose>
682                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'"><img src="/opac-tmpl/lib/famfamfam/BK.png" alt="Text" class="materialtype mt_icon_BK"/> Text</xsl:when>
683                         <xsl:when test="$leader7='i' or $leader7='s'"><img src="/opac-tmpl/lib/famfamfam/SE.png" alt="Continuing resource" class="materialtype mt_icon_SE"/> Continuing resource</xsl:when>
684                         <xsl:when test="$leader7='a' or $leader7='b'"><img src="/opac-tmpl/lib/famfamfam/AR.png" alt="Article" class="materialtype mt_icon_AR"/> Article</xsl:when>
685                     </xsl:choose>
686                 </xsl:when>
687                 <xsl:when test="$leader6='t'"><img src="/opac-tmpl/lib/famfamfam/BK.png" alt="Text" class="materialtype mt_icon_BK"/> Text</xsl:when>
688                 <xsl:when test="$leader6='o'"><img src="/opac-tmpl/lib/famfamfam/MM.png" alt="Kit" class="materialtype mt_icon_MM"/> Kit</xsl:when>
689                 <xsl:when test="$leader6='p'"><img src="/opac-tmpl/lib/famfamfam/MM.png" alt="Mixed materials" class="materialtype mt_icon_MM"/>Mixed materials</xsl:when>
690                 <xsl:when test="$leader6='m'"><img src="/opac-tmpl/lib/famfamfam/CF.png" alt="Computer file" class="materialtype mt_icon_CF"/> Computer file</xsl:when>
691                 <xsl:when test="$leader6='e' or $leader6='f'"><img src="/opac-tmpl/lib/famfamfam/MP.png" alt="Map" class="materialtype mt_icon_MP"/> Map</xsl:when>
692                 <xsl:when test="$leader6='g'"><img src="/opac-tmpl/lib/famfamfam/VM.png" alt="Film" class="materialtype mt_icon_VM"/> Film</xsl:when>
693                 <xsl:when test="$leader6='k'"><img src="/opac-tmpl/lib/famfamfam/GR.png" alt="Picture" class="materialtype mt_icon_GR"/> Picture</xsl:when>
694                 <xsl:when test="$leader6='r'"><img src="/opac-tmpl/lib/famfamfam/OB.png" alt="Object" class="materialtype mt_icon_OB"/> Object</xsl:when>
695                 <xsl:when test="$leader6='c' or $leader6='d'"><img src="/opac-tmpl/lib/famfamfam/PR.png" alt="Score" class="materialtype mt_icon_PR"/> Score</xsl:when>
696                 <xsl:when test="$leader6='i'"><img src="/opac-tmpl/lib/famfamfam/MU.png" alt="Sound" class="materialtype mt_icon_MU"/> Sound</xsl:when>
697                 <xsl:when test="$leader6='j'"><img src="/opac-tmpl/lib/famfamfam/PR.png" alt="Music" class="materialtype mt_icon_PR"/> Music</xsl:when>
698             </xsl:choose>
699     </span>
700     </xsl:if>
701     <xsl:if test="string-length(normalize-space($physicalDescription))">
702         <span class="results_format">
703             <span class="label">; Format: </span><xsl:copy-of select="$physicalDescription"></xsl:copy-of>
704         </span>
705     </xsl:if>
706
707         <xsl:if test="$controlField008-21 or $controlField008-22 or $controlField008-24 or $controlField008-26 or $controlField008-29 or $controlField008-34 or $controlField008-33 or $controlField008-30-31 or $controlField008-33">
708
709         <xsl:if test="$typeOf008='CR'">
710         <span class="results_typeofcontinuing">
711         <xsl:if test="$controlField008-21 and $controlField008-21 !='|' and $controlField008-21 !=' '">
712         <span class="label">; Type of continuing resource: </span>
713         </xsl:if>
714             <xsl:choose>
715                 <xsl:when test="$controlField008-21='d'">
716                     <img src="/opac-tmpl/lib/famfamfam/database.png" alt="database" class="format"/>
717                 </xsl:when>
718                 <xsl:when test="$controlField008-21='l'">
719                     loose-leaf
720                 </xsl:when>
721                 <xsl:when test="$controlField008-21='m'">
722                     series
723                 </xsl:when>
724                 <xsl:when test="$controlField008-21='n'">
725                     newspaper
726                 </xsl:when>
727                 <xsl:when test="$controlField008-21='p'">
728                     periodical
729                 </xsl:when>
730                 <xsl:when test="$controlField008-21='w'">
731                      <img src="/opac-tmpl/lib/famfamfam/world_link.png" alt="web site" class="format"/>
732                 </xsl:when>
733             </xsl:choose>
734         </span>
735         </xsl:if>
736         <xsl:if test="$typeOf008='BK' or $typeOf008='CR'">
737         <xsl:if test="contains($controlField008-24,'abcdefghijklmnopqrstvwxyz')">
738         <span class="results_natureofcontents">
739         <span class="label">; Nature of contents: </span>
740             <xsl:choose>
741                 <xsl:when test="contains($controlField008-24,'a')">
742                     abstract or summary
743                 </xsl:when>
744                 <xsl:when test="contains($controlField008-24,'b')">
745                         bibliography
746                      <img src="/opac-tmpl/lib/famfamfam/text_list_bullets.png" alt="bibliography" class="natureofcontents"/>
747                 </xsl:when>
748                 <xsl:when test="contains($controlField008-24,'c')">
749                     catalog
750                 </xsl:when>
751                 <xsl:when test="contains($controlField008-24,'d')">
752                     dictionary
753                 </xsl:when>
754                 <xsl:when test="contains($controlField008-24,'e')">
755                     encyclopedia
756                 </xsl:when>
757                 <xsl:when test="contains($controlField008-24,'f')">
758                     handbook
759                 </xsl:when>
760                 <xsl:when test="contains($controlField008-24,'g')">
761                     legal article
762                 </xsl:when>
763                 <xsl:when test="contains($controlField008-24,'i')">
764                     index
765                 </xsl:when>
766                 <xsl:when test="contains($controlField008-24,'k')">
767                     discography
768                 </xsl:when>
769                 <xsl:when test="contains($controlField008-24,'l')">
770                     legislation
771                 </xsl:when>
772                 <xsl:when test="contains($controlField008-24,'m')">
773                     theses
774                 </xsl:when>
775                 <xsl:when test="contains($controlField008-24,'n')">
776                     survey of literature
777                 </xsl:when>
778                 <xsl:when test="contains($controlField008-24,'o')">
779                     review
780                 </xsl:when>
781                 <xsl:when test="contains($controlField008-24,'p')">
782                     programmed text
783                 </xsl:when>
784                 <xsl:when test="contains($controlField008-24,'q')">
785                     filmography
786                 </xsl:when>
787                 <xsl:when test="contains($controlField008-24,'r')">
788                     directory
789                 </xsl:when>
790                 <xsl:when test="contains($controlField008-24,'s')">
791                     statistics
792                 </xsl:when>
793                 <xsl:when test="contains($controlField008-24,'t')">
794                      <img src="/opac-tmpl/lib/famfamfam/report.png" alt="technical report" class="natureofcontents"/>
795                 </xsl:when>
796                 <xsl:when test="contains($controlField008-24,'v')">
797                     legal case and case notes
798                 </xsl:when>
799                 <xsl:when test="contains($controlField008-24,'w')">
800                     law report or digest
801                 </xsl:when>
802                 <xsl:when test="contains($controlField008-24,'z')">
803                     treaty
804                 </xsl:when>
805             </xsl:choose>
806             <xsl:choose>
807                 <xsl:when test="$controlField008-29='1'">
808                     conference publication
809                 </xsl:when>
810             </xsl:choose>
811         </span>
812         </xsl:if>
813         </xsl:if>
814         <xsl:if test="$typeOf008='CF'">
815         <span class="results_typeofcomp">
816             <xsl:if test="$controlField008-26='a' or $controlField008-26='e' or $controlField008-26='f' or $controlField008-26='g'">
817             <span class="label">; Type of computer file: </span>
818             </xsl:if>
819             <xsl:choose>
820                 <xsl:when test="$controlField008-26='a'">
821                     numeric data
822                 </xsl:when>
823                 <xsl:when test="$controlField008-26='e'">
824                      <img src="/opac-tmpl/lib/famfamfam/database.png" alt="database" class="format"/>
825                 </xsl:when>
826                 <xsl:when test="$controlField008-26='f'">
827                      <img src="/opac-tmpl/lib/famfamfam/font.png" alt="font" class="format"/>
828                 </xsl:when>
829                 <xsl:when test="$controlField008-26='g'">
830                      <img src="/opac-tmpl/lib/famfamfam/controller.png" alt="game" class="format"/>
831                 </xsl:when>
832             </xsl:choose>
833         </span>
834         </xsl:if>
835         <xsl:if test="$typeOf008='BK'">
836         <span class="results_contents_literary">
837             <xsl:if test="(substring($controlField008,25,1)='j') or (substring($controlField008,25,1)='1') or ($controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d')">
838             <span class="label">; Nature of contents: </span>
839             </xsl:if>
840             <xsl:if test="substring($controlField008,25,1)='j'">
841                 patent
842             </xsl:if>
843             <xsl:if test="substring($controlField008,31,1)='1'">
844                 festschrift
845             </xsl:if>
846             <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
847                  <img src="/opac-tmpl/lib/famfamfam/user.png" alt="biography" class="natureofcontents"/>
848             </xsl:if>
849
850             <xsl:if test="$controlField008-33 and $controlField008-33!='|' and $controlField008-33!='u' and $controlField008-33!=' '">
851             <span class="label">; Literary form: </span>
852             </xsl:if>
853             <xsl:choose>
854                 <xsl:when test="$controlField008-33='0'">
855                     Not fiction
856                 </xsl:when>
857                 <xsl:when test="$controlField008-33='1'">
858                     Fiction
859                 </xsl:when>
860                 <xsl:when test="$controlField008-33='d'">
861                     Dramas
862                 </xsl:when>
863                 <xsl:when test="$controlField008-33='e'">
864                     Essays
865                 </xsl:when>
866                 <xsl:when test="$controlField008-33='f'">
867                     Novels
868                 </xsl:when>
869                 <xsl:when test="$controlField008-33='h'">
870                     Humor, satires, etc.
871                 </xsl:when>
872                 <xsl:when test="$controlField008-33='i'">
873                     Letters
874                 </xsl:when>
875                 <xsl:when test="$controlField008-33='j'">
876                     Short stories
877                 </xsl:when>
878                 <xsl:when test="$controlField008-33='m'">
879                     Mixed forms
880                 </xsl:when>
881                 <xsl:when test="$controlField008-33='p'">
882                     Poetry
883                 </xsl:when>
884                 <xsl:when test="$controlField008-33='s'">
885                     Speeches
886                 </xsl:when>
887             </xsl:choose>
888         </span>
889         </xsl:if>
890         <xsl:if test="$typeOf008='MU' and $controlField008-30-31 and $controlField008-30-31!='||' and $controlField008-30-31!='  '">
891         <span class="results_literaryform">
892             <span class="label">; Literary form: </span> <!-- Literary text for sound recordings -->
893             <xsl:if test="contains($controlField008-30-31,'b')">
894                 biography
895             </xsl:if>
896             <xsl:if test="contains($controlField008-30-31,'c')">
897                 conference publication
898             </xsl:if>
899             <xsl:if test="contains($controlField008-30-31,'d')">
900                 drama
901             </xsl:if>
902             <xsl:if test="contains($controlField008-30-31,'e')">
903                 essay
904             </xsl:if>
905             <xsl:if test="contains($controlField008-30-31,'f')">
906                 fiction
907             </xsl:if>
908             <xsl:if test="contains($controlField008-30-31,'o')">
909                 folktale
910             </xsl:if>
911             <xsl:if test="contains($controlField008-30-31,'h')">
912                 history
913             </xsl:if>
914             <xsl:if test="contains($controlField008-30-31,'k')">
915                 humor, satire
916             </xsl:if>
917             <xsl:if test="contains($controlField008-30-31,'m')">
918                 memoir
919             </xsl:if>
920             <xsl:if test="contains($controlField008-30-31,'p')">
921                 poetry
922             </xsl:if>
923             <xsl:if test="contains($controlField008-30-31,'r')">
924                 rehearsal
925             </xsl:if>
926             <xsl:if test="contains($controlField008-30-31,'g')">
927                 reporting
928             </xsl:if>
929             <xsl:if test="contains($controlField008-30-31,'s')">
930                 sound
931             </xsl:if>
932             <xsl:if test="contains($controlField008-30-31,'l')">
933                 speech
934             </xsl:if>
935         </span>
936         </xsl:if>
937         <xsl:if test="$typeOf008='VM'">
938         <span class="results_typeofvisual">
939             <span class="label">; Type of visual material: </span>
940             <xsl:choose>
941                 <xsl:when test="$controlField008-33='a'">
942                     art original
943                 </xsl:when>
944                 <xsl:when test="$controlField008-33='b'">
945                     kit
946                 </xsl:when>
947                 <xsl:when test="$controlField008-33='c'">
948                     art reproduction
949                 </xsl:when>
950                 <xsl:when test="$controlField008-33='d'">
951                     diorama
952                 </xsl:when>
953                 <xsl:when test="$controlField008-33='f'">
954                     filmstrip
955                 </xsl:when>
956                 <xsl:when test="$controlField008-33='g'">
957                     game
958                 </xsl:when>
959                 <xsl:when test="$controlField008-33='i'">
960                     picture
961                 </xsl:when>
962                 <xsl:when test="$controlField008-33='k'">
963                     graphic
964                 </xsl:when>
965                 <xsl:when test="$controlField008-33='l'">
966                     technical drawing
967                 </xsl:when>
968                 <xsl:when test="$controlField008-33='m'">
969                     motion picture
970                 </xsl:when>
971                 <xsl:when test="$controlField008-33='n'">
972                     chart
973                 </xsl:when>
974                 <xsl:when test="$controlField008-33='o'">
975                     flash card
976                 </xsl:when>
977                 <xsl:when test="$controlField008-33='p'">
978                     microscope slide
979                 </xsl:when>
980                 <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
981                     model
982                 </xsl:when>
983                 <xsl:when test="$controlField008-33='r'">
984                     realia
985                 </xsl:when>
986                 <xsl:when test="$controlField008-33='s'">
987                     slide
988                 </xsl:when>
989                 <xsl:when test="$controlField008-33='t'">
990                     transparency
991                 </xsl:when>
992                 <xsl:when test="$controlField008-33='v'">
993                     videorecording
994                 </xsl:when>
995                 <xsl:when test="$controlField008-33='w'">
996                     toy
997                 </xsl:when>
998             </xsl:choose>
999             </span>
1000         </xsl:if>
1001         </xsl:if>
1002
1003     <xsl:if test="($typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM') and ($controlField008-22='a' or $controlField008-22='b' or $controlField008-22='c' or $controlField008-22='d' or $controlField008-22='e' or $controlField008-22='g' or $controlField008-22='j' or $controlField008-22='f')">
1004         <span class="results_audience">
1005         <span class="label">; Audience: </span>
1006         <xsl:choose>
1007             <xsl:when test="$controlField008-22='a'">
1008              Preschool;
1009             </xsl:when>
1010             <xsl:when test="$controlField008-22='b'">
1011              Primary;
1012             </xsl:when>
1013             <xsl:when test="$controlField008-22='c'">
1014              Pre-adolescent;
1015             </xsl:when>
1016             <xsl:when test="$controlField008-22='d'">
1017              Adolescent;
1018             </xsl:when>
1019             <xsl:when test="$controlField008-22='e'">
1020              Adult;
1021             </xsl:when>
1022             <xsl:when test="$controlField008-22='g'">
1023              General;
1024             </xsl:when>
1025             <xsl:when test="$controlField008-22='j'">
1026              Juvenile;
1027             </xsl:when>
1028             <xsl:when test="$controlField008-22='f'">
1029              Specialized;
1030             </xsl:when>
1031         </xsl:choose>
1032         </span>
1033     </xsl:if>
1034 <xsl:text> </xsl:text> <!-- added blank space to fix font display problem, see Bug 3671 -->
1035 </div>
1036 </xsl:if>
1037
1038     <xsl:call-template name="show-lang-041"/>
1039
1040     <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
1041     <xsl:if test="$display880">
1042       <xsl:call-template name="m880Select">
1043         <xsl:with-param name="basetags">260</xsl:with-param>
1044         <xsl:with-param name="codes">abcg</xsl:with-param>
1045         <xsl:with-param name="class">results_summary publisher</xsl:with-param>
1046         <xsl:with-param name="label">Publication details: </xsl:with-param>
1047       </xsl:call-template>
1048     </xsl:if>
1049
1050     <!-- Publisher or Distributor Number -->
1051     <xsl:if test="marc:datafield[@tag=028]">
1052          <div class="results_summary publisher_number ">
1053             <span class="label">Publisher number: </span>
1054             <ul class="resource_list">
1055                 <xsl:for-each select="marc:datafield[@tag=028]">
1056                     <li>
1057                         <xsl:call-template name="subfieldSelect">
1058                             <xsl:with-param name="codes">abq</xsl:with-param>
1059                         </xsl:call-template>
1060                     </li>
1061                 </xsl:for-each>
1062             </ul>
1063         </div>
1064     </xsl:if>
1065
1066     <!-- Publisher info and RDA related info from tags 260, 264 -->
1067     <xsl:choose>
1068         <xsl:when test="marc:datafield[@tag=264]">
1069             <xsl:call-template name="showRDAtag264"/>
1070         </xsl:when>
1071         <xsl:when test="marc:datafield[@tag=260]">
1072             <div class="results_summary publisher"><span class="label">Publication details: </span>
1073                 <xsl:for-each select="marc:datafield[@tag=260]">
1074                     <xsl:if test="marc:subfield[@code='a']">
1075                         <span class="publisher_place" property="location">
1076                             <xsl:call-template name="subfieldSelect">
1077                                 <xsl:with-param name="codes">a</xsl:with-param>
1078                             </xsl:call-template>
1079                         </span>
1080                     </xsl:if>
1081                     <xsl:text> </xsl:text>
1082                     <xsl:if test="marc:subfield[@code='b']">
1083                         <span property="name" class="publisher_name">
1084                             <xsl:call-template name="subfieldSelect">
1085                                 <xsl:with-param name="codes">b</xsl:with-param>
1086                             </xsl:call-template>
1087                         </span>
1088                     </xsl:if>
1089                     <xsl:text> </xsl:text>
1090                     <span property="datePublished" class="publisher_date">
1091                         <xsl:call-template name="chopPunctuation">
1092                             <xsl:with-param name="chopString">
1093                                     <xsl:call-template name="subfieldSelect">
1094                                         <xsl:with-param name="codes">cg</xsl:with-param>
1095                                     </xsl:call-template>
1096                             </xsl:with-param>
1097                         </xsl:call-template>
1098                     </span>
1099                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1100                 </xsl:for-each>
1101                 <xsl:if test="marc:datafield[@tag=264]">
1102                     <xsl:text>; </xsl:text>
1103                     <xsl:call-template name="showRDAtag264"/>
1104                 </xsl:if>
1105             </div>
1106         </xsl:when>
1107     </xsl:choose>
1108
1109     <!-- Dissertation note -->
1110     <xsl:if test="marc:datafield[@tag=502]">
1111         <div class="results_summary diss_note">
1112             <span class="label">Dissertation note: </span>
1113             <xsl:for-each select="marc:datafield[@tag=502]">
1114                 <xsl:call-template name="subfieldSelect">
1115                     <xsl:with-param name="codes">abcdgo</xsl:with-param>
1116                 </xsl:call-template>
1117             </xsl:for-each>
1118             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1119         </div>
1120     </xsl:if>
1121
1122     <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
1123     <xsl:if test="$display880">
1124        <xsl:call-template name="m880Select">
1125          <xsl:with-param name="basetags">246</xsl:with-param>
1126          <xsl:with-param name="codes">ab</xsl:with-param>
1127          <xsl:with-param name="class">results_summary other_title</xsl:with-param>
1128          <xsl:with-param name="label">Other title: </xsl:with-param>
1129        </xsl:call-template>
1130     </xsl:if>
1131
1132     <xsl:if test="marc:datafield[@tag=246]">
1133     <div class="results_summary other_title">
1134     <span class="label">Other title: </span>
1135         <ul class="resource_list">
1136             <xsl:for-each select="marc:datafield[@tag=246]">
1137                 <li>
1138                     <xsl:call-template name="subfieldSelect">
1139                         <xsl:with-param name="codes">ab</xsl:with-param>
1140                     </xsl:call-template>
1141                 </li>
1142             </xsl:for-each>
1143         </ul>
1144     </div>
1145     </xsl:if>
1146     <xsl:if test="marc:datafield[@tag=242]">
1147     <div class="results_summary translated_title">
1148     <span class="label">Title translated: </span>
1149             <xsl:for-each select="marc:datafield[@tag=242]">
1150                     <xsl:call-template name="subfieldSelect">
1151                         <xsl:with-param name="codes">abh</xsl:with-param>
1152                     </xsl:call-template>
1153                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1154             </xsl:for-each>
1155         </div>
1156     </xsl:if>
1157
1158     <xsl:call-template name="host-item-entries">
1159         <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
1160     </xsl:call-template>
1161
1162     <xsl:if test="marc:datafield[@tag=856]">
1163          <div class="results_summary online_resources">
1164                            <span class="label">Online access: </span>
1165                     <ul class="resource_list">
1166                             <xsl:for-each select="marc:datafield[@tag=856]">
1167                             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
1168                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
1169                               <li><a>
1170                               <xsl:choose>
1171                                 <xsl:when test="$OPACTrackClicks='track'">
1172                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1173                                 </xsl:when>
1174                                 <xsl:when test="$OPACTrackClicks='anonymous'">
1175                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1176                                 </xsl:when>
1177                                 <xsl:otherwise>
1178                     <xsl:attribute name="href">
1179                         <xsl:call-template name="AddMissingProtocol">
1180                             <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
1181                             <xsl:with-param name="indicator1" select="@ind1"/>
1182                             <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
1183                         </xsl:call-template>
1184                         <xsl:value-of select="marc:subfield[@code='u']"/>
1185                     </xsl:attribute>
1186                                 </xsl:otherwise>
1187                               </xsl:choose>
1188                                     <xsl:choose>
1189                                      <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
1190                                         <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text>
1191                                     </xsl:when>
1192                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1193                                         <xsl:call-template name="subfieldSelect">
1194                                         <xsl:with-param name="codes">y3z</xsl:with-param>
1195                                         </xsl:call-template>
1196                                     </xsl:when>
1197                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
1198                                         <xsl:choose>
1199                                         <xsl:when test="$URLLinkText!=''">
1200                                                 <xsl:value-of select="$URLLinkText"/>
1201                                         </xsl:when>
1202                                         <xsl:otherwise>
1203                                                 <xsl:text>Click here to access online</xsl:text>
1204                                         </xsl:otherwise>
1205                                         </xsl:choose>
1206                                     </xsl:when>
1207                                     </xsl:choose>
1208                                     </a></li>
1209                               </xsl:if>
1210                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
1211                                    <li><a target='_blank'>
1212                                    <xsl:choose>
1213                                      <xsl:when test="$OPACTrackClicks='track'">
1214                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1215                                      </xsl:when>
1216                                      <xsl:when test="$OPACTrackClicks='anonymous'">
1217                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1218                                      </xsl:when>
1219                                      <xsl:otherwise>
1220                                        <xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
1221                                      </xsl:otherwise>
1222                                    </xsl:choose>
1223                                     <xsl:choose>
1224                                     <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and ($SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
1225                                         <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
1226                                     </xsl:when>
1227                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1228                                         <xsl:call-template name="subfieldSelect">
1229                                         <xsl:with-param name="codes">y3z</xsl:with-param>
1230                                         </xsl:call-template>
1231                                     </xsl:when>
1232                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
1233                                         <xsl:choose>
1234                                         <xsl:when test="$URLLinkText!=''">
1235                                                 <xsl:value-of select="$URLLinkText"/>
1236                                         </xsl:when>
1237                                         <xsl:otherwise>
1238                                                 <xsl:text>Click here to access online</xsl:text>
1239                                         </xsl:otherwise>
1240                                         </xsl:choose>
1241                                     </xsl:when>
1242                                     </xsl:choose>
1243                                     </a></li>
1244                               </xsl:if>
1245                             </xsl:for-each>
1246                             </ul>
1247                             </div>
1248                         </xsl:if>
1249
1250         <!-- Availability line -->
1251         <div class="results_summary availability">
1252             <span class="label">Availability: </span>
1253
1254             <xsl:choose>
1255                 <!-- When there are no items, try alternate holdings -->
1256                 <xsl:when test="$itemcount=0">
1257                     <xsl:choose>
1258                         <xsl:when test="string-length($AlternateHoldingsField)=3 and marc:datafield[@tag=$AlternateHoldingsField]">
1259                         <xsl:variable name="AlternateHoldingsCount" select="count(marc:datafield[@tag=$AlternateHoldingsField])"/>
1260                         <xsl:for-each select="marc:datafield[@tag=$AlternateHoldingsField][1]">
1261                             <xsl:call-template name="subfieldSelect">
1262                                 <xsl:with-param name="codes"><xsl:value-of select="$AlternateHoldingsSubfields"/></xsl:with-param>
1263                                 <xsl:with-param name="delimeter"><xsl:value-of select="$AlternateHoldingsSeparator"/></xsl:with-param>
1264                             </xsl:call-template>
1265                         </xsl:for-each>
1266                         (<xsl:value-of select="$AlternateHoldingsCount"/>)
1267                         </xsl:when>
1268                         <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise>
1269                     </xsl:choose>
1270                 </xsl:when>
1271
1272                 <xsl:otherwise>
1273                     <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/>
1274                     <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/>
1275
1276                     <!-- Availability part 1: ITEMS FOR LOAN -->
1277                     <xsl:if test="$sumAv>0"><span class="available reallyavailable">
1278                         <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span>
1279                         <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
1280                         <!-- group by branch, see also pref OPACResultsLibrary -->
1281                         <xsl:for-each select="$available_items[not(items:resultbranch=preceding-sibling::*[items:status='available']/items:resultbranch)]">
1282                             <xsl:sort select="items:resultbranch"/>
1283                             <xsl:variable name="currentbranch" select="items:resultbranch"/>
1284                             <span class="ItemSummary">
1285                             <xsl:call-template name="listCallNumbers">
1286                                 <xsl:with-param name="items" select="$available_items[items:resultbranch=$currentbranch]"/>
1287                                 <xsl:with-param name="max" select="$OPACResultsMaxItems"/>
1288                                 <xsl:with-param name="status_text" select="$currentbranch"/>
1289                                 <xsl:with-param name="class_block" select="'available'"/>
1290                                 <xsl:with-param name="class_status" select="'ItemBranch'"/>
1291                                 <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>
1292                             </xsl:call-template>
1293                             </span>
1294                         </xsl:for-each>
1295                     </span></xsl:if>
1296
1297                     <!-- Availability part 2: ITEMS FOR REFERENCE (see also pref Reference_NFL_Statuses) -->
1298                     <xsl:if test="$sumRef>0"><span class="available reference">
1299                         <span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span>
1300                         <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1301                         <!-- group by branch, then by substatus -->
1302                         <xsl:for-each select="$reference_items[not(items:resultbranch=preceding-sibling::*[items:status='reference']/items:resultbranch)]">
1303                             <xsl:sort select="items:resultbranch"/>
1304                             <xsl:variable name="currentbranch" select="items:resultbranch"/>
1305                             <xsl:for-each select="$reference_items[not(items:substatus=preceding-sibling::*[items:status='reference']/items:substatus)]">
1306                                 <xsl:sort select="items:substatus"/>
1307                                 <xsl:variable name="current_substatus" select="items:substatus"/>
1308                                 <span class="ItemSummary">
1309                                 <xsl:call-template name="listCallNumbers">
1310                                     <xsl:with-param name="items" select="$reference_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>
1311                                     <xsl:with-param name="max" select="$OPACResultsMaxItems"/>
1312                                     <xsl:with-param name="status_text" select="concat($currentbranch,': ',$current_substatus)"/>
1313                                     <xsl:with-param name="class_block" select="concat('notforloandesc_',$current_substatus)"/>
1314                                     <xsl:with-param name="class_status" select="'ItemBranch'"/>
1315                                     <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>
1316                                 </xsl:call-template>
1317                                 </span>
1318                             </xsl:for-each>
1319                         </xsl:for-each>
1320                     </span></xsl:if>
1321
1322                     <!-- Availability part 3: UNAVAILABLE ITEMS (see also pref Reference_NFL_Statuses); status reallynotforloan or status other -->
1323                     <xsl:if test="number($sumAv+$sumRef) &lt; number($itemcount)"><span class="unavailable">
1324                         <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span>
1325                         <xsl:variable name="other_status_list">
1326                             <status english="Checked out">Checked out</status>
1327                             <status english="Withdrawn">Withdrawn</status>
1328                             <status english="Lost">Lost</status>
1329                             <status english="Damaged">Damaged</status>
1330                             <status english="Pending hold">Pending hold</status>
1331                             <status english="In transit">In transit</status>
1332                             <status english="Hold waiting">On hold</status>
1333                             <status english="Recall waiting">Waiting recall</status>
1334                         </xsl:variable>
1335                         <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')|key('item-by-status', 'other')"/>
1336                         <xsl:choose>
1337                             <xsl:when test="$OPACResultsUnavailableGroupingBy='branch'">
1338                                 <!-- First group by branch -->
1339                                 <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]">
1340                                     <xsl:sort select="items:resultbranch"/>
1341                                     <xsl:variable name="currentbranch" select="items:resultbranch"/>
1342                                     <span class="ItemSummary unavailable">
1343                                     <!-- Within same branch, group by substatus -->
1344                                     <xsl:for-each select="$unavailable_items[not(items:substatus=preceding-sibling::*[items:status='reallynotforloan' or items:status='other']/items:substatus)]">
1345                                         <xsl:sort select="items:substatus"/>
1346                                         <xsl:variable name="current_substatus" select="items:substatus"/>
1347                                             <xsl:call-template name="listCallNumbers">
1348                                                 <xsl:with-param name="items" select="$unavailable_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>
1349                                                 <xsl:with-param name="max" select="$OPACResultsMaxItemsUnavailable"/>
1350                                                 <xsl:with-param name="status_text">
1351                                                     <xsl:value-of select="$currentbranch"/>
1352                                                     <xsl:text>: </xsl:text>
1353                                                     <xsl:if test="items:status='other'">
1354                                                         <xsl:value-of select="exsl:node-set($other_status_list)/status[@english=$current_substatus]"/>
1355                                                     </xsl:if>
1356                                                     <xsl:if test="items:status='reallynotforloan'">
1357                                                         <xsl:value-of select="$current_substatus"/>
1358                                                     </xsl:if>
1359                                                 </xsl:with-param>
1360                                                 <xsl:with-param name="class_block" select="concat('unavailable_',items:substatus)"/>
1361                                                 <xsl:with-param name="class_status" select="'ItemBranch'"/>
1362                                                 <xsl:with-param name="OPACItemLocation" select="$OPACItemLocation"/>
1363                                             </xsl:call-template>
1364                                     </xsl:for-each>
1365                                     </span>
1366                                 </xsl:for-each>
1367                             </xsl:when>
1368                             <xsl:when test="$OPACResultsUnavailableGroupingBy='substatus'">
1369                                 <!-- Only group by substatus, do not list branch names and individual call numbers. Meant for large consortia -->
1370                                 <xsl:for-each select="$unavailable_items[not(items:substatus=preceding-sibling::*[items:status='reallynotforloan' or items:status='other']/items:substatus)]">
1371                                     <xsl:sort select="items:substatus"/>
1372                                     <xsl:variable name="current_substatus" select="items:substatus"/>
1373                                     <xsl:call-template name="listCallNumbers">
1374                                         <xsl:with-param name="items" select="$unavailable_items[items:substatus=$current_substatus]"/>
1375                                         <xsl:with-param name="max" select="0"/>
1376                                         <xsl:with-param name="status_text">
1377                                             <xsl:if test="items:status='other'">
1378                                                 <xsl:value-of select="exsl:node-set($other_status_list)/status[@english=$current_substatus]"/>
1379                                             </xsl:if>
1380                                             <xsl:if test="items:status='reallynotforloan'">
1381                                                 <xsl:value-of select="$current_substatus"/>
1382                                             </xsl:if>
1383                                         </xsl:with-param>
1384                                         <xsl:with-param name="class_block" select="concat('unavailable_',$current_substatus)"/>
1385                                         <xsl:with-param name="class_status" select="UnavailableSubstatus"/>
1386                                     </xsl:call-template>
1387                                 </xsl:for-each>
1388                             </xsl:when>
1389                             <xsl:when test="$OPACResultsUnavailableGroupingBy='branchonly'">
1390                                 <!-- Only group by branch, do not list substatuses and individual call numbers -->
1391                                 <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]">
1392                                     <xsl:sort select="items:resultbranch"/>
1393                                     <xsl:variable name="currentbranch" select="items:resultbranch"/>
1394                                     <xsl:if test="count($unavailable_items[items:resultbranch=$currentbranch])>0">
1395                                         <span class="ItemSummary unavailable">
1396                                             <xsl:value-of select="$currentbranch"/>
1397                                             <span class="unavailable">
1398                                                 <xsl:text> (</xsl:text>
1399                                                 <xsl:value-of select="count($unavailable_items[items:resultbranch=$currentbranch])"/>
1400                                                 <xsl:text>)</xsl:text>
1401                                             </span>
1402                                         <xsl:text>. </xsl:text>
1403                                         </span>
1404                                     </xsl:if>
1405                                 </xsl:for-each>
1406                             </xsl:when>
1407                         </xsl:choose>
1408                     </span></xsl:if>
1409
1410                 </xsl:otherwise>
1411             </xsl:choose>
1412         </div>
1413         <!-- End of Availability line -->
1414
1415     </xsl:template>
1416
1417     <xsl:template name="nameABCQ">
1418             <xsl:call-template name="chopPunctuation">
1419                 <xsl:with-param name="chopString">
1420                     <xsl:call-template name="subfieldSelect">
1421                         <xsl:with-param name="codes">abcq</xsl:with-param>
1422                     </xsl:call-template>
1423                 </xsl:with-param>
1424                 <xsl:with-param name="punctuation">
1425                     <xsl:text>:,;/ </xsl:text>
1426                 </xsl:with-param>
1427             </xsl:call-template>
1428     </xsl:template>
1429
1430     <xsl:template name="nameABCDN">
1431             <xsl:call-template name="chopPunctuation">
1432                 <xsl:with-param name="chopString">
1433                     <xsl:call-template name="subfieldSelect">
1434                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1435                     </xsl:call-template>
1436                 </xsl:with-param>
1437                 <xsl:with-param name="punctuation">
1438                     <xsl:text>:,;/ </xsl:text>
1439                 </xsl:with-param>
1440             </xsl:call-template>
1441     </xsl:template>
1442
1443     <xsl:template name="nameACDEQ">
1444             <xsl:call-template name="subfieldSelect">
1445                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1446             </xsl:call-template>
1447     </xsl:template>
1448
1449     <xsl:template name="nameDate">
1450         <xsl:for-each select="marc:subfield[@code='d']">
1451             <xsl:call-template name="chopPunctuation">
1452                 <xsl:with-param name="chopString" select="."/>
1453             </xsl:call-template>
1454         </xsl:for-each>
1455     </xsl:template>
1456
1457     <xsl:template name="role">
1458         <xsl:for-each select="marc:subfield[@code='e']">
1459                     <xsl:value-of select="."/>
1460         </xsl:for-each>
1461         <xsl:for-each select="marc:subfield[@code='4']">
1462                     <xsl:value-of select="."/>
1463         </xsl:for-each>
1464     </xsl:template>
1465
1466     <xsl:template name="specialSubfieldSelect">
1467         <xsl:param name="anyCodes"/>
1468         <xsl:param name="axis"/>
1469         <xsl:param name="beforeCodes"/>
1470         <xsl:param name="afterCodes"/>
1471         <xsl:variable name="str">
1472             <xsl:for-each select="marc:subfield">
1473                 <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])">
1474                     <xsl:value-of select="text()"/>
1475                     <xsl:text> </xsl:text>
1476                 </xsl:if>
1477             </xsl:for-each>
1478         </xsl:variable>
1479         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1480     </xsl:template>
1481
1482     <xsl:template name="subtitle">
1483         <xsl:if test="marc:subfield[@code='b']">
1484                 <xsl:call-template name="chopPunctuation">
1485                     <xsl:with-param name="chopString">
1486                         <xsl:value-of select="marc:subfield[@code='b']"/>
1487
1488                         <!--<xsl:call-template name="subfieldSelect">
1489                             <xsl:with-param name="codes">b</xsl:with-param>
1490                         </xsl:call-template>-->
1491                     </xsl:with-param>
1492                 </xsl:call-template>
1493         </xsl:if>
1494     </xsl:template>
1495
1496     <xsl:template name="chopBrackets">
1497         <xsl:param name="chopString"></xsl:param>
1498         <xsl:variable name="string">
1499             <xsl:call-template name="chopPunctuation">
1500                 <xsl:with-param name="chopString" select="$chopString"></xsl:with-param>
1501             </xsl:call-template>
1502         </xsl:variable>
1503         <xsl:if test="substring($string, 1,1)='['">
1504             <xsl:value-of select="substring($string,2, string-length($string)-2)"></xsl:value-of>
1505         </xsl:if>
1506         <xsl:if test="substring($string, 1,1)!='['">
1507             <xsl:value-of select="$string"></xsl:value-of>
1508         </xsl:if>
1509     </xsl:template>
1510
1511     <xsl:template name="listCallNumbers">
1512         <xsl:param name="items"/>
1513         <xsl:param name="max"/>
1514         <xsl:param name="status_text"/>
1515         <xsl:param name="class_block"/>
1516         <xsl:param name="class_status"/>
1517         <xsl:param name="OPACItemLocation"/>
1518         <xsl:if test="count($items)>0">
1519             <span><xsl:attribute name="class"><xsl:value-of select="$class_block"/></xsl:attribute>
1520                 <span>
1521                     <xsl:attribute name="class"><xsl:value-of select="$class_status"/></xsl:attribute>
1522                     <xsl:value-of select="$status_text"/>
1523                 </span>
1524                 <xsl:text> (</xsl:text>
1525                 <xsl:value-of select="count($items)"/>
1526                 <xsl:text>)</xsl:text>
1527                 <xsl:if test="$max>0 and count($items[items:itemcallnumber!=''])>0 and $OPACItemLocation!='library'">
1528                     <span class="CallNumberAndLabel">
1529                     <span class="LabelCallNumber">
1530                         <xsl:if test="$OPACItemLocation='callnum'">Call number: </xsl:if>
1531                         <xsl:if test="$OPACItemLocation='ccode'">Collection, call number: </xsl:if>
1532                         <xsl:if test="$OPACItemLocation='location'">Location, call number: </xsl:if>
1533                     </span>
1534                     <span class="CallNumber">
1535                     <xsl:for-each select="$items[items:itemcallnumber!=''][position() &lt;= $max]">
1536                         <xsl:if test="$OPACItemLocation='location'">
1537                             <strong><xsl:value-of select="concat(items:location,' ')"/></strong>
1538                         </xsl:if>
1539                         <xsl:if test="$OPACItemLocation='ccode'">
1540                             <strong><xsl:value-of select="concat(items:ccode,' ')"/></strong>
1541                         </xsl:if>
1542                         <xsl:value-of select="items:itemcallnumber"/>
1543                         <xsl:if test="position()!=last()">
1544                             <xsl:text>, </xsl:text>
1545                         </xsl:if>
1546                         <xsl:if test="position()=last() and (count($items)>$max or count($items[items:itemcallnumber=''])>0)">
1547                             <xsl:text>, ..</xsl:text>
1548                         </xsl:if>
1549                     </xsl:for-each>
1550                     </span>
1551                     </span>
1552                 </xsl:if>
1553                 <xsl:text>. </xsl:text>
1554             </span>
1555         </xsl:if>
1556     </xsl:template>
1557
1558
1559 </xsl:stylesheet>