]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xsl/MARC21slim2HTMLCard-holdings.xsl
improving the dumpac
[Evergreen.git] / Open-ILS / xsl / MARC21slim2HTMLCard-holdings.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   xmlns:hold="http://open-ils.org/spec/holdings/v1"
8   version="1.0">
9   <xsl:output method="html" doctype-public="-//W3C/DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" />    
10   <xsl:template match="/">
11      <html>
12        <head>
13          <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
14          <link href="{$base_dir}/htmlcard.css" rel="stylesheet" type="text/css" />
15        </head>
16        <body>
17         <xsl:apply-templates select="//marc:record"/>
18        </body>
19      </html>
20   </xsl:template>
21       
22   <xsl:template match="marc:record">
23     <div class="cardimage">
24      <xsl:apply-templates select="marc:datafield[@tag!='082' and @tag!='092' and @tag!='010']"/>
25      <span class="bottom">
26       <xsl:apply-templates select="marc:controlfield[@tag='001']"/>
27       <xsl:apply-templates select="marc:datafield[@tag='082' or @tag='092' or @tag='010']"/>
28      </span>
29     </div>
30     <br/>
31     <xsl:apply-templates select="hold:volumes"/>
32     <br/>
33   </xsl:template>
34
35   <xsl:template match="hold:volumes">
36     <xsl:if test="count(hold:volume) &gt; 0">
37         <u>Holdings</u>
38     </xsl:if>
39     <ul>
40     <xsl:apply-templates select="hold:volume">
41       <xsl:sort select="@lib"/>
42     </xsl:apply-templates>
43     </ul>
44   </xsl:template>
45
46   <xsl:template match="hold:volume">
47       <li> <b><xsl:value-of select="./@label"/></b>
48         <xsl:apply-templates select="hold:copies"/>
49       </li>
50   </xsl:template>
51
52   <xsl:template match="hold:copies">
53     <ul>
54     <xsl:apply-templates select="hold:copy">
55       <xsl:sort select="hold:location"/>
56     </xsl:apply-templates>
57     </ul>
58   </xsl:template>
59
60   <xsl:template match="hold:copy">
61       <li> <xsl:value-of select="./@barcode"/>
62         <ul>
63           <li>Circulating from <b><xsl:value-of select="hold:circlib"/></b></li>
64           <li>Located at <b><xsl:value-of select="hold:location"/></b></li>
65           <li>Status is <b><xsl:value-of select="hold:status"/></b></li>
66         </ul>
67       </li>
68   </xsl:template>
69
70   <xsl:template match="marc:controlfield">
71       <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
72   </xsl:template>
73       
74   <xsl:template match="marc:datafield">
75     <xsl:if test="starts-with(@tag, '1')">
76       <p class="mainheading"><xsl:value-of select="."/></p>
77     </xsl:if>
78
79     <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
80       <span class="title"><xsl:value-of select="."/></span>
81     </xsl:if>
82
83     <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
84       <span class="titlemain"><xsl:value-of select="."/></span><br/>
85     </xsl:if>
86
87     <xsl:if test="@tag='260'">
88       <xsl:value-of select="."/>
89     </xsl:if>
90
91     <xsl:if test="@tag='300'">
92       <p class="extent"><xsl:value-of select="."/></p>
93      </xsl:if>
94
95     <xsl:if test="starts-with(@tag, '5')">
96       <p class="note"><xsl:value-of select="."/></p>
97     </xsl:if>
98
99     <xsl:if test="@tag='650'">
100       <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
101     </xsl:if>
102
103     <xsl:if test="@tag='653'">
104       <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
105     </xsl:if>
106
107     <xsl:if test="@tag='010'">
108       <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
109       <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
110       <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
111       <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
112     </xsl:if>
113
114     <xsl:if test="@tag='082' or @tag='092'">
115       <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
116     </xsl:if>
117
118     <xsl:if test="@tag='856'">
119      <br/><xsl:apply-templates mode="link" select="marc:subfield" />
120     </xsl:if>
121   </xsl:template>
122
123   <xsl:template match="marc:subfield" mode="link">
124     <xsl:if test="@code='u'">
125       <span class="link">
126         <a class="url" href="{.}">
127                 <xsl:choose>
128                         <xsl:when test="../marc:subfield[@code='y']">
129                                 <xsl:value-of select="../marc:subfield[@code='y']"/>
130                         </xsl:when>
131                         <xsl:when test="../marc:subfield[@code='3']">
132                                 <xsl:value-of select="../marc:subfield[@code='3']"/>
133                         </xsl:when>
134                         <xsl:otherwise>
135                                 <xsl:value-of select="."/>
136                         </xsl:otherwise>
137                 </xsl:choose>
138         </a>
139       </span>
140     </xsl:if>
141   </xsl:template>
142   
143   <xsl:template match="marc:subfield">
144     <xsl:if test="@code!='2'">    
145      <xsl:if test="@code!='a'">--</xsl:if>
146      <xsl:value-of select="."/>
147     </xsl:if>
148   </xsl:template>
149
150 </xsl:stylesheet>