88bd082ab67e46857c7a4cbb20bbe9a1f5559c3b
[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                                         <xsl:value-of select="."/>
46                                 </author>
47                         </xsl:for-each>
48
49                         <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]">
50                                 <author>
51                                         <xsl:value-of select="."/>
52                                 </author>
53                         </xsl:for-each>
54
55                         <xsl:for-each select="marc:datafield[@tag=655]">
56                                 <category>
57                                         <xsl:attribute name="term">
58                                                 <xsl:value-of select="."/>
59                                         </xsl:attribute>
60                                 </category>
61                         </xsl:for-each>
62
63                         <xsl:for-each select="marc:datafield[@tag=260]">
64                                 <rights type="html">
65                                         <xsl:text>&amp;copy; </xsl:text>
66                                         <xsl:call-template name="subfieldSelect">
67                                                 <xsl:with-param name="codes">c</xsl:with-param>
68                                         </xsl:call-template>
69                                         <xsl:text>, </xsl:text>
70                                         <xsl:call-template name="subfieldSelect">
71                                                 <xsl:with-param name="codes">b</xsl:with-param>
72                                         </xsl:call-template>
73                                 </rights>
74                         </xsl:for-each>
75
76                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
77                                 <published>
78                                         <xsl:value-of select="."/>
79                                 </published>                            
80                         </xsl:for-each>
81
82                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
83                                 <summary>
84                                         <xsl:value-of select="marc:subfield[@code='a']"/>
85                                 </summary>
86                         </xsl:for-each>
87
88                         <xsl:for-each select="marc:datafield[@tag=600 or @tag=610 or @tag=611 or @tag=630 or @tag=650 or @tag=653]">
89                                 <category>
90                                         <xsl:attribute name="term">
91                                                 <xsl:call-template name="subfieldSelect">
92                                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
93                                                 </xsl:call-template>
94                                         </xsl:attribute>
95                                 </category>
96                         </xsl:for-each>
97
98                         <xsl:for-each select="marc:datafield[@tag=856]">
99                                 <dc:identifier>
100                                         <xsl:value-of select="marc:subfield[@code='u']"/>
101                                 </dc:identifier>
102                         </xsl:for-each>
103                         
104                         <xsl:for-each select="marc:datafield[@tag=020]">
105                                 <dc:identifier>
106                                         <xsl:text>URN:ISBN:</xsl:text>
107                                         <xsl:value-of select="marc:subfield[@code='a']"/>
108                                 </dc:identifier>
109                         </xsl:for-each>
110
111                         <xsl:for-each select="marc:datafield[@tag=506]">
112                                 <rights>
113                                         <xsl:value-of select="marc:subfield[@code='a']"/>
114                                 </rights>
115                         </xsl:for-each>
116
117                         <xsl:for-each select="marc:datafield[@tag=540]">
118                                 <rights>
119                                         <xsl:value-of select="marc:subfield[@code='a']"/>
120                                 </rights>
121                         </xsl:for-each>
122                 </entry>
123         </xsl:template>
124 </xsl:stylesheet>
125