Koha/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2ATOM.xsl
Joshua Ferraro 030fbd2e80 Microformat support:
Needed to restore OpenSearch capabilities, and did the following while
I was at it:

  * add support for unAPI: http://unapi.info/
  * add basic support for COinS and OpenURL:
    http://ocoins.info;
    http://www.niso.org/committees/committee_ax.html
  * ^^ Gives us Zotero Support!
  * adding some XSLT stylesheets for handling additional transformations
    NOTE: English and MARC21 specific unfortunately
  * adding back opensearch/rss feed <link>s for autodiscovery

TODO: after the installation, to get the Zebra system running on an external
port it's necessary to hand-edit the configs. I'm looking into Virtual Hosts
which could solve that problem (run on both the socket and a port).

Need to add better error handling to the unapi and opensearch scripts

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-03 18:00:16 -06:00

129 lines
3.8 KiB
XML

<?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>
<name>
<xsl:value-of select="."/>
</name>
</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>
<name>
<xsl:value-of select="."/>
</name>
</author>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=655]">
<category>
<xsl:attribute name="term">
<xsl:value-of select="./marc:subfield[@code='a' or @code='v']"/>
</xsl:attribute>
</category>
</xsl:for-each>
<xsl:for-each select="marc:datafield[@tag=260]">
<rights type="html">
<xsl:text>&#169; </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>