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