summaryrefslogtreecommitdiffstats
path: root/xslt/referencer2tellico.xsl
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
commite38d2351b83fa65c66ccde443777647ef5cb6cff (patch)
tree1897fc20e9f73a81c520a5b9f76f8ed042124883 /xslt/referencer2tellico.xsl
downloadtellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz
tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xslt/referencer2tellico.xsl')
-rw-r--r--xslt/referencer2tellico.xsl120
1 files changed, 120 insertions, 0 deletions
diff --git a/xslt/referencer2tellico.xsl b/xslt/referencer2tellico.xsl
new file mode 100644
index 0000000..5bb90be
--- /dev/null
+++ b/xslt/referencer2tellico.xsl
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data Referencer
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:key name="tags" match="/library/taglist/tag" use="uid"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Referencer Import" type="5">
+ <fields>
+ <field name="_default"/>
+ </fields>
+ <xsl:apply-templates select="library/doclist/doc"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="doc">
+ <entry>
+
+ <title>
+ <xsl:value-of select="bib_title"/>
+ </title>
+
+ <entry-type>
+ <xsl:value-of select="translate(bib_type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+ 'abcdefghijklmnopqrstuvwxyz')"/>
+ </entry-type>
+
+ <bibtex-key>
+ <xsl:value-of select="key"/>
+ </bibtex-key>
+
+ <year>
+ <xsl:value-of select="bib_year"/>
+ </year>
+
+ <doi>
+ <xsl:value-of select="bib_doi"/>
+ </doi>
+
+ <pages>
+ <xsl:value-of select="bib_pages"/>
+ </pages>
+
+ <journal>
+ <xsl:value-of select="bib_journal"/>
+ </journal>
+
+ <number>
+ <xsl:value-of select="bib_number"/>
+ </number>
+
+ <volume>
+ <xsl:value-of select="bib_volume"/>
+ </volume>
+
+ <url>
+ <xsl:value-of select="filename"/>
+ </url>
+
+ <authors>
+ <xsl:for-each select="str:tokenize(bib_authors, ',/;')">
+ <xsl:call-template name="author_split">
+ <xsl:with-param name="value" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </authors>
+
+ <keywords>
+ <xsl:for-each select="tagged">
+ <keyword i18n="true">
+ <xsl:value-of select="key('tags', .)/name"/>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+</entry>
+
+</xsl:template>
+
+<xsl:template name="author_split">
+ <xsl:param name="value"/>
+ <xsl:if test="string-length($value) &gt; 0">
+ <xsl:variable name="before" select="substring-before($value, ' and ')"/>
+ <author>
+ <xsl:if test="string-length($before) &gt; 0">
+ <xsl:value-of select="normalize-space($before)"/>
+ </xsl:if>
+ <xsl:if test="string-length($before) = 0">
+ <xsl:value-of select="normalize-space($value)"/>
+ </xsl:if>
+ </author>
+ <xsl:call-template name="author_split">
+ <xsl:with-param name="value" select="substring-after($value, ' and ')"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>