Fix for Bug 4884, opac-showmarc.pl can't find compact.xsl
[wip/koha-chris_n.git] / koha-tmpl / opac-tmpl / prog / en / xslt / compact.xsl
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2   
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   xmlns="http://www.w3.org/1999/xhtml"
5   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6   xmlns:marc="http://www.loc.gov/MARC21/slim" 
7   exclude-result-prefixes="xsi marc"
8   version="1.0">
9   <xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />    
10       <xsl:template match="/">
11         <html>
12           <head>
13             <title>MARC Card View</title>
14           </head>
15           <body>
16            <xsl:apply-templates/>
17           </body>
18         </html>
19       </xsl:template>
20       
21       <xsl:template match="marc:record">
22         <div class="cardimage">
23         <xsl:apply-templates select="marc:datafield[@tag!='082' and @tag!='092' and @tag!='010']"/>
24         <span class="bottom">
25           <xsl:apply-templates select="marc:controlfield[@tag='001']"/>
26           <xsl:apply-templates select="marc:datafield[@tag='082' or @tag='092' or @tag='010']"/>
27         </span>
28         </div>
29       </xsl:template>
30       
31       <xsl:template match="marc:controlfield">
32           <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
33       </xsl:template>
34       
35       <xsl:template match="marc:datafield">
36         <xsl:if test="starts-with(@tag, '1')">
37           <p class="mainheading"><xsl:value-of select="."/></p>
38         </xsl:if>
39         <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
40           <span class="title"><xsl:value-of select="."/></span>
41         </xsl:if>
42         <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
43           <span class="titlemain"><xsl:value-of select="."/></span><br/>
44         </xsl:if>
45         <xsl:if test="@tag='260'">
46           <xsl:value-of select="."/>
47         </xsl:if>
48         <xsl:if test="@tag='300'">
49           <p class="extent"><xsl:value-of select="."/></p>
50         </xsl:if>
51         <xsl:if test="starts-with(@tag, '5')">
52           <p class="note"><xsl:value-of select="."/></p>
53         </xsl:if>
54         <xsl:if test="@tag='650'">
55           <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
56         </xsl:if>
57         <xsl:if test="@tag='653'">
58           <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
59         </xsl:if>
60         <xsl:if test="@tag='010'">
61           <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
62           <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
63           <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
64           <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
65         </xsl:if>
66         <xsl:if test="@tag='082' or @tag='092'">
67           <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
68         </xsl:if>
69         <xsl:if test="@tag='856'">
70           <br/><xsl:apply-templates mode="link" select="marc:subfield" />
71         </xsl:if>
72       </xsl:template>
73       <xsl:template match="marc:subfield" mode="link">
74         <xsl:if test="@code='u'">
75           <span class="link">
76             <a class="url" href="{.}"/>
77         </span>
78         </xsl:if>
79       </xsl:template>
80       <xsl:template match="marc:subfield">
81         <xsl:if test="@code!='2'">    
82         <xsl:if test="@code!='a'">--</xsl:if>
83         <xsl:value-of select="."/>
84       </xsl:if>
85       </xsl:template>
86     </xsl:stylesheet>