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