summaryrefslogtreecommitdiff
path: root/endnote-to-dbxml.xsl
diff options
context:
space:
mode:
authorBenjamin Franzke <bfr@qbus.de>2015-02-18 15:48:18 +0100
committerBenjamin Franzke <bfr@qbus.de>2015-02-18 15:54:24 +0100
commitaceed71c01b9a25ee4fc70074d3edbd7c95042ad (patch)
tree04c1409cfc7449a03b37e47559acd5c3baf52c44 /endnote-to-dbxml.xsl
downloadendnote-import-aceed71c01b9a25ee4fc70074d3edbd7c95042ad.tar.gz
endnote-import-aceed71c01b9a25ee4fc70074d3edbd7c95042ad.tar.bz2
endnote-import-aceed71c01b9a25ee4fc70074d3edbd7c95042ad.zip
Implement simple xml import using xsl and load xml
Diffstat (limited to 'endnote-to-dbxml.xsl')
-rw-r--r--endnote-to-dbxml.xsl72
1 files changed, 72 insertions, 0 deletions
diff --git a/endnote-to-dbxml.xsl b/endnote-to-dbxml.xsl
new file mode 100644
index 0000000..24d3be3
--- /dev/null
+++ b/endnote-to-dbxml.xsl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output method="xml" indent="yes" encoding="UTF-8" />
+
+ <xsl:include href="util.xsl"/>
+
+ <xsl:template match="record">
+ <publication>
+ <uid>
+ <xsl:value-of select="rec-number" />
+ </uid>
+ <title>
+ <xsl:apply-templates select="titles/title" mode="copy-html" />
+ </title>
+ <secondary_title>
+ <xsl:apply-templates select="titles/secondary-title" mode="copy-html" />
+ <xsl:text></xsl:text>
+ </secondary_title>
+ <full_title>
+ <xsl:apply-templates select="periodical/full-title" mode="copy-html" />
+ <xsl:text></xsl:text>
+ </full_title>
+ <type>
+ <xsl:value-of select="ref-type/@name" />
+ </type>
+ <year>
+ <xsl:apply-templates select="dates/year" mode="content" />
+ </year>
+
+ <authors>
+ <!--<xsl:apply-templates select="authors" mode="references" />-->
+ <xsl:for-each select="contributors/authors/author">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>|</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="." />
+ </xsl:for-each>
+ </authors>
+ </publication>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <tx_likat_pubs_domain_model_publications>
+ <xsl:apply-templates select="xml/records/record" />
+ </tx_likat_pubs_domain_model_publications>
+ </xsl:template>
+
+ <xsl:template name="string-replace-all">
+ <xsl:param name="text" />
+ <xsl:param name="replace" />
+ <xsl:param name="by" />
+ <xsl:choose>
+ <xsl:when test="$replace = ''">
+ <xsl:value-of select="$text" />
+ </xsl:when>
+ <xsl:when test="contains($text, $replace)">
+ <xsl:value-of select="substring-before($text,$replace)" />
+ <xsl:value-of select="$by" />
+ <xsl:call-template name="string-replace-all">
+ <xsl:with-param name="text" select="substring-after($text,$replace)" />
+ <xsl:with-param name="replace" select="$replace" />
+ <xsl:with-param name="by" select="$by" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>