/usr/share/tellico/srw2tellico.xsl is in tellico-data 3.1.2-0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tc="http://periapsis.org/tellico/"
xmlns:srw="http://www.loc.gov/zing/srw/"
xmlns:prism="http://prismstandard.org/namespaces/basic/2.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:telterms="http://krait.kb.nl/coop/tel/handbook/telterms.html"
exclude-result-prefixes="srw prism dc"
version="1.0">
<!--
===================================================================
Tellico XSLT file - used for importing PRISM/DC data.
Copyright (C) 2004-2009 Robby Stephenson <robby@periapsis.org>
This XSLT stylesheet is designed to be used with the 'Tellico'
application, which can be found at http://tellico-project.org
===================================================================
-->
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
doctype-public="-//Robby Stephenson/DTD Tellico V11.0//EN"
doctype-system="http://periapsis.org/tellico/dtd/v11/tellico.dtd"/>
<xsl:template match="/">
<tc:tellico syntaxVersion="11">
<tc:collection title="Import" type="5">
<tc:fields>
<tc:field name="_default"/>
<xsl:if test=".//prism:issn">
<tc:field flags="0" title="ISSN#" category="Publishing" format="4" type="1" name="issn" description="ISSN#" />
</xsl:if>
</tc:fields>
<xsl:for-each select=".//srw:record">
<xsl:apply-templates select="."/>
</xsl:for-each>
</tc:collection>
</tc:tellico>
</xsl:template>
<xsl:template match="srw:record">
<tc:entry>
<tc:entry-type>
<xsl:choose>
<xsl:when test=".//prism:issn">
<xsl:text>article</xsl:text>
</xsl:when>
<xsl:when test=".//ISBN|.//prism:isbn">
<xsl:text>book</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>article</xsl:text>
</xsl:otherwise>
</xsl:choose>
</tc:entry-type>
<tc:authors>
<xsl:for-each select=".//dc:creator">
<tc:author>
<xsl:value-of select="."/>
</tc:author>
</xsl:for-each>
</tc:authors>
<tc:publishers>
<xsl:for-each select=".//dc:publisher">
<tc:publisher>
<xsl:value-of select="."/>
</tc:publisher>
</xsl:for-each>
</tc:publishers>
<tc:genres i18n="true">
<xsl:for-each select=".//prism:genre">
<tc:genre>
<xsl:value-of select="."/>
</tc:genre>
</xsl:for-each>
</tc:genres>
<tc:keywords i18n="true">
<xsl:for-each select=".//dc:subject|.//prism:keyword">
<tc:keyword>
<xsl:value-of select="."/>
</tc:keyword>
</xsl:for-each>
</tc:keywords>
<xsl:apply-templates/>
</tc:entry>
</xsl:template>
<!-- disable default behavior -->
<xsl:template match="text()|@*"></xsl:template>
<xsl:template match="dc:title">
<tc:title>
<xsl:value-of select="."/>
</tc:title>
</xsl:template>
<xsl:template match="dc:description">
<tc:note>
<xsl:value-of select="."/>
</tc:note>
</xsl:template>
<xsl:template match="prism:publicationName">
<tc:journal>
<xsl:value-of select="."/>
</tc:journal>
</xsl:template>
<xsl:template match="dc:date|prism:publicationDate">
<tc:year>
<xsl:call-template name="year">
<xsl:with-param name="value" select="."/>
</xsl:call-template>
</tc:year>
</xsl:template>
<xsl:template match="prism:edition">
<tc:edition>
<xsl:value-of select="."/>
</tc:edition>
</xsl:template>
<!-- ISBN is a prticular element of KB with x-fields=ISBN
See https://www.librarything.com/topic/136014# -->
<xsl:template match="prism:isbn|ISBN">
<tc:isbn>
<xsl:value-of select="."/>
</tc:isbn>
</xsl:template>
<xsl:template match="prism:issn">
<tc:issn>
<xsl:value-of select="."/>
</tc:issn>
</xsl:template>
<xsl:template match="prism:doi">
<tc:doi>
<xsl:value-of select="."/>
</tc:doi>
</xsl:template>
<xsl:template match="prism:volume">
<tc:volume>
<xsl:value-of select="."/>
</tc:volume>
</xsl:template>
<xsl:template match="prism:number">
<tc:number>
<xsl:value-of select="."/>
</tc:number>
</xsl:template>
<xsl:template match="prism:url|telterms:recordIdentifier">
<tc:url>
<xsl:value-of select="."/>
</tc:url>
</xsl:template>
<xsl:template name="year">
<xsl:param name="value"/>
<xsl:variable name="digits">
<xsl:value-of select="translate($value, translate($value, '0123456789', ''), '')"/>
</xsl:variable>
<xsl:variable name="len">
<xsl:value-of select="string-length($digits)"/>
</xsl:variable>
<xsl:choose>
<!-- return first four digits in value -->
<xsl:when test="starts-with($digits, '19') or starts-with($digits, '20')">
<xsl:value-of select="substring($digits, 1, 4)"/>
</xsl:when>
<!-- KB returns dc:date as 'Fri Jan 01 01:00:00 CET 1971' for example -->
<xsl:when test="$len > 5 and (substring($digits, $len - 3, 2) = '19' or substring($digits, $len - 3, 2) = '20')">
<xsl:value-of select="substring($digits, $len - 3, 4)"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|