e706763b41e1317db59eef393aebdffe816654e9
[Evergreen.git] / Open-ILS / xsl / MARC21slim2ATOM.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
3         <xsl:import href="MARC21slimUtils.xsl"/>
4         <xsl:output method="xml" indent="yes"/>
5         
6         <!--Added ISBN and deleted attributes 6/04 jer-->
7         
8         <xsl:template match="/">
9                         <xsl:apply-templates/>
10         </xsl:template>
11
12         <xsl:template match="marc:record">
13                 <xsl:variable name="leader" select="marc:leader"/>
14                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
15                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
16                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
17
18           <entry xmlns="http://www.w3.org/2005/Atom">
19
20                         <xsl:for-each select="marc:controlfield[@tag=001]">
21                                 <id>
22                                         <xsl:text>urn:tcn:</xsl:text>
23                                         <xsl:value-of select="."/>
24                                 </id>
25                         </xsl:for-each>
26
27                         <xsl:for-each select="marc:controlfield[@tag=005]">
28                                 <updated>
29                                         <xsl:value-of select="."/>
30                                 </updated>
31                         </xsl:for-each>
32
33
34                         <xsl:for-each select="marc:datafield[@tag=245]">
35                                 <title>
36                                         <xsl:call-template name="subfieldSelect">
37                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>
38                                         </xsl:call-template>
39                                 </title>
40                         </xsl:for-each>
41
42         
43                         <xsl:for-each select="marc:datafield[@tag=100]">
44                                 <author>
45                                         <name>
46                                                 <xsl:value-of select="."/>
47                                         </name>
48                                 </author>
49                         </xsl:for-each>
50
51                         <xsl:for-each select="marc:datafield[@tag=110]|marc:datafield[@tag=111]|marc:datafield[@tag=700]|marc:datafield[@tag=710]|marc:datafield[@tag=711]|marc:datafield[@tag=720]">
52                                 <author>
53                                         <name>
54                                                 <xsl:value-of select="."/>
55                                         </name>
56                                 </author>
57                         </xsl:for-each>
58
59                         <xsl:for-each select="marc:datafield[@tag=655]">
60                                 <category>
61                                         <xsl:attribute name="term">
62                                                 <xsl:value-of select="./marc:subfield[@code='a' or @code='v']"/>
63                                         </xsl:attribute>
64                                 </category>
65                         </xsl:for-each>
66
67                         <xsl:for-each select="marc:datafield[@tag=260]">
68                                 <rights type="html">
69                                         <xsl:text>&#169; </xsl:text>
70                                         <xsl:call-template name="subfieldSelect">
71                                                 <xsl:with-param name="codes">c</xsl:with-param>
72                                         </xsl:call-template>
73                                         <xsl:text>, </xsl:text>
74                                         <xsl:call-template name="subfieldSelect">
75                                                 <xsl:with-param name="codes">b</xsl:with-param>
76                                         </xsl:call-template>
77                                 </rights>
78                         </xsl:for-each>
79
80                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
81                                 <published>
82                                         <xsl:value-of select="."/>
83                                 </published>                            
84                         </xsl:for-each>
85
86                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
87                                 <summary>
88                                         <xsl:value-of select="marc:subfield[@code='a']"/>
89                                 </summary>
90                         </xsl:for-each>
91
92                         <xsl:for-each select="marc:datafield[@tag=600 or @tag=610 or @tag=611 or @tag=630 or @tag=650 or @tag=653]">
93                                 <category>
94                                         <xsl:attribute name="term">
95                                                 <xsl:call-template name="subfieldSelect">
96                                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
97                                                 </xsl:call-template>
98                                         </xsl:attribute>
99                                 </category>
100                         </xsl:for-each>
101
102                         <xsl:for-each select="marc:datafield[@tag=856]">
103                                 <dc:identifier>
104                                         <xsl:value-of select="marc:subfield[@code='u']"/>
105                                 </dc:identifier>
106                         </xsl:for-each>
107                         
108                         <xsl:for-each select="marc:datafield[@tag=020]">
109                                 <dc:identifier>
110                                         <xsl:text>URN:ISBN:</xsl:text>
111                                         <xsl:value-of select="marc:subfield[@code='a']"/>
112                                 </dc:identifier>
113                         </xsl:for-each>
114
115                         <xsl:for-each select="marc:datafield[@tag=506]">
116                                 <rights>
117                                         <xsl:value-of select="marc:subfield[@code='a']"/>
118                                 </rights>
119                         </xsl:for-each>
120
121                         <xsl:for-each select="marc:datafield[@tag=540]">
122                                 <rights>
123                                         <xsl:value-of select="marc:subfield[@code='a']"/>
124                                 </rights>
125                         </xsl:for-each>
126                 </entry>
127         </xsl:template>
128 </xsl:stylesheet>
129