1 <?xml version="1.0" encoding="UTF-8"?>
3 <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
5 <xsl:stylesheet version="1.0"
6 xmlns:marc="http://www.loc.gov/MARC21/slim"
7 xmlns:items="http://www.koha-community.org/items"
8 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:str="http://exslt.org/strings"
10 exclude-result-prefixes="marc items str">
12 <xsl:import href="UNIMARCslimUtils.xsl"/>
13 <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
14 <xsl:key name="item-by-status" match="items:item" use="items:status"/>
15 <xsl:key name="item-by-status-and-branch-home" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
16 <xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/>
18 <xsl:template match="/">
19 <xsl:apply-templates/>
22 <xsl:template match="marc:record">
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="biblionumber"
27 select="marc:datafield[@tag=090]/marc:subfield[@code='a']"/>
28 <xsl:variable name="isbn"
29 select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/>
30 <xsl:variable name="OPACResultsLibrary" select="marc:sysprefs/marc:syspref[@name='OPACResultsLibrary']"/>
31 <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/>
32 <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
33 <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
34 <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
36 <xsl:if test="marc:datafield[@tag=200]">
37 <xsl:for-each select="marc:datafield[@tag=200]">
38 <xsl:call-template name="addClassRtl" />
39 <xsl:for-each select="marc:subfield">
41 <xsl:when test="@code='a'">
42 <xsl:variable name="title" select="."/>
43 <xsl:variable name="ntitle"
44 select="translate($title, 'ˆ‰˜œ','')"/>
46 <xsl:attribute name="href">
47 <xsl:call-template name="buildBiblioDefaultViewURL">
48 <xsl:with-param name="BiblioDefaultView">
49 <xsl:value-of select="$BiblioDefaultView"/>
52 <xsl:value-of select="str:encode-uri($biblionumber, true())"/>
54 <xsl:attribute name="class">title</xsl:attribute>
55 <xsl:value-of select="$ntitle" />
58 <xsl:when test="@code='b'">
59 <xsl:text> [</xsl:text>
60 <xsl:value-of select="."/>
61 <xsl:text>]</xsl:text>
63 <xsl:when test="@code='d'">
64 <xsl:text> = </xsl:text>
65 <xsl:value-of select="."/>
67 <xsl:when test="@code='e'">
68 <xsl:text> : </xsl:text>
69 <xsl:value-of select="."/>
71 <xsl:when test="@code='f'">
72 <xsl:text> / </xsl:text>
73 <xsl:value-of select="."/>
75 <xsl:when test="@code='g'">
76 <xsl:text> ; </xsl:text>
77 <xsl:value-of select="."/>
80 <xsl:text>, </xsl:text>
81 <xsl:value-of select="."/>
89 <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
90 <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
91 <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
92 <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
94 <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
95 <xsl:variable name="openurltext">
97 <xsl:when test="$OpenURLText != ''">
98 <xsl:value-of select="$OpenURLText" />
101 <xsl:text>OpenURL</xsl:text>
106 <span class="results_summary"><a>
107 <xsl:attribute name="href">
108 <xsl:value-of select="$OpenURLResolverURL" />
110 <xsl:attribute name="title">
111 <xsl:value-of select="$openurltext" />
113 <xsl:attribute name="class">
114 <xsl:text>OpenURL</xsl:text>
116 <xsl:if test="$OPACURLOpenInNewWindow='1'">
117 <xsl:attribute name="target">
118 <xsl:text>_blank</xsl:text>
122 <xsl:when test="$OpenURLImageLocation != ''">
124 <xsl:attribute name="src">
125 <xsl:value-of select="$OpenURLImageLocation" />
130 <xsl:value-of select="$openurltext" />
135 <!-- End of OpenURL -->
137 <xsl:call-template name="tag_title">
138 <xsl:with-param name="tag">454</xsl:with-param>
139 <xsl:with-param name="label">Translation of</xsl:with-param>
140 <xsl:with-param name="spanclass">original_title</xsl:with-param>
143 <xsl:call-template name="tag_title">
144 <xsl:with-param name="tag">461</xsl:with-param>
145 <xsl:with-param name="label">Set Level</xsl:with-param>
146 <xsl:with-param name="spanclass">set_level</xsl:with-param>
149 <xsl:call-template name="tag_title">
150 <xsl:with-param name="tag">464</xsl:with-param>
151 <xsl:with-param name="label">Piece-Analytic Level</xsl:with-param>
152 <xsl:with-param name="spanclass">piece_analytic_level</xsl:with-param>
155 <xsl:call-template name="tag_210" />
157 <xsl:call-template name="tag_215" />
159 <span class="results_summary availability">
160 <span class="label">Availability: </span>
162 <xsl:when test="marc:datafield[@tag=856]">
163 <xsl:for-each select="marc:datafield[@tag=856]">
165 <xsl:when test="@ind2=0">
167 <xsl:attribute name="href">
168 <xsl:value-of select="marc:subfield[@code='u']"/>
170 <xsl:if test="$OPACURLOpenInNewWindow='1'">
171 <xsl:attribute name="target">_blank</xsl:attribute>
174 <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
175 <xsl:call-template name="subfieldSelect">
176 <xsl:with-param name="codes">y3z</xsl:with-param>
179 <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
180 Click here to access online
185 <xsl:when test="position()=last()"></xsl:when>
186 <xsl:otherwise> | </xsl:otherwise>
192 <xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0">
195 <xsl:when test="count(key('item-by-status', 'available'))>0">
196 <span class="available">
197 <b><xsl:text>Items available for loan: </xsl:text></b>
198 <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
200 <xsl:when test="$singleBranchMode=1">
201 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
202 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
203 <xsl:text> (</xsl:text>
204 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
205 <xsl:text>)</xsl:text>
206 <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
211 <xsl:when test="$OPACResultsLibrary='homebranch'">
212 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
213 <xsl:value-of select="items:homebranch"/>
214 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
216 <xsl:text> (</xsl:text>
217 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
218 <xsl:text>)</xsl:text>
220 <xsl:when test="position()=last()">
221 <xsl:text>. </xsl:text>
224 <xsl:text>, </xsl:text>
230 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
231 <xsl:value-of select="items:holdingbranch"/>
232 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
234 <xsl:text> (</xsl:text>
235 <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
236 <xsl:text>)</xsl:text>
238 <xsl:when test="position()=last()">
239 <xsl:text>. </xsl:text>
242 <xsl:text>, </xsl:text>
254 <xsl:when test="count(key('item-by-status', 'reference'))>0">
255 <span class="available">
256 <b><xsl:text>Items available for reference: </xsl:text></b>
257 <xsl:variable name="reference_items"
258 select="key('item-by-status', 'reference')"/>
259 <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
260 <xsl:if test="$singleBranchMode=0">
261 <xsl:value-of select="items:homebranch"/>
263 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
264 <xsl:text> (</xsl:text>
265 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
266 <xsl:text>)</xsl:text>
268 <xsl:when test="position()=last()">
269 <xsl:text>. </xsl:text>
272 <xsl:text>, </xsl:text>
279 <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
280 <span class="unavailable">
281 <xsl:text>Checked out (</xsl:text>
282 <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/>
283 <xsl:text>). </xsl:text>
286 <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0">
287 <span class="unavailable">
288 <xsl:text>Withdrawn (</xsl:text>
289 <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/>
290 <xsl:text>). </xsl:text>
293 <xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0">
294 <span class="unavailable">
295 <xsl:text>Lost (</xsl:text>
296 <xsl:value-of select="count(key('item-by-status', 'Lost'))"/>
297 <xsl:text>). </xsl:text>
300 <xsl:if test="count(key('item-by-status', 'Damaged'))>0">
301 <span class="unavailable">
302 <xsl:text>Damaged (</xsl:text>
303 <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/>
304 <xsl:text>). </xsl:text>
307 <xsl:if test="count(key('item-by-status', 'On order'))>0">
308 <span class="unavailable">
309 <xsl:text>On order (</xsl:text>
310 <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
311 <xsl:text>). </xsl:text>
314 <xsl:if test="count(key('item-by-status', 'In transit'))>0">
315 <span class="unavailable">
316 <xsl:text>In transit (</xsl:text>
317 <xsl:value-of select="count(key('item-by-status', 'In transit'))"/>
318 <xsl:text>). </xsl:text>
321 <xsl:if test="count(key('item-by-status', 'Waiting'))>0">
322 <span class="unavailable">
323 <xsl:text>On hold (</xsl:text>
324 <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
325 <xsl:text>). </xsl:text>