-
Notifications
You must be signed in to change notification settings - Fork 6
/
tei2html_lb.xslt
153 lines (116 loc) · 2.64 KB
/
tei2html_lb.xslt
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<!--1/23/14: added paragraph tag-->
<!--1/23/14: added h1 tag-->
<!--1/26/14: added italics template-->
<!--2/4/14: added "stanza" div-class with line breaks -->
<!--2/4/14: added "figure" element -->
<!--2/14/12: added span-class hb instruction (numbered page breaks)-->
<!--2/17/12: added span-class lb instruction (numbered line breaks)-->
<!--xsltproc -v -nonet try2safety.xsl proc_03.xml >proc_03.html-->
<xsl:template match="/">
<html>
<head>
<title>New Book Digital Texts xsl 2.1.14</title>
</head>
<body><xsl:apply-templates select="//body" /></body>
</html>
</xsl:template>
<xsl:template match="body">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="list">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="item">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>
<xsl:template match="p">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="div1/head">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="div2/head">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="emph">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>
<xsl:template match="lg">
<p class="stanza">
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="l">
<xsl:apply-templates/>
<br />
</xsl:template>
<xsl:template match="figure">
<figure>
<img src="temple.jpg" alt="An Old Temple" width="304" height="288" />
<!--Note:size configured, but not necessary -->
<xsl:apply-templates/>
</figure>
</xsl:template>
<xsl:template match="table">
<table border="1">
<xsl:for-each select="./row">
<tr>
<xsl:for-each select="./cell">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="pb">
<hr />
<span class="pb">
[pg: <xsl:value-of select="@n"/>]
</span>
</xsl:template>
<xsl:template match="lb">
<br />
<span class="lb">
<xsl:value-of select="@n"/>:
</span>
</xsl:template>
<xsl:template match="foreign">
<em>
<xsl:apply-templates/>
</em>
</xsl:template>
<xsl:template match="name">
<xsl:element name="span">
<xsl:attribute name="class">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="note">
<xsl:element name="span">
<xsl:attribute name="class">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>