-
Notifications
You must be signed in to change notification settings - Fork 0
/
book-html.xsl
85 lines (63 loc) · 2.37 KB
/
book-html.xsl
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
<?xml version='1.0'?> <!-- As XML file -->
<!-- Identify as a stylesheet -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Intend output for rendering by a web browser -->
<xsl:output method="html" />
<xsl:template match="/article">
<html>
<head>
<!-- <link rel="stylesheet" type="text/css" href="good-preview.css" /> -->
<xsl:call-template name="mathjax" />
</head>
<body>
\(<xsl:value-of select="macros" />\)
<div class="headerblock">
<div class="title"><xsl:value-of select="title" /></div>
<div class="author"><xsl:value-of select="author" /></div>
<div class="email"><xsl:value-of select="email" /></div>
<div class="department"><xsl:value-of select="department" /></div>
<div class="institution"><xsl:value-of select="institution" /></div>
<div class="date"><xsl:value-of select="date" /></div>
</div>
<xsl:apply-templates select="p|theorem|corollary|lemma" />
</body>
</html>
</xsl:template>
<xsl:template match="theorem">
<xsl:apply-templates select="statement" />
<xsl:apply-templates select="proof" />
</xsl:template>
<xsl:template match="fact">
<xsl:apply-templates select="statement" />
</xsl:template>
<!-- Prepend to first paragraph -->
<xsl:template match="theorem/statement">
<b>Theorem: </b><xsl:apply-templates select="p"/>
</xsl:template>
<!-- Prepend to first paragraph -->
<xsl:template match="fact/statement">
<b>Corollary: </b><xsl:apply-templates select="p"/>
</xsl:template>
<!-- Prepend to first paragraph -->
<xsl:template match="proof">
<b>Proof: </b><xsl:apply-templates select="p"/>
</xsl:template>
<xsl:template match="p">
<p><xsl:apply-templates /></p>
</xsl:template>
<!-- Math -->
<xsl:template match= "m">\(<xsl:value-of select="." />\)</xsl:template>
<xsl:template match="dm">\[<xsl:value-of select="." />\]</xsl:template>
<xsl:template match="am">\begin{align*}<xsl:value-of select="." />\end{align*}</xsl:template>
<xsl:template name="mathjax">
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
TeX: {
extensions: ["AMSmath.js", "AMSsymbols.js"]
},
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full" />
</xsl:template>
</xsl:stylesheet>