adding support for atom entries -- opensearch 1.1 here we come!
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 5 Mar 2006 05:46:07 +0000 (05:46 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 5 Mar 2006 05:46:07 +0000 (05:46 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3259 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xsl/MARC21slim2ATOM.xsl [new file with mode: 0644]

diff --git a/Open-ILS/xsl/MARC21slim2ATOM.xsl b/Open-ILS/xsl/MARC21slim2ATOM.xsl
new file mode 100644 (file)
index 0000000..88bd082
--- /dev/null
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+       <xsl:import href="MARC21slimUtils.xsl"/>
+       <xsl:output method="xml" indent="yes"/>
+       
+       <!--Added ISBN and deleted attributes 6/04 jer-->
+       
+       <xsl:template match="/">
+                       <xsl:apply-templates/>
+       </xsl:template>
+
+       <xsl:template match="marc:record">
+               <xsl:variable name="leader" select="marc:leader"/>
+               <xsl:variable name="leader6" select="substring($leader,7,1)"/>
+               <xsl:variable name="leader7" select="substring($leader,8,1)"/>
+               <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
+
+         <entry xmlns="http://www.w3.org/2005/Atom">
+
+                       <xsl:for-each select="marc:controlfield[@tag=001]">
+                               <id>
+                                       <xsl:text>urn:tcn:</xsl:text>
+                                       <xsl:value-of select="."/>
+                               </id>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:controlfield[@tag=005]">
+                               <updated>
+                                       <xsl:value-of select="."/>
+                               </updated>
+                       </xsl:for-each>
+
+
+                       <xsl:for-each select="marc:datafield[@tag=245]">
+                               <title>
+                                       <xsl:call-template name="subfieldSelect">
+                                               <xsl:with-param name="codes">abfghk</xsl:with-param>
+                                       </xsl:call-template>
+                               </title>
+                       </xsl:for-each>
+
+       
+                       <xsl:for-each select="marc:datafield[@tag=100]">
+                               <author>
+                                       <xsl:value-of select="."/>
+                               </author>
+                       </xsl:for-each>
+
+                       <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]">
+                               <author>
+                                       <xsl:value-of select="."/>
+                               </author>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=655]">
+                               <category>
+                                       <xsl:attribute name="term">
+                                               <xsl:value-of select="."/>
+                                       </xsl:attribute>
+                               </category>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=260]">
+                               <rights type="html">
+                                       <xsl:text>&amp;copy; </xsl:text>
+                                       <xsl:call-template name="subfieldSelect">
+                                               <xsl:with-param name="codes">c</xsl:with-param>
+                                       </xsl:call-template>
+                                       <xsl:text>, </xsl:text>
+                                       <xsl:call-template name="subfieldSelect">
+                                               <xsl:with-param name="codes">b</xsl:with-param>
+                                       </xsl:call-template>
+                               </rights>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
+                               <published>
+                                       <xsl:value-of select="."/>
+                               </published>                            
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
+                               <summary>
+                                       <xsl:value-of select="marc:subfield[@code='a']"/>
+                               </summary>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=600 or @tag=610 or @tag=611 or @tag=630 or @tag=650 or @tag=653]">
+                               <category>
+                                       <xsl:attribute name="term">
+                                               <xsl:call-template name="subfieldSelect">
+                                                       <xsl:with-param name="codes">abcdq</xsl:with-param>
+                                               </xsl:call-template>
+                                       </xsl:attribute>
+                               </category>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=856]">
+                               <dc:identifier>
+                                       <xsl:value-of select="marc:subfield[@code='u']"/>
+                               </dc:identifier>
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="marc:datafield[@tag=020]">
+                               <dc:identifier>
+                                       <xsl:text>URN:ISBN:</xsl:text>
+                                       <xsl:value-of select="marc:subfield[@code='a']"/>
+                               </dc:identifier>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=506]">
+                               <rights>
+                                       <xsl:value-of select="marc:subfield[@code='a']"/>
+                               </rights>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="marc:datafield[@tag=540]">
+                               <rights>
+                                       <xsl:value-of select="marc:subfield[@code='a']"/>
+                               </rights>
+                       </xsl:for-each>
+               </entry>
+       </xsl:template>
+</xsl:stylesheet>
+