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