1 <?xml version="1.0" encoding="UTF-8"?>
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" select="marc:controlfield[@tag=001]"/>
27 <xsl:variable name="isbn" select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/>
28 <xsl:variable name="OPACResultsLibrary" select="marc:sysprefs/marc:syspref[@name='OPACResultsLibrary']"/>
29 <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/>
30 <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
31 <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
32 <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
34 <xsl:if test="marc:datafield[@tag=200]">
35 <xsl:for-each select="marc:datafield[@tag=200]">
36 <xsl:call-template name="addClassRtl" />
37 <xsl:for-each select="marc:subfield">
39 <xsl:when test="@code='a'">
40 <xsl:variable name="title" select="."/>
41 <xsl:variable name="ntitle"
42 select="translate($title, 'ˆ‰˜œ','')"/>
44 <xsl:attribute name="href">
45 <xsl:call-template name="buildBiblioDefaultViewURL">
46 <xsl:with-param name="BiblioDefaultView">
47 <xsl:value-of select="$BiblioDefaultView"/>
50 <xsl:value-of select="str:encode-uri($biblionumber, true())"/>
52 <xsl:attribute name="class">title</xsl:attribute>
53 <xsl:value-of select="$ntitle" />
56 <xsl:when test="@code='b'">
57 <xsl:text> [</xsl:text>
58 <xsl:value-of select="."/>
59 <xsl:text>]</xsl:text>
61 <xsl:when test="@code='d'">
62 <xsl:text> = </xsl:text>
63 <xsl:value-of select="."/>
65 <xsl:when test="@code='e'">
66 <xsl:text> : </xsl:text>
67 <xsl:value-of select="."/>
69 <xsl:when test="@code='f'">
70 <xsl:text> / </xsl:text>
71 <xsl:value-of select="."/>
73 <xsl:when test="@code='g'">
74 <xsl:text> ; </xsl:text>
75 <xsl:value-of select="."/>
78 <xsl:text>, </xsl:text>
79 <xsl:value-of select="."/>
87 <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
88 <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
89 <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
90 <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
92 <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
93 <xsl:variable name="openurltext">
95 <xsl:when test="$OpenURLText != ''">
96 <xsl:value-of select="$OpenURLText" />
99 <xsl:text>OpenURL</xsl:text>
104 <span class="results_summary"><a>
105 <xsl:attribute name="href">
106 <xsl:value-of select="$OpenURLResolverURL" />
108 <xsl:attribute name="title">
109 <xsl:value-of select="$openurltext" />
111 <xsl:attribute name="class">
112 <xsl:text>OpenURL</xsl:text>
114 <xsl:if test="$OPACURLOpenInNewWindow='1'">
115 <xsl:attribute name="target">
116 <xsl:text>_blank</xsl:text>
120 <xsl:when test="$OpenURLImageLocation != ''">
122 <xsl:attribute name="src">
123 <xsl:value-of select="$OpenURLImageLocation" />
128 <xsl:value-of select="$openurltext" />
133 <!-- End of OpenURL -->
135 <xsl:call-template name="tag_title">
136 <xsl:with-param name="tag">454</xsl:with-param>
137 <xsl:with-param name="label">Translation of</xsl:with-param>
138 <xsl:with-param name="spanclass">original_title</xsl:with-param>
141 <xsl:call-template name="tag_title">
142 <xsl:with-param name="tag">461</xsl:with-param>
143 <xsl:with-param name="label">Set Level</xsl:with-param>
144 <xsl:with-param name="spanclass">set_level</xsl:with-param>
147 <xsl:call-template name="tag_title">
148 <xsl:with-param name="tag">464</xsl:with-param>
149 <xsl:with-param name="label">Piece-Analytic Level</xsl:with-param>
150 <xsl:with-param name="spanclass">piece_analytic_level</xsl:with-param>
153 <xsl:call-template name="tag_210" />
155 <xsl:call-template name="tag_215" />
157 <span class="results_summary availability">
158 <span class="label">Availability: </span>
160 <xsl:when test="marc:datafield[@tag=856]">
161 <xsl:for-each select="marc:datafield[@tag=856]">
163 <xsl:when test="@ind2=0">
165 <xsl:attribute name="href">
166 <xsl:value-of select="marc:subfield[@code='u']"/>
168 <xsl:if test="$OPACURLOpenInNewWindow='1'">
169 <xsl:attribute name="target">_blank</xsl:attribute>
172 <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
173 <xsl:call-template name="subfieldSelect">
174 <xsl:with-param name="codes">y3z</xsl:with-param>
177 <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
178 Click here to access online
183 <xsl:when test="position()=last()"></xsl:when>
184 <xsl:otherwise> | </xsl:otherwise>
190 <xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0">
193 <xsl:when test="count(key('item-by-status', 'available'))>0">
194 <span class="available">
195 <strong><xsl:text>Items available for loan: </xsl:text></strong>
196 <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
198 <xsl:when test="$singleBranchMode=1">
199 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
200 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
201 <xsl:text> (</xsl:text>
202 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
203 <xsl:text>)</xsl:text>
204 <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
209 <xsl:when test="$OPACResultsLibrary='homebranch'">
210 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
211 <xsl:value-of select="items:homebranch"/>
212 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
214 <xsl:text> (</xsl:text>
215 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
216 <xsl:text>)</xsl:text>
218 <xsl:when test="position()=last()">
219 <xsl:text>. </xsl:text>
222 <xsl:text>, </xsl:text>
228 <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
229 <xsl:value-of select="items:holdingbranch"/>
230 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
232 <xsl:text> (</xsl:text>
233 <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
234 <xsl:text>)</xsl:text>
236 <xsl:when test="position()=last()">
237 <xsl:text>. </xsl:text>
240 <xsl:text>, </xsl:text>
252 <xsl:when test="count(key('item-by-status', 'reference'))>0">
253 <span class="available">
254 <strong><xsl:text>Items available for reference: </xsl:text></strong>
255 <xsl:variable name="reference_items"
256 select="key('item-by-status', 'reference')"/>
257 <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
258 <xsl:if test="$singleBranchMode=0">
259 <xsl:value-of select="items:homebranch"/>
261 <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
262 <xsl:text> (</xsl:text>
263 <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
264 <xsl:text>)</xsl:text>
266 <xsl:when test="position()=last()">
267 <xsl:text>. </xsl:text>
270 <xsl:text>, </xsl:text>
277 <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
278 <span class="unavailable">
279 <xsl:text>Checked out (</xsl:text>
280 <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/>
281 <xsl:text>). </xsl:text>
284 <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0">
285 <span class="unavailable">
286 <xsl:text>Withdrawn (</xsl:text>
287 <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/>
288 <xsl:text>). </xsl:text>
291 <xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0">
292 <span class="unavailable">
293 <xsl:text>Lost (</xsl:text>
294 <xsl:value-of select="count(key('item-by-status', 'Lost'))"/>
295 <xsl:text>). </xsl:text>
298 <xsl:if test="count(key('item-by-status', 'Damaged'))>0">
299 <span class="unavailable">
300 <xsl:text>Damaged (</xsl:text>
301 <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/>
302 <xsl:text>). </xsl:text>
305 <xsl:if test="count(key('item-by-status', 'On order'))>0">
306 <span class="unavailable">
307 <xsl:text>On order (</xsl:text>
308 <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
309 <xsl:text>). </xsl:text>
312 <xsl:if test="count(key('item-by-status', 'In transit'))>0">
313 <span class="unavailable">
314 <xsl:text>In transit (</xsl:text>
315 <xsl:value-of select="count(key('item-by-status', 'In transit'))"/>
316 <xsl:text>). </xsl:text>
319 <xsl:if test="count(key('item-by-status', 'Waiting'))>0">
320 <span class="unavailable">
321 <xsl:text>On hold (</xsl:text>
322 <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
323 <xsl:text>). </xsl:text>