Docs: Fix list formatting in recent release notes
[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                         <!-- Spec wants RFC 3339 format - fix it outside of XSL? -->
28                         <xsl:for-each select="marc:controlfield[@tag=005]">
29                                 <updated>
30                                         <xsl:value-of select="."/>
31                                 </updated>
32                         </xsl:for-each>
33
34
35                         <xsl:for-each select="marc:datafield[@tag=245]">
36                                 <title>
37                                         <xsl:call-template name="subfieldSelect">
38                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>
39                                         </xsl:call-template>
40                                 </title>
41                         </xsl:for-each>
42
43         
44                         <xsl:for-each select="marc:datafield[@tag=100]">
45                                 <author>
46                                         <name>
47                                                 <xsl:value-of select="."/>
48                                         </name>
49                                 </author>
50                         </xsl:for-each>
51
52                         <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]">
53                                 <author>
54                                         <name>
55                                                 <xsl:value-of select="."/>
56                                         </name>
57                                 </author>
58                         </xsl:for-each>
59
60                         <xsl:for-each select="marc:datafield[@tag=655]">
61                                 <category>
62                                         <xsl:attribute name="term">
63                                                 <xsl:value-of select="./marc:subfield[@code='a' or @code='v']"/>
64                                         </xsl:attribute>
65                                 </category>
66                         </xsl:for-each>
67
68                         <xsl:for-each select="marc:datafield[@tag=260]">
69                                 <rights type="html">
70                                         <xsl:text>&#169; </xsl:text>
71                                         <xsl:call-template name="subfieldSelect">
72                                                 <xsl:with-param name="codes">c</xsl:with-param>
73                                         </xsl:call-template>
74                                         <xsl:text>, </xsl:text>
75                                         <xsl:call-template name="subfieldSelect">
76                                                 <xsl:with-param name="codes">b</xsl:with-param>
77                                         </xsl:call-template>
78                                 </rights>
79                         </xsl:for-each>
80
81                         <!-- Spec wants RFC 3339 format - fix it outside of XSL? -->
82                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
83                                 <published>
84                                         <xsl:value-of select="."/>
85                                 </published>                            
86                         </xsl:for-each>
87
88                         <!--
89                         Spec wants zero or one summary elements per item; best option
90                         would be to test for one of these elements and only create
91                         if one exists, but for now we simply merge all candidates
92                         -->
93                         <summary>
94                                 <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
95                                                 <xsl:value-of select="marc:subfield[@code='a']"/>
96                                 </xsl:for-each>
97                         </summary>
98
99                         <xsl:for-each select="marc:datafield[@tag=600 or @tag=610 or @tag=611 or @tag=630 or @tag=650 or @tag=653]">
100                                 <category>
101                                         <xsl:attribute name="term">
102                                                 <xsl:call-template name="subfieldSelect">
103                                                         <xsl:with-param name="codes">abcdq</xsl:with-param>
104                                                 </xsl:call-template>
105                                         </xsl:attribute>
106                                 </category>
107                         </xsl:for-each>
108
109                         <xsl:for-each select="marc:datafield[@tag=856]">
110                                 <dc:identifier>
111                                         <xsl:value-of select="marc:subfield[@code='u']"/>
112                                 </dc:identifier>
113                         </xsl:for-each>
114                         
115                         <xsl:for-each select="marc:datafield[@tag=020]">
116                                 <dc:identifier>
117                                         <xsl:text>URN:ISBN:</xsl:text>
118                                         <xsl:value-of select="marc:subfield[@code='a']"/>
119                                 </dc:identifier>
120                         </xsl:for-each>
121
122                         <xsl:for-each select="marc:datafield[@tag=506]">
123                                 <rights>
124                                         <xsl:value-of select="marc:subfield[@code='a']"/>
125                                 </rights>
126                         </xsl:for-each>
127
128                         <xsl:for-each select="marc:datafield[@tag=540]">
129                                 <rights>
130                                         <xsl:value-of select="marc:subfield[@code='a']"/>
131                                 </rights>
132                         </xsl:for-each>
133                 </entry>
134         </xsl:template>
135 </xsl:stylesheet>
136