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/>
14 <xsl:template match="marc:record">
15 <xsl:variable name="leader" select="marc:leader"/>
16 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
17 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
18 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
19 <xsl:variable name="materialTypeCode">
21 <xsl:when test="$leader6='a'">
23 <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
24 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
27 <xsl:when test="$leader6='t'">BK</xsl:when>
28 <xsl:when test="$leader6='p'">MX</xsl:when>
29 <xsl:when test="$leader6='m'">CF</xsl:when>
30 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
31 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
32 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
35 <xsl:variable name="materialTypeLabel">
37 <xsl:when test="$leader6='a'">
39 <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
40 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">Serial</xsl:when>
43 <xsl:when test="$leader6='t'">Book</xsl:when>
44 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
45 <xsl:when test="$leader6='m'">Computer File</xsl:when>
46 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
47 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">Visual Material</xsl:when>
48 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Music</xsl:when>
52 <!-- Title Statement -->
53 <xsl:if test="marc:datafield[@tag=245]">
55 <xsl:for-each select="marc:datafield[@tag=245]">
56 <xsl:call-template name="subfieldSelect">
57 <xsl:with-param name="codes">abfghk</xsl:with-param>
64 <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]">
67 <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
70 <xsl:when test="marc:subfield[@code=9]">
71 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
74 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
77 <xsl:call-template name="nameABCDQ"/></a>
79 <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
82 <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
85 <xsl:when test="marc:subfield[@code=9]">
86 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
89 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
92 <xsl:call-template name="nameABCDN"/></a>
93 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
96 <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
99 <xsl:when test="marc:subfield[@code=9]">
100 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
103 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
106 <xsl:call-template name="nameACDEQ"/></a>
107 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
114 <span class="view"><span id="Normalview">Normal View</span> </span>
115 <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>
116 <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>
117 <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>
121 <xsl:if test="$materialTypeCode">
122 <span class="results_summary"><span class="label">Type: </span>
123 <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>
124 <xsl:value-of select="$materialTypeLabel"/>
127 <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
128 <span class="results_summary"><span class="label">Series: </span>
129 <xsl:for-each select="marc:datafield[@tag=440]">
130 <xsl:call-template name="chopPunctuation">
131 <xsl:with-param name="chopString">
132 <xsl:call-template name="subfieldSelect">
133 <xsl:with-param name="codes">av</xsl:with-param>
137 <xsl:call-template name="part"/>
138 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
141 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
142 <a href="/cgi-bin/koha/opac-search.pl?se:{marc:subfield[@code='a']}">
143 <xsl:call-template name="chopPunctuation">
144 <xsl:with-param name="chopString">
145 <xsl:call-template name="subfieldSelect">
146 <xsl:with-param name="codes">av</xsl:with-param>
151 <xsl:call-template name="part"/>
152 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
156 <xsl:if test="marc:datafield[@tag=260]">
157 <span class="results_summary"><span class="label">Publisher: </span>
158 <xsl:for-each select="marc:datafield[@tag=260]">
159 <xsl:call-template name="subfieldSelect">
160 <xsl:with-param name="codes">bcg</xsl:with-param>
162 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
166 <xsl:if test="marc:datafield[@tag=020]">
167 <span class="results_summary"><span class="label">ISBN: </span>
168 <!-- unAPI <abbr/> tag -->
169 <xsl:for-each select="marc:datafield[@tag=020]">
170 <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
171 <abbr class="unapi-id" title="koha:isbn:{$isbn}"><xsl:value-of select="marc:subfield[@code='a']"/></abbr>
172 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
177 <xsl:if test="marc:datafield[@tag=022]">
178 <span class="results_summary"><span class="label">ISSN: </span>
179 <xsl:for-each select="marc:datafield[@tag=022]">
180 <xsl:value-of select="marc:subfield[@code='a']"/>
181 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
186 <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
187 <span class="results_summary"><span class="label">Uniform titles: </span>
188 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
189 <xsl:variable name="str">
190 <xsl:for-each select="marc:subfield">
191 <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'])))">
192 <xsl:value-of select="text()"/>
193 <xsl:text> </xsl:text>
197 <xsl:call-template name="chopPunctuation">
198 <xsl:with-param name="chopString">
199 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
203 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
208 <xsl:if test="marc:datafield[@tag=650]">
209 <span class="results_summary"><span class="label">Related Subjects: </span>
210 <xsl:for-each select="marc:datafield[@tag=650]">
213 <xsl:when test="marc:subfield[@code=9]">
214 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
217 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
220 <xsl:call-template name="chopPunctuation">
221 <xsl:with-param name="chopString">
222 <xsl:call-template name="subfieldSelect">
223 <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
229 <xsl:when test="position()=last()"></xsl:when>
230 <xsl:otherwise> | </xsl:otherwise>
237 <xsl:if test="marc:datafield[@tag=856]">
238 <span class="results_summary"><span class="label">Online Resources: </span>
239 <xsl:for-each select="marc:datafield[@tag=856]">
240 <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
242 <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
243 <xsl:call-template name="subfieldSelect">
244 <xsl:with-param name="codes">y3z</xsl:with-param>
247 <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
248 Click here to access online
253 <xsl:when test="position()=last()"></xsl:when>
254 <xsl:otherwise> | </xsl:otherwise>
260 <xsl:if test="marc:datafield[@tag=505]">
261 <xsl:for-each select="marc:datafield[@tag=505]">
262 <span class="results_summary"><span class="label">
264 <xsl:when test="@ind1=0">
267 <xsl:when test="@ind1=1">
270 <xsl:when test="@ind1=1">
276 <xsl:when test="@ind2=0">
277 <xsl:for-each select="marc:subfield[@code='t']">
278 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
282 <xsl:call-template name="subfieldSelect">
283 <xsl:with-param name="codes">au</xsl:with-param>
292 <xsl:if test="marc:datafield[@tag=780]">
293 <xsl:for-each select="marc:datafield[@tag=780]">
294 <span class="results_summary"><span class="label">
296 <xsl:when test="@ind2=0">
299 <xsl:when test="@ind2=1">
302 <xsl:when test="@ind2=2">
305 <xsl:when test="@ind2=3">
308 <xsl:when test="@ind2=4">
309 Formed by the union: ... and: ...
311 <xsl:when test="@ind2=5">
314 <xsl:when test="@ind2=6">
317 <xsl:when test="@ind2=7">
322 <xsl:variable name="f780">
323 <xsl:call-template name="subfieldSelect">
324 <xsl:with-param name="codes">at</xsl:with-param>
327 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
328 <xsl:value-of select="translate($f780, '()', '')"/>
333 <xsl:when test="@ind1=0">
334 <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
342 <xsl:if test="marc:datafield[@tag=785]">
343 <xsl:for-each select="marc:datafield[@tag=785]">
344 <span class="results_summary"><span class="label">
346 <xsl:when test="@ind2=0">
349 <xsl:when test="@ind2=1">
350 Continued in part by:
352 <xsl:when test="@ind2=2">
355 <xsl:when test="@ind2=3">
356 Superseded in part by:
358 <xsl:when test="@ind2=4">
361 <xsl:when test="@ind2=5">
364 <xsl:when test="@ind2=6">
365 Split into .. and ...:
367 <xsl:when test="@ind2=7">
368 Merged with ... to form ...
370 <xsl:when test="@ind2=8">
376 <xsl:variable name="f785">
377 <xsl:call-template name="subfieldSelect">
378 <xsl:with-param name="codes">at</xsl:with-param>
382 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
383 <xsl:value-of select="translate($f785, '()', '')"/>
392 <xsl:template name="nameABCDQ">
393 <xsl:call-template name="chopPunctuation">
394 <xsl:with-param name="chopString">
395 <xsl:call-template name="subfieldSelect">
396 <xsl:with-param name="codes">aq</xsl:with-param>
399 <xsl:with-param name="punctuation">
400 <xsl:text>:,;/ </xsl:text>
403 <xsl:call-template name="termsOfAddress"/>
406 <xsl:template name="nameABCDN">
407 <xsl:for-each select="marc:subfield[@code='a']">
408 <xsl:call-template name="chopPunctuation">
409 <xsl:with-param name="chopString" select="."/>
412 <xsl:for-each select="marc:subfield[@code='b']">
413 <xsl:value-of select="."/>
415 <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
416 <xsl:call-template name="subfieldSelect">
417 <xsl:with-param name="codes">cdn</xsl:with-param>
422 <xsl:template name="nameACDEQ">
423 <xsl:call-template name="subfieldSelect">
424 <xsl:with-param name="codes">acdeq</xsl:with-param>
427 <xsl:template name="termsOfAddress">
428 <xsl:if test="marc:subfield[@code='b' or @code='c']">
429 <xsl:call-template name="chopPunctuation">
430 <xsl:with-param name="chopString">
431 <xsl:call-template name="subfieldSelect">
432 <xsl:with-param name="codes">bc</xsl:with-param>
439 <xsl:template name="part">
440 <xsl:variable name="partNumber">
441 <xsl:call-template name="specialSubfieldSelect">
442 <xsl:with-param name="axis">n</xsl:with-param>
443 <xsl:with-param name="anyCodes">n</xsl:with-param>
444 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
447 <xsl:variable name="partName">
448 <xsl:call-template name="specialSubfieldSelect">
449 <xsl:with-param name="axis">p</xsl:with-param>
450 <xsl:with-param name="anyCodes">p</xsl:with-param>
451 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
454 <xsl:if test="string-length(normalize-space($partNumber))">
455 <xsl:call-template name="chopPunctuation">
456 <xsl:with-param name="chopString" select="$partNumber"/>
459 <xsl:if test="string-length(normalize-space($partName))">
460 <xsl:call-template name="chopPunctuation">
461 <xsl:with-param name="chopString" select="$partName"/>
466 <xsl:template name="specialSubfieldSelect">
467 <xsl:param name="anyCodes"/>
468 <xsl:param name="axis"/>
469 <xsl:param name="beforeCodes"/>
470 <xsl:param name="afterCodes"/>
471 <xsl:variable name="str">
472 <xsl:for-each select="marc:subfield">
473 <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])">
474 <xsl:value-of select="text()"/>
475 <xsl:text> </xsl:text>
479 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>