Bug 23078: (follow-up) Update self checkout help page
[koha.git] / koha-tmpl / opac-tmpl / prog / 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   exclude-result-prefixes="marc items">
9     <xsl:import href="MARC21slimUtils.xsl"/>
10     <xsl:output method = "xml" indent="yes" omit-xml-declaration = "yes" />
11     <xsl:key name="item-by-status" match="items:item" use="items:status"/>
12     <xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
13
14     <xsl:template match="/">
15             <xsl:apply-templates/>
16     </xsl:template>
17     <xsl:template match="marc:record">
18
19         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
22     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
23     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
24     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
25         <xsl:variable name="leader" select="marc:leader"/>
26         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
27         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
28         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
29         <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
30         <xsl:variable name="isbn" select="marc:datafield[@tag=020]/marc:subfield[@code='a']"/>
31         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
32         <xsl:variable name="typeOf008">
33             <xsl:choose>
34                 <xsl:when test="$leader19='a'">ST</xsl:when>
35                 <xsl:when test="$leader6='a'">
36                     <xsl:choose>
37                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
38                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">CR</xsl:when>
39                     </xsl:choose>
40                 </xsl:when>
41                 <xsl:when test="$leader6='t'">BK</xsl:when>
42                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
43                 <xsl:when test="$leader6='m'">CF</xsl:when>
44                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
45                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
46                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
47                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
48             </xsl:choose>
49         </xsl:variable>
50         <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
51         <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
52         <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
53         <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
54         <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
55         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
56         <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
57         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
58         <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
59
60         <xsl:variable name="physicalDescription">
61             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
62                 reformatted digital
63             </xsl:if>
64             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
65                 digitized microfilm
66             </xsl:if>
67             <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
68                 digitized other analog
69             </xsl:if>
70
71             <xsl:variable name="check008-23">
72                 <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='CR' or $typeOf008='MX'">
73                     <xsl:value-of select="true()"></xsl:value-of>
74                 </xsl:if>
75             </xsl:variable>
76             <xsl:variable name="check008-29">
77                 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
78                     <xsl:value-of select="true()"></xsl:value-of>
79                 </xsl:if>
80             </xsl:variable>
81             <xsl:choose>
82                 <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
83                     braille
84                 </xsl:when>
85                 <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='CR') and ($controlField008-23=' ' or $controlField008='r'))">
86                     print
87                 </xsl:when>
88                 <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
89                     electronic
90                 </xsl:when>
91                 <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
92                     microfiche
93                 </xsl:when>
94                 <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
95                     microfilm
96                 </xsl:when>
97             </xsl:choose>
98 <!--
99             <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
100                     <xsl:call-template name="chopBrackets">
101                         <xsl:with-param name="chopString">
102                             <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"></xsl:value-of>
103                         </xsl:with-param>
104                     </xsl:call-template>
105             </xsl:if>
106             <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
107                     <xsl:call-template name="chopBrackets">
108                         <xsl:with-param name="chopString">
109                             <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"></xsl:value-of>
110                         </xsl:with-param>
111                     </xsl:call-template>
112             </xsl:if>
113             <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
114                     <xsl:call-template name="chopBrackets">
115                         <xsl:with-param name="chopString">
116                             <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"></xsl:value-of>
117                         </xsl:with-param>
118                     </xsl:call-template>
119             </xsl:if>
120             <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
121                     <xsl:call-template name="chopBrackets">
122                         <xsl:with-param name="chopString">
123                             <xsl:value-of select="marc:datafield[@tag=245]/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=246]/marc:subfield[@code='h']">
128                     <xsl:call-template name="chopBrackets">
129                         <xsl:with-param name="chopString">
130                             <xsl:value-of select="marc:datafield[@tag=246]/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=730]/marc:subfield[@code='h']">
135                     <xsl:call-template name="chopBrackets">
136                         <xsl:with-param name="chopString">
137                             <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"></xsl:value-of>
138                         </xsl:with-param>
139                     </xsl:call-template>
140             </xsl:if>
141             <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
142                     <xsl:value-of select="."></xsl:value-of>
143             </xsl:for-each>
144             <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
145                 <xsl:choose>
146                     <xsl:when test="substring(text(),14,1)='a'">
147                         access
148                     </xsl:when>
149                     <xsl:when test="substring(text(),14,1)='p'">
150                         preservation
151                     </xsl:when>
152                     <xsl:when test="substring(text(),14,1)='r'">
153                         replacement
154                     </xsl:when>
155                 </xsl:choose>
156             </xsl:for-each>
157 -->
158             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
159                 chip cartridge
160             </xsl:if>
161             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
162                 <img src="/opac-tmpl/prog/famfamfam/silk/cd.png" alt="computer optical disc cartridge" title="computer optical disc cartridge"/>
163             </xsl:if>
164             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
165                 magnetic disc
166             </xsl:if>
167             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
168                 magneto-optical disc
169             </xsl:if>
170             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
171                 <img src="/opac-tmpl/prog/famfamfam/silk/cd.png" alt="optical disc" title="optical disc"/>
172             </xsl:if>
173             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
174                 available online
175                 <img src="/opac-tmpl/prog/famfamfam/silk/drive_web.png" alt="remote" title="remote"/>
176             </xsl:if>
177             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
178                 tape cartridge
179             </xsl:if>
180             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
181                 tape cassette
182             </xsl:if>
183             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
184                 tape reel
185             </xsl:if>
186
187             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
188                 <img src="/opac-tmpl/prog/famfamfam/silk/world.png" alt="celestial globe" title="celestial globe"/>
189             </xsl:if>
190             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
191                 <img src="/opac-tmpl/prog/famfamfam/silk/world.png" alt="earth moon globe" title="earth moon globe"/>
192             </xsl:if>
193             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
194                 <img src="/opac-tmpl/prog/famfamfam/silk/world.png" alt="planetary or lunar globe" title="planetary or lunar globe"/>
195             </xsl:if>
196             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
197                 <img src="/opac-tmpl/prog/famfamfam/silk/world.png" alt="terrestrial globe" title="terrestrial globe"/>
198             </xsl:if>
199
200             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
201                 kit
202             </xsl:if>
203
204             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
205                 atlas
206             </xsl:if>
207             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
208                 diagram
209             </xsl:if>
210             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
211                 map
212             </xsl:if>
213             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
214                 model
215             </xsl:if>
216             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
217                 profile
218             </xsl:if>
219             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
220                 remote-sensing image
221             </xsl:if>
222             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
223                 section
224             </xsl:if>
225             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
226                 view
227             </xsl:if>
228
229             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
230                 aperture card
231             </xsl:if>
232             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
233                 microfiche
234             </xsl:if>
235             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
236                 microfiche cassette
237             </xsl:if>
238             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
239                 microfilm cartridge
240             </xsl:if>
241             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
242                 microfilm cassette
243             </xsl:if>
244             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
245                 microfilm reel
246             </xsl:if>
247             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
248                 microopaque
249             </xsl:if>
250             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
251                 film cartridge
252             </xsl:if>
253             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
254                 film cassette
255             </xsl:if>
256             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
257                 film reel
258             </xsl:if>
259             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
260                 <img src="/opac-tmpl/prog/famfamfam/silk/chart_curve.png" alt="chart" title="chart"/>
261             </xsl:if>
262             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
263                 collage
264             </xsl:if>
265             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
266                  <img src="/opac-tmpl/prog/famfamfam/silk/pencil.png" alt="drawing" title="drawing"/>
267             </xsl:if>
268             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
269                 <img src="/opac-tmpl/prog/famfamfam/silk/note.png" alt="flash card" title="flash card"/>
270             </xsl:if>
271             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
272                 <img src="/opac-tmpl/prog/famfamfam/silk/paintbrush.png" alt="painting" title="painting"/>
273             </xsl:if>
274             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
275                 photomechanical print
276             </xsl:if>
277             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
278                 photonegative
279             </xsl:if>
280             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
281                 photoprint
282             </xsl:if>
283             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
284                 <img src="/opac-tmpl/prog/famfamfam/silk/picture.png" alt="picture" title="picture"/>
285             </xsl:if>
286             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
287                 print
288             </xsl:if>
289             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
290                 technical drawing
291             </xsl:if>
292             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
293                 <img src="/opac-tmpl/prog/famfamfam/silk/script.png" alt="notated music" title="notated music"/>
294             </xsl:if>
295             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
296                 filmslip
297             </xsl:if>
298             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
299                 filmstrip cartridge
300             </xsl:if>
301             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
302                 filmstrip roll
303             </xsl:if>
304             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
305                 other filmstrip type
306             </xsl:if>
307             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
308                 <img src="/opac-tmpl/prog/famfamfam/silk/pictures.png" alt="slide" title="slide"/>
309             </xsl:if>
310             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
311                 transparency
312             </xsl:if>
313             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
314                 remote-sensing image
315             </xsl:if>
316             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
317                 cylinder
318             </xsl:if>
319             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
320                 roll
321             </xsl:if>
322             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
323                 sound cartridge
324             </xsl:if>
325             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
326                 sound cassette
327             </xsl:if>
328             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
329                 <img src="/opac-tmpl/prog/famfamfam/silk/cd.png" alt="sound disc" title="sound disc"/>
330             </xsl:if>
331             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
332                 sound-tape reel
333             </xsl:if>
334             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
335                 sound-track film
336             </xsl:if>
337             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
338                 wire recording
339             </xsl:if>
340             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
341                 braille
342             </xsl:if>
343             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
344                 combination
345             </xsl:if>
346             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
347                 moon
348             </xsl:if>
349             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
350                 tactile, with no writing system
351             </xsl:if>
352             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
353                 braille
354             </xsl:if>
355             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
356                 <img src="/opac-tmpl/prog/famfamfam/silk/magnifier.png" alt="large print" title="large print"/>
357             </xsl:if>
358             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
359                 regular print
360             </xsl:if>
361             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
362                 text in looseleaf binder
363             </xsl:if>
364             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
365                 videocartridge
366             </xsl:if>
367             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
368                 videocassette
369             </xsl:if>
370             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
371                 <img src="/opac-tmpl/prog/famfamfam/silk/dvd.png" alt="videodisc" title="videodisc"/>
372             </xsl:if>
373             <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
374                 videoreel
375             </xsl:if>
376 <!--
377             <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">
378                     <xsl:value-of select="."></xsl:value-of>
379             </xsl:for-each>
380             <xsl:for-each select="marc:datafield[@tag=300]">
381                     <xsl:call-template name="subfieldSelect">
382                         <xsl:with-param name="codes">abce</xsl:with-param>
383                     </xsl:call-template>
384             </xsl:for-each>
385 -->
386         </xsl:variable>
387
388         <!-- Title Statement: Alternate Graphic Representation (MARC 880) -->
389         <xsl:if test="$display880">
390            <xsl:call-template name="m880Select">
391               <xsl:with-param name="basetags">245</xsl:with-param>
392               <xsl:with-param name="codes">abhfgknps</xsl:with-param>
393               <xsl:with-param name="bibno"><xsl:value-of  select="$biblionumber"/></xsl:with-param>
394            </xsl:call-template>
395         </xsl:if>
396
397         <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute><xsl:attribute name="class">title</xsl:attribute>
398
399         <xsl:if test="marc:datafield[@tag=245]">
400         <xsl:for-each select="marc:datafield[@tag=245]">
401             <xsl:variable name="title">
402                      <xsl:call-template name="subfieldSelect">
403                         <xsl:with-param name="codes">a</xsl:with-param>
404                     </xsl:call-template>
405                     <xsl:if test="marc:subfield[@code='b']">
406                         <xsl:text> </xsl:text>
407                         <xsl:call-template name="subfieldSelect">
408                             <xsl:with-param name="codes">b</xsl:with-param>
409                         </xsl:call-template>
410                     </xsl:if>
411                     <xsl:if test="marc:subfield[@code='h']">
412                         <xsl:text> </xsl:text>
413                         <xsl:call-template name="subfieldSelect">
414                             <xsl:with-param name="codes">h</xsl:with-param>
415                         </xsl:call-template>
416                     </xsl:if>
417                 <xsl:text> </xsl:text>
418                     <xsl:call-template name="subfieldSelect">
419                         <xsl:with-param name="codes">fgknps</xsl:with-param>
420                      </xsl:call-template>
421             </xsl:variable>
422             <xsl:variable name="titleChop">
423                 <xsl:call-template name="chopPunctuation">
424                     <xsl:with-param name="chopString">
425                         <xsl:value-of select="$title"/>
426                     </xsl:with-param>
427                 </xsl:call-template>
428             </xsl:variable>
429             <xsl:value-of select="$titleChop"/>
430         </xsl:for-each>
431         </xsl:if>
432     </a>
433     <p>
434
435     <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
436     <xsl:if test="$display880">
437       <xsl:call-template name="m880Select">
438       <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
439       <xsl:with-param name="codes">abc</xsl:with-param>
440       </xsl:call-template>
441     </xsl:if>
442
443     <xsl:choose>
444     <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]">
445
446     by <span class="author">
447         <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
448             <xsl:choose>
449             <xsl:when test="position()=last()">
450                 <xsl:call-template name="nameABCDQ"/>.
451             </xsl:when>
452             <xsl:otherwise>
453                 <xsl:call-template name="nameABCDQ"/>;
454             </xsl:otherwise>
455             </xsl:choose>
456         </xsl:for-each>
457
458         <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
459             <xsl:choose>
460             <xsl:when test="position()=1">
461                 <xsl:text> -- </xsl:text>
462             </xsl:when>
463             </xsl:choose>
464             <xsl:choose>
465             <xsl:when test="position()=last()">
466                 <xsl:call-template name="nameABCDN"/> 
467             </xsl:when>
468             <xsl:otherwise>
469                 <xsl:call-template name="nameABCDN"/>;
470             </xsl:otherwise>
471             </xsl:choose>
472         </xsl:for-each>
473
474         <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
475             <xsl:choose>
476             <xsl:when test="position()=1">
477                 <xsl:text> -- </xsl:text>
478             </xsl:when>
479             </xsl:choose>
480             <xsl:choose>
481             <xsl:when test="marc:subfield[@code='n']">
482                <xsl:text> </xsl:text>
483                <xsl:call-template name="subfieldSelect">
484                   <xsl:with-param name="codes">n</xsl:with-param> 
485                </xsl:call-template>
486                <xsl:text> </xsl:text>
487             </xsl:when>
488             </xsl:choose>
489             <xsl:choose>
490             <xsl:when test="position()=last()">
491                 <xsl:call-template name="nameACDEQ"/>.
492             </xsl:when>
493             <xsl:otherwise>
494                 <xsl:call-template name="nameACDEQ"/>;
495             </xsl:otherwise>
496             </xsl:choose>
497         </xsl:for-each>
498     </span>
499     </xsl:when>
500     </xsl:choose>
501     </p>
502
503     <xsl:if test="marc:datafield[@tag=250]">
504         <span class="results_summary">
505     <span class="label">Edition: </span>
506             <xsl:for-each select="marc:datafield[@tag=250]">
507                     <xsl:call-template name="subfieldSelect">
508                         <xsl:with-param name="codes">ab</xsl:with-param>
509                     </xsl:call-template>
510             </xsl:for-each>
511         </span>
512     </xsl:if>
513
514 <xsl:if test="$DisplayOPACiconsXSLT!='0'">
515     <span class="results_summary">
516     <xsl:if test="$typeOf008!=''">
517         <span class="label">Type: </span>
518             <xsl:choose>
519                 <xsl:when test="$leader19='a'"><img src="/opac-tmpl/prog/famfamfam/silk/book_link.png" alt="book" title="book"/> Set</xsl:when>
520                 <xsl:when test="$leader6='a'">
521                     <xsl:choose>
522                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'"><img src="/opac-tmpl/prog/famfamfam/silk/book.png" alt="book" title="book"/> Book</xsl:when>
523                         <xsl:when test="$leader7='i' or $leader7='s'"><img src="/opac-tmpl/prog/famfamfam/silk/newspaper.png" alt="serial" title="serial"/> Continuing Resource</xsl:when>
524                         <xsl:when test="$leader7='a' or $leader7='b'"><img src="/opac-tmpl/prog/famfamfam/silk/book_open.png" alt="article" title="article"/> Article</xsl:when>
525                     </xsl:choose>
526                 </xsl:when>
527                 <xsl:when test="$leader6='t'"><img src="/opac-tmpl/prog/famfamfam/silk/book.png" alt="book" title="book"/> Book</xsl:when>
528                                 <xsl:when test="$leader6='o'"><img src="/opac-tmpl/prog/famfamfam/silk/report_disk.png" alt="kit" title="kit"/> Kit</xsl:when>
529                                 <xsl:when test="$leader6='p'"><img src="/opac-tmpl/prog/famfamfam/silk/report_disk.png" alt="mixed materials" title="mixed materials"/>Mixed Materials</xsl:when>
530                 <xsl:when test="$leader6='m'"><img src="/opac-tmpl/prog/famfamfam/silk/computer_link.png" alt="computer file" title="computer file"/> Computer File</xsl:when>
531                 <xsl:when test="$leader6='e' or $leader6='f'"><img src="/opac-tmpl/prog/famfamfam/silk/map.png" alt="map" title="map"/> Map</xsl:when>
532                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'"><img src="/opac-tmpl/prog/famfamfam/silk/film.png" alt="visual material" title="visual material"/> Visual Material</xsl:when>
533                 <xsl:when test="$leader6='c' or $leader6='d'"><img src="/opac-tmpl/prog/famfamfam/silk/music.png" alt="score" title="score"/> Score</xsl:when>
534                 <xsl:when test="$leader6='i'"><img src="/opac-tmpl/prog/famfamfam/silk/sound.png" alt="sound" title="sound"/> Sound</xsl:when>
535                 <xsl:when test="$leader6='j'"><img src="/opac-tmpl/prog/famfamfam/silk/sound.png" alt="music" title="music"/> Music</xsl:when>
536             </xsl:choose>
537     </xsl:if>
538     <xsl:if test="string-length(normalize-space($physicalDescription))">
539         <span class="label">; Format: </span><xsl:copy-of select="$physicalDescription"></xsl:copy-of>
540     </xsl:if>
541
542         <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">
543
544         <xsl:if test="$typeOf008='CR'">
545         <xsl:if test="$controlField008-21 and $controlField008-21 !='|' and $controlField008-21 !=' '">
546         <span class="label">; Type of continuing resource: </span>
547         </xsl:if>
548             <xsl:choose>
549                 <xsl:when test="$controlField008-21='d'">
550                      <img src="/opac-tmpl/prog/famfamfam/silk/database.png" alt="database" title="database"/>
551                 </xsl:when>
552                 <xsl:when test="$controlField008-21='l'">
553                     loose-leaf
554                 </xsl:when>
555                 <xsl:when test="$controlField008-21='m'">
556                     series
557                 </xsl:when>
558                 <xsl:when test="$controlField008-21='n'">
559                     newspaper
560                 </xsl:when>
561                 <xsl:when test="$controlField008-21='p'">
562                     periodical
563                 </xsl:when>
564                 <xsl:when test="$controlField008-21='w'">
565                      <img src="/opac-tmpl/prog/famfamfam/silk/world_link.png" alt="web site" title="web site"/>
566                 </xsl:when>
567             </xsl:choose>
568         </xsl:if>
569         <xsl:if test="$typeOf008='BK' or $typeOf008='CR'">
570         <xsl:if test="contains($controlField008-24,'abcdefghijklmnopqrstvwxyz')">
571         <span class="label">; Nature of contents: </span>
572         </xsl:if>
573             <xsl:choose>
574                 <xsl:when test="contains($controlField008-24,'a')">
575                     abstract or summary
576                 </xsl:when>
577                 <xsl:when test="contains($controlField008-24,'b')">
578                         bibliography
579                      <img src="/opac-tmpl/prog/famfamfam/silk/text_list_bullets.png" alt="bibliography" title="bibliography"/>
580                 </xsl:when>
581                 <xsl:when test="contains($controlField008-24,'c')">
582                     catalog
583                 </xsl:when>
584                 <xsl:when test="contains($controlField008-24,'d')">
585                     dictionary
586                 </xsl:when>
587                 <xsl:when test="contains($controlField008-24,'e')">
588                     encyclopedia
589                 </xsl:when>
590                 <xsl:when test="contains($controlField008-24,'f')">
591                     handbook
592                 </xsl:when>
593                 <xsl:when test="contains($controlField008-24,'g')">
594                     legal article
595                 </xsl:when>
596                 <xsl:when test="contains($controlField008-24,'i')">
597                     index
598                 </xsl:when>
599                 <xsl:when test="contains($controlField008-24,'k')">
600                     discography
601                 </xsl:when>
602                 <xsl:when test="contains($controlField008-24,'l')">
603                     legislation
604                 </xsl:when>
605                 <xsl:when test="contains($controlField008-24,'m')">
606                     theses
607                 </xsl:when>
608                 <xsl:when test="contains($controlField008-24,'n')">
609                     survey of literature
610                 </xsl:when>
611                 <xsl:when test="contains($controlField008-24,'o')">
612                     review
613                 </xsl:when>
614                 <xsl:when test="contains($controlField008-24,'p')">
615                     programmed text
616                 </xsl:when>
617                 <xsl:when test="contains($controlField008-24,'q')">
618                     filmography
619                 </xsl:when>
620                 <xsl:when test="contains($controlField008-24,'r')">
621                     directory
622                 </xsl:when>
623                 <xsl:when test="contains($controlField008-24,'s')">
624                     statistics
625                 </xsl:when>
626                 <xsl:when test="contains($controlField008-24,'t')">
627                      <img src="/opac-tmpl/prog/famfamfam/silk/report.png" alt="technical report" title="technical report"/>
628                 </xsl:when>
629                 <xsl:when test="contains($controlField008-24,'v')">
630                     legal case and case notes
631                 </xsl:when>
632                 <xsl:when test="contains($controlField008-24,'w')">
633                     law report or digest
634                 </xsl:when>
635                 <xsl:when test="contains($controlField008-24,'z')">
636                     treaty
637                 </xsl:when>
638             </xsl:choose>
639             <xsl:choose>
640                 <xsl:when test="$controlField008-29='1'">
641                     conference publication
642                 </xsl:when>
643             </xsl:choose>
644         </xsl:if>
645         <xsl:if test="$typeOf008='CF'">
646             <xsl:if test="$controlField008-26='a' or $controlField008-26='e' or $controlField008-26='f' or $controlField008-26='g'">
647             <span class="label">; Type of computer file: </span>
648             </xsl:if>
649             <xsl:choose>
650                 <xsl:when test="$controlField008-26='a'">
651                     numeric data
652                 </xsl:when>
653                 <xsl:when test="$controlField008-26='e'">
654                      <img src="/opac-tmpl/prog/famfamfam/silk/database.png" alt="database" title="database"/>
655                 </xsl:when>
656                 <xsl:when test="$controlField008-26='f'">
657                      <img src="/opac-tmpl/prog/famfamfam/silk/font.png" alt="font" title="font"/> 
658                 </xsl:when>
659                 <xsl:when test="$controlField008-26='g'">
660                      <img src="/opac-tmpl/prog/famfamfam/silk/controller.png" alt="game" title="game"/>
661                 </xsl:when>
662             </xsl:choose>
663         </xsl:if>
664         <xsl:if test="$typeOf008='BK'">
665             <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')">
666             <span class="label">; Nature of contents: </span>
667             </xsl:if>
668             <xsl:if test="substring($controlField008,25,1)='j'">
669                 patent
670             </xsl:if>
671             <xsl:if test="substring($controlField008,31,1)='1'">
672                 festschrift
673             </xsl:if>
674             <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
675                  <img src="/opac-tmpl/prog/famfamfam/silk/user.png" alt="biography" title="biography"/>
676             </xsl:if>
677
678             <xsl:if test="$controlField008-33 and $controlField008-33!='|' and $controlField008-33!='u' and $controlField008-33!=' '">
679             <span class="label">; Literary form: </span>
680             </xsl:if>
681             <xsl:choose>
682                 <xsl:when test="$controlField008-33='0'">
683                     not fiction
684                 </xsl:when>
685                 <xsl:when test="$controlField008-33='1'">
686                     fiction
687                 </xsl:when> 
688                 <xsl:when test="$controlField008-33='e'">
689                     essay
690                 </xsl:when>
691                 <xsl:when test="$controlField008-33='d'">
692                     drama
693                 </xsl:when>
694                 <xsl:when test="$controlField008-33='c'">
695                     comic strip
696                 </xsl:when>
697                 <xsl:when test="$controlField008-33='l'">
698                     fiction
699                 </xsl:when>
700                 <xsl:when test="$controlField008-33='h'">
701                     humor, satire
702                 </xsl:when>
703                 <xsl:when test="$controlField008-33='i'">
704                     letter
705                 </xsl:when>
706                 <xsl:when test="$controlField008-33='f'">
707                     novel
708                 </xsl:when>
709                 <xsl:when test="$controlField008-33='j'">
710                     short story
711                 </xsl:when>
712                 <xsl:when test="$controlField008-33='s'">
713                     speech
714                 </xsl:when>
715             </xsl:choose>
716         </xsl:if> 
717         <xsl:if test="$typeOf008='MU' and $controlField008-30-31 and $controlField008-30-31!='||' and $controlField008-30-31!='  '">
718             <span class="label">; Literary form: </span> <!-- Literary text for sound recordings -->
719             <xsl:if test="contains($controlField008-30-31,'b')">
720                 biography
721             </xsl:if>
722             <xsl:if test="contains($controlField008-30-31,'c')">
723                 conference publication
724             </xsl:if>
725             <xsl:if test="contains($controlField008-30-31,'d')">
726                 drama
727             </xsl:if>
728             <xsl:if test="contains($controlField008-30-31,'e')">
729                 essay
730             </xsl:if>
731             <xsl:if test="contains($controlField008-30-31,'f')">
732                 fiction
733             </xsl:if>
734             <xsl:if test="contains($controlField008-30-31,'o')">
735                 folktale
736             </xsl:if>
737             <xsl:if test="contains($controlField008-30-31,'h')">
738                 history
739             </xsl:if>
740             <xsl:if test="contains($controlField008-30-31,'k')">
741                 humor, satire
742             </xsl:if>
743             <xsl:if test="contains($controlField008-30-31,'m')">
744                 memoir
745             </xsl:if>
746             <xsl:if test="contains($controlField008-30-31,'p')">
747                 poetry
748             </xsl:if>
749             <xsl:if test="contains($controlField008-30-31,'r')">
750                 rehearsal
751             </xsl:if>
752             <xsl:if test="contains($controlField008-30-31,'g')">
753                 reporting
754             </xsl:if>
755             <xsl:if test="contains($controlField008-30-31,'s')">
756                 sound
757             </xsl:if>
758             <xsl:if test="contains($controlField008-30-31,'l')">
759                 speech
760             </xsl:if>
761         </xsl:if>
762         <xsl:if test="$typeOf008='VM'">
763             <span class="label">; Type of visual material: </span>
764             <xsl:choose>
765                 <xsl:when test="$controlField008-33='a'">
766                     art original
767                 </xsl:when>
768                 <xsl:when test="$controlField008-33='b'">
769                     kit
770                 </xsl:when>
771                 <xsl:when test="$controlField008-33='c'">
772                     art reproduction
773                 </xsl:when>
774                 <xsl:when test="$controlField008-33='d'">
775                     diorama
776                 </xsl:when>
777                 <xsl:when test="$controlField008-33='f'">
778                     filmstrip
779                 </xsl:when>
780                 <xsl:when test="$controlField008-33='g'">
781                     legal article
782                 </xsl:when>
783                 <xsl:when test="$controlField008-33='i'">
784                     picture
785                 </xsl:when>
786                 <xsl:when test="$controlField008-33='k'">
787                     graphic
788                 </xsl:when>
789                 <xsl:when test="$controlField008-33='l'">
790                     technical drawing
791                 </xsl:when>
792                 <xsl:when test="$controlField008-33='m'">
793                     motion picture
794                 </xsl:when>
795                 <xsl:when test="$controlField008-33='n'">
796                     chart
797                 </xsl:when>
798                 <xsl:when test="$controlField008-33='o'">
799                     flash card
800                 </xsl:when>
801                 <xsl:when test="$controlField008-33='p'">
802                     microscope slide
803                 </xsl:when>
804                 <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2
805 ,1)='q']">
806                     model
807                 </xsl:when>
808                 <xsl:when test="$controlField008-33='r'">
809                     realia
810                 </xsl:when>
811                 <xsl:when test="$controlField008-33='s'">
812                     slide
813                 </xsl:when>
814                 <xsl:when test="$controlField008-33='t'">
815                     transparency
816                 </xsl:when>
817                 <xsl:when test="$controlField008-33='v'">
818                     videorecording
819                 </xsl:when>
820                 <xsl:when test="$controlField008-33='w'">
821                     toy
822                 </xsl:when>
823             </xsl:choose>
824         </xsl:if>
825         </xsl:if> 
826
827     <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')">
828         <span class="label">; Audience: </span>
829         <xsl:choose>
830             <xsl:when test="$controlField008-22='a'">
831              Preschool;
832             </xsl:when>
833             <xsl:when test="$controlField008-22='b'">
834              Primary;
835             </xsl:when>
836             <xsl:when test="$controlField008-22='c'">
837              Pre-adolescent;
838             </xsl:when>
839             <xsl:when test="$controlField008-22='d'">
840              Adolescent;
841             </xsl:when>
842             <xsl:when test="$controlField008-22='e'">
843              Adult;
844             </xsl:when>
845             <xsl:when test="$controlField008-22='g'">
846              General;
847             </xsl:when>
848             <xsl:when test="$controlField008-22='j'">
849              Juvenile;
850             </xsl:when>
851             <xsl:when test="$controlField008-22='f'">
852              Specialized;
853             </xsl:when>
854             </xsl:choose>
855     </xsl:if>
856 <xsl:text> </xsl:text> <!-- added blank space to fix font display problem, see Bug 3671 -->
857         </span>
858 </xsl:if>
859
860     <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
861     <xsl:if test="$display880">
862       <xsl:call-template name="m880Select">
863         <xsl:with-param name="basetags">260</xsl:with-param>
864         <xsl:with-param name="codes">abcg</xsl:with-param>
865         <xsl:with-param name="class">results_summary</xsl:with-param>
866         <xsl:with-param name="label">Publisher: </xsl:with-param>
867       </xsl:call-template>
868     </xsl:if>
869         
870     <xsl:if test="marc:datafield[@tag=260]">
871         <span class="results_summary">
872     <span class="label">Publisher: </span> 
873             <xsl:for-each select="marc:datafield[@tag=260]">
874                     <xsl:call-template name="subfieldSelect">
875                         <xsl:with-param name="codes">abcg</xsl:with-param>
876                     </xsl:call-template>
877             </xsl:for-each>
878         </span>
879     </xsl:if>
880
881     <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
882     <xsl:if test="$display880">
883        <xsl:call-template name="m880Select">
884          <xsl:with-param name="basetags">246</xsl:with-param>
885          <xsl:with-param name="codes">ab</xsl:with-param>
886          <xsl:with-param name="class">results_summary</xsl:with-param>
887          <xsl:with-param name="label">Other Title: </xsl:with-param>
888        </xsl:call-template>
889     </xsl:if>
890         
891     <xsl:if test="marc:datafield[@tag=246]">
892         <span class="results_summary">
893     <span class="label">Other title: </span>
894             <xsl:for-each select="marc:datafield[@tag=246]">
895                     <xsl:call-template name="subfieldSelect">
896                         <xsl:with-param name="codes">ab</xsl:with-param>
897                     </xsl:call-template>
898                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
899             </xsl:for-each>
900         </span>
901     </xsl:if>
902     <xsl:if test="marc:datafield[@tag=856]">
903          <span class="results_summary">
904                            <span class="label">Online Access: </span>
905                             <xsl:for-each select="marc:datafield[@tag=856]">
906                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
907                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
908                                     <xsl:choose>
909                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
910                                         <xsl:call-template name="subfieldSelect">                        
911                                         <xsl:with-param name="codes">y3z</xsl:with-param>                    
912                                         </xsl:call-template>
913                                     </xsl:when>
914                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
915                                         <xsl:choose>
916                                         <xsl:when test="$URLLinkText!=''">
917                                                 <xsl:value-of select="$URLLinkText"/>
918                                         </xsl:when>
919                                         <xsl:otherwise>
920                                                 <xsl:text>Click here to access online</xsl:text>
921                                         </xsl:otherwise>
922                                         </xsl:choose>
923                                     </xsl:when>
924                                     </xsl:choose>
925                                     </a>
926                               </xsl:if>
927                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
928                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
929                                     <xsl:choose>
930                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
931                                         <xsl:call-template name="subfieldSelect">                        
932                                         <xsl:with-param name="codes">y3z</xsl:with-param>                    
933                                         </xsl:call-template>
934                                     </xsl:when>
935                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
936                                         <xsl:choose>
937                                         <xsl:when test="$URLLinkText!=''">
938                                                 <xsl:value-of select="$URLLinkText"/>
939                                         </xsl:when>
940                                         <xsl:otherwise>
941                                                 <xsl:text>Click here to access online</xsl:text>
942                                         </xsl:otherwise>
943                                         </xsl:choose>
944                                     </xsl:when>
945                                     </xsl:choose>
946                                     </a>
947                               </xsl:if>
948                                     <xsl:choose>
949                                     <xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
950                                     <xsl:otherwise> | </xsl:otherwise>
951                                     </xsl:choose>
952                             </xsl:for-each>
953                             </span>
954                         </xsl:if>
955                         <span class="results_summary">
956                         <span class="label">Availability: </span>
957                         <xsl:choose>
958                                    <xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0">No copies available
959                                    </xsl:when>
960                    <xsl:when test="count(key('item-by-status', 'available'))>0">
961                    <span class="available">
962                        <b><xsl:text>Copies available for loan: </xsl:text></b>
963                        <xsl:variable name="available_items"
964                            select="key('item-by-status', 'available')"/>
965                        <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
966                            <xsl:value-of select="items:homebranch"/>
967                                                    <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
968                            <xsl:text> (</xsl:text>
969                            <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
970                            <xsl:text>)</xsl:text>
971 <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
972                        </xsl:for-each>
973                    </span>
974                    </xsl:when>
975                                    </xsl:choose>
976
977                    <xsl:choose>
978                    <xsl:when test="count(key('item-by-status', 'reference'))>0">
979                    <span class="available">
980                        <b><xsl:text>Copies available for reference: </xsl:text></b>
981                        <xsl:variable name="reference_items"
982                            select="key('item-by-status', 'reference')"/>
983                        <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
984                            <xsl:value-of select="items:homebranch"/>
985                                                    <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
986                            <xsl:text> (</xsl:text>
987                            <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
988                            <xsl:text>)</xsl:text>
989                    <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
990                        </xsl:for-each>
991                    </span>
992                    </xsl:when>
993                    </xsl:choose>
994
995                    <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
996                    <span class="unavailable">
997                        <xsl:text>Checked out (</xsl:text>
998                        <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/>
999                        <xsl:text>). </xsl:text>
1000                                    </span>
1001                    </xsl:if>
1002                    <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0">
1003                    <span class="unavailable">
1004                        <xsl:text>Withdrawn (</xsl:text>
1005                        <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/>
1006                        <xsl:text>). </xsl:text>                   </span>
1007                                    </xsl:if>
1008                     <xsl:if test="count(key('item-by-status', 'Lost'))>0">
1009                    <span class="unavailable">
1010                        <xsl:text>Lost (</xsl:text>
1011                        <xsl:value-of select="count(key('item-by-status', 'Lost'))"/>
1012                        <xsl:text>). </xsl:text>                   </span>
1013                                    </xsl:if>
1014                     <xsl:if test="count(key('item-by-status', 'Damaged'))>0">
1015                    <span class="unavailable">
1016                        <xsl:text>Damaged (</xsl:text>
1017                        <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/>
1018                        <xsl:text>). </xsl:text>                   </span>
1019                    </xsl:if>
1020                     <xsl:if test="count(key('item-by-status', 'On order'))>0">
1021                    <span class="unavailable">
1022                        <xsl:text>On order (</xsl:text>
1023                        <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
1024                        <xsl:text>). </xsl:text>                   </span>
1025                    </xsl:if>
1026                     <xsl:if test="count(key('item-by-status', 'In transit'))>0">
1027                    <span class="unavailable">
1028                        <xsl:text>In transit (</xsl:text>
1029                        <xsl:value-of select="count(key('item-by-status', 'In transit'))"/>
1030                        <xsl:text>). </xsl:text>                   </span>
1031                    </xsl:if>
1032                     <xsl:if test="count(key('item-by-status', 'Waiting'))>0">
1033                    <span class="unavailable">
1034                        <xsl:text>On hold (</xsl:text>
1035                        <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
1036                        <xsl:text>). </xsl:text>                   </span>
1037                    </xsl:if>
1038                </span>
1039     </xsl:template>
1040
1041     <xsl:template name="nameABCDQ">
1042             <xsl:call-template name="chopPunctuation">
1043                 <xsl:with-param name="chopString">
1044                     <xsl:call-template name="subfieldSelect">
1045                         <xsl:with-param name="codes">aq</xsl:with-param>
1046                     </xsl:call-template>
1047                 </xsl:with-param>
1048                 <xsl:with-param name="punctuation">
1049                     <xsl:text>:,;/ </xsl:text>
1050                 </xsl:with-param>
1051             </xsl:call-template>
1052         <xsl:call-template name="termsOfAddress"/>
1053     </xsl:template>
1054
1055     <xsl:template name="nameABCDN">
1056         <xsl:for-each select="marc:subfield[@code='a']">
1057                 <xsl:call-template name="chopPunctuation">
1058                     <xsl:with-param name="chopString" select="."/>
1059                 </xsl:call-template>
1060         </xsl:for-each>
1061         <xsl:for-each select="marc:subfield[@code='b']">
1062                 <xsl:value-of select="."/>
1063         </xsl:for-each>
1064         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
1065                 <xsl:call-template name="subfieldSelect">
1066                     <xsl:with-param name="codes">cdn</xsl:with-param>
1067                 </xsl:call-template>
1068         </xsl:if>
1069     </xsl:template>
1070
1071     <xsl:template name="nameACDEQ">
1072             <xsl:call-template name="subfieldSelect">
1073                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1074             </xsl:call-template>
1075     </xsl:template>
1076
1077     <xsl:template name="termsOfAddress">
1078         <xsl:if test="marc:subfield[@code='b' or @code='c']">
1079             <xsl:call-template name="chopPunctuation">
1080                 <xsl:with-param name="chopString">
1081                     <xsl:call-template name="subfieldSelect">
1082                         <xsl:with-param name="codes">bc</xsl:with-param>
1083                     </xsl:call-template>
1084                 </xsl:with-param>
1085             </xsl:call-template>
1086         </xsl:if>
1087     </xsl:template>
1088
1089     <xsl:template name="nameDate">
1090         <xsl:for-each select="marc:subfield[@code='d']">
1091             <xsl:call-template name="chopPunctuation">
1092                 <xsl:with-param name="chopString" select="."/>
1093             </xsl:call-template>
1094         </xsl:for-each>
1095     </xsl:template>
1096
1097     <xsl:template name="role">
1098         <xsl:for-each select="marc:subfield[@code='e']">
1099                     <xsl:value-of select="."/>
1100         </xsl:for-each>
1101         <xsl:for-each select="marc:subfield[@code='4']">
1102                     <xsl:value-of select="."/>
1103         </xsl:for-each>
1104     </xsl:template>
1105
1106     <xsl:template name="specialSubfieldSelect">
1107         <xsl:param name="anyCodes"/>
1108         <xsl:param name="axis"/>
1109         <xsl:param name="beforeCodes"/>
1110         <xsl:param name="afterCodes"/>
1111         <xsl:variable name="str">
1112             <xsl:for-each select="marc:subfield">
1113                 <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])">
1114                     <xsl:value-of select="text()"/>
1115                     <xsl:text> </xsl:text>
1116                 </xsl:if>
1117             </xsl:for-each>
1118         </xsl:variable>
1119         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1120     </xsl:template>
1121
1122     <xsl:template name="subtitle">
1123         <xsl:if test="marc:subfield[@code='b']">
1124                 <xsl:call-template name="chopPunctuation">
1125                     <xsl:with-param name="chopString">
1126                         <xsl:value-of select="marc:subfield[@code='b']"/>
1127
1128                         <!--<xsl:call-template name="subfieldSelect">
1129                             <xsl:with-param name="codes">b</xsl:with-param>                                 
1130                         </xsl:call-template>-->
1131                     </xsl:with-param>
1132                 </xsl:call-template>
1133         </xsl:if>
1134     </xsl:template>
1135
1136     <xsl:template name="chopBrackets">
1137         <xsl:param name="chopString"></xsl:param>
1138         <xsl:variable name="string">
1139             <xsl:call-template name="chopPunctuation">
1140                 <xsl:with-param name="chopString" select="$chopString"></xsl:with-param>
1141             </xsl:call-template>
1142         </xsl:variable>
1143         <xsl:if test="substring($string, 1,1)='['">
1144             <xsl:value-of select="substring($string,2, string-length($string)-2)"></xsl:value-of>
1145         </xsl:if>
1146         <xsl:if test="substring($string, 1,1)!='['">
1147             <xsl:value-of select="$string"></xsl:value-of>
1148         </xsl:if>
1149     </xsl:template>
1150
1151 </xsl:stylesheet>