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