summaryrefslogtreecommitdiff
path: root/convert-style-to-html.xsl
blob: ac8b48c1cc45f93f5c34070d5a65c2a2ae71460b (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
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
		xmlns:str="http://exslt.org/strings"
		extension-element-prefixes="str">

	<xsl:output method="xml" indent="yes" encoding="UTF-8"  />

	<!-- Convert endnote style definitions declarations to html tags -->
	<!-- TODO: <author>Editors,</author> bzw <author>Editor,</author> -->
	<xsl:template match="style" name="style">

		<xsl:param name="face" select="@face"/>

		<xsl:choose>
			<xsl:when test="contains($face, 'subscript')">
				<sub>
					<xsl:call-template name="style">
						<xsl:with-param name="face" select="str:replace($face, 'subscript', '')"/>
					</xsl:call-template>
				</sub>
			</xsl:when>
			<xsl:when test="contains($face, 'superscript')">
				<sub>
					<xsl:call-template name="style">
						<xsl:with-param name="face" select="str:replace($face, 'superscript', '')"/>
					</xsl:call-template>
				</sub>
			</xsl:when>
			<xsl:when test="contains($face, 'italic')">
				<em>
					<xsl:call-template name="style">
						<xsl:with-param name="face" select="str:replace($face, 'italic', '')"/>
					</xsl:call-template>
				</em>
			</xsl:when>
			<xsl:when test="contains($face, 'boldface')">
				<strong>
					<xsl:call-template name="style">
						<xsl:with-param name="face" select="str:replace($face, 'bold', '')"/>
					</xsl:call-template>
				</strong>
			</xsl:when>
			<xsl:when test="contains($face, 'normal')">
				<xsl:call-template name="style">
					<xsl:with-param name="face" select="str:replace($face, 'normal', '')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:when test="@font = 'Symbol' and @charset='2'">
				<xsl:choose>
					<xsl:when test="text() = 'a'">α</xsl:when>
					<xsl:when test="text() = 'b'">β</xsl:when>
					<xsl:when test="text() = 'h'">η</xsl:when>
					<xsl:when test="text() = 'm'">μ</xsl:when>
					<xsl:when test="text() = 'n'">ν</xsl:when>
					<xsl:otherwise>
						<xsl:apply-templates />
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates />
			</xsl:otherwise>

		</xsl:choose>
	</xsl:template>

	<!-- Drop style definitions from author-tags -->
	<xsl:template match="author/style">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates />
		</xsl:copy>
	</xsl:template>

	<xsl:template match="/">
		<xsl:apply-templates />
	</xsl:template>

</xsl:stylesheet>