/usr/share/kbibtex/worldcatdc2bibtex.xsl is in kbibtex-data 0.8~20170819git31a77b27e8e83836e-3build2.
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 | <xsl:transform version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns="http://www.loc.gov/zing/srw/" xmlns:oclcterms="http://purl.org/oclc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/" -->
<!--
- This Extensible Stylesheet Language Transformation file translates XML files
- as provided by xxxxxxx
- into BibTeX files.
-
- This file was written by Thomas Fischer <fischer@unix-ag.uni-kl.de>
- It is released under the GNU Public License version 2 or later.
-
- To run test this transformation file, run e.g.
- wget 'http://www.worldcat.org/webservices/catalog/search/worldcat/sru?wskey=YOURKEY&maximumRecords=10&query=srw.au+all+"smith"&recordSchema=info%3Asrw%2Fschema%2F1%2Fdc' -O - | sed -e 's/searchRetrieveResponse xmlns="http:\/\/www.loc.gov\/zing\/srw\/"/searchRetrieveResponse/' | xsltproc wordcatdc2bibtex.xsl -
-
-->
<xsl:output method="text" omit-xml-declaration="yes" indent="no" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<!-- START HERE -->
<xsl:template match="/">
<!-- process each entry -->
<xsl:apply-templates select="searchRetrieveResponse/records/record/recordData/oclcdcs" />
</xsl:template>
<xsl:template match="oclcdcs">
<xsl:choose>
<!-- at least identifier looks like a ISBN-13 number -->
<xsl:when test="dc:identifier[starts-with(., '978')]">
<!-- ISBN means book -->
<xsl:text>@book{</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- fallback: some other/unknown type of publication -->
<xsl:text>@misc{</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- identifier -->
<!-- use (number) OCLC identifier for entry id -->
<xsl:text>OCLC_</xsl:text><xsl:value-of select="oclcterms:recordIdentifier[not(@xsi:type)]" />
<!-- <xsl:text>OCLC_</xsl:text><xsl:value-of select="oclcterms:recordIdentifier" />-->
<!-- title -->
<xsl:if test="dc:title">
<xsl:text>,
title = {{</xsl:text>
<xsl:value-of select="dc:title" />
<xsl:text>}}</xsl:text>
</xsl:if>
<!-- author (a.k.a. creator) -->
<xsl:if test="dc:creator">
<xsl:text>,
author = {</xsl:text>
<xsl:for-each select="dc:creator">
<xsl:apply-templates select="."/>
<!-- separate multiple authors/creators by " and " -->
<xsl:if test="position()!=last()"><xsl:text> and </xsl:text></xsl:if>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:if>
<!-- ISBN -->
<!-- if generic "identifier" tag's content starts with "978", assume ISBN -->
<!-- TODO filter for duplicates, remove text and comments -->
<xsl:for-each select="dc:identifier[starts-with(., '978')]">
<xsl:text>,
isbn = {</xsl:text>
<xsl:value-of select="." />
<xsl:text>}</xsl:text>
</xsl:for-each>
<!-- URL -->
<!-- if generic "identifier" tag's content starts with "http", assume URL -->
<xsl:if test="dc:identifier[starts-with(., 'http')]">
<xsl:text>,
url = {</xsl:text>
<xsl:for-each select="dc:identifier[starts-with(., 'http')]">
<xsl:apply-templates select="."/>
<!-- separate URLs by "; " -->
<xsl:if test="position()!=last()"><xsl:text>; </xsl:text></xsl:if>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:if>
<!-- publisher -->
<xsl:if test="dc:publisher">
<xsl:text>,
publisher = {</xsl:text>
<xsl:value-of select="dc:publisher" />
<xsl:text>}</xsl:text>
</xsl:if>
<!-- year -->
<xsl:if test="dc:date">
<xsl:text>,
year = {</xsl:text>
<!-- TODO remove text and comments -->
<xsl:value-of select="dc:date" />
<xsl:text>}</xsl:text>
</xsl:if>
<!-- keywords -->
<!-- TODO difference keyword <-> subject? -->
<xsl:if test="dc:subject">
<xsl:text>,
keywords = {</xsl:text>
<xsl:for-each select="dc:subject">
<xsl:apply-templates select="."/>
<!-- separate keywords by "; " -->
<!-- TODO some additional filtering? -->
<xsl:if test="position()!=last()"><xsl:text>; </xsl:text></xsl:if>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:text>
}
</xsl:text>
</xsl:template>
</xsl:transform>
|