]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xsl/MARC21slim2HTMLCard.xsl
adding holdings data to marcxml/htmlcard output
[working/Evergreen.git] / Open-ILS / xsl / MARC21slim2HTMLCard.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     <u>Holdings</u>
32     <xsl:apply-templates select="hold:volumes"/>
33     <br/>
34   </xsl:template>
35
36   <xsl:template match="hold:volumes">
37     <ul>
38     <xsl:apply-templates select="hold:volume">
39       <xsl:sort select="@lib"/>
40     </xsl:apply-templates>
41     </ul>
42   </xsl:template>
43
44   <xsl:template match="hold:volume">
45       <li> <b><xsl:value-of select="./@label"/></b>
46         <xsl:apply-templates select="hold:copies"/>
47       </li>
48   </xsl:template>
49
50   <xsl:template match="hold:copies">
51     <ul>
52     <xsl:apply-templates select="hold:copy">
53       <xsl:sort select="hold:location"/>
54     </xsl:apply-templates>
55     </ul>
56   </xsl:template>
57
58   <xsl:template match="hold:copy">
59       <li> <xsl:value-of select="./@barcode"/>
60         <ul>
61           <li>Circulating from <b><xsl:value-of select="hold:circlib"/></b></li>
62           <li>Located at <b><xsl:value-of select="hold:location"/></b></li>
63           <li>Status is <b><xsl:value-of select="hold:status"/></b></li>
64         </ul>
65       </li>
66   </xsl:template>
67
68   <xsl:template match="marc:controlfield">
69       <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
70   </xsl:template>
71       
72   <xsl:template match="marc:datafield">
73     <xsl:if test="starts-with(@tag, '1')">
74       <p class="mainheading"><xsl:value-of select="."/></p>
75     </xsl:if>
76
77     <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
78       <span class="title"><xsl:value-of select="."/></span>
79     </xsl:if>
80
81     <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
82       <span class="titlemain"><xsl:value-of select="."/></span><br/>
83     </xsl:if>
84
85     <xsl:if test="@tag='260'">
86       <xsl:value-of select="."/>
87     </xsl:if>
88
89     <xsl:if test="@tag='300'">
90       <p class="extent"><xsl:value-of select="."/></p>
91      </xsl:if>
92
93     <xsl:if test="starts-with(@tag, '5')">
94       <p class="note"><xsl:value-of select="."/></p>
95     </xsl:if>
96
97     <xsl:if test="@tag='650'">
98       <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
99     </xsl:if>
100
101     <xsl:if test="@tag='653'">
102       <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
103     </xsl:if>
104
105     <xsl:if test="@tag='010'">
106       <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
107       <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
108       <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
109       <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
110     </xsl:if>
111
112     <xsl:if test="@tag='082' or @tag='092'">
113       <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
114     </xsl:if>
115
116     <xsl:if test="@tag='856'">
117      <br/><xsl:apply-templates mode="link" select="marc:subfield" />
118     </xsl:if>
119   </xsl:template>
120
121   <xsl:template match="marc:subfield" mode="link">
122     <xsl:if test="@code='u'">
123       <span class="link">
124         <a class="url" href="{.}"><xsl:value-of select="../marc:subfield[@code='y']"/></a>
125       </span>
126     </xsl:if>
127   </xsl:template>
128   
129   <xsl:template match="marc:subfield">
130     <xsl:if test="@code!='2'">    
131      <xsl:if test="@code!='a'">--</xsl:if>
132      <xsl:value-of select="."/>
133     </xsl:if>
134   </xsl:template>
135
136 </xsl:stylesheet>