summaryrefslogtreecommitdiff
path: root/endnote-to-dbxml.xsl
blob: 24d3be3564a24e51aced4a73057e54cf258f5408 (plain)
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
<?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>