-
Notifications
You must be signed in to change notification settings - Fork 0
/
lines.xsl
125 lines (100 loc) · 4.38 KB
/
lines.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
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
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY lsquo '‘' >
<!ENTITY rsquo '’' >
<!ENTITY ldquo '“' >
<!ENTITY rdquo '”' >
<!ENTITY nbsp ' ' >
<!ENTITY ndash '–' >
<!ENTITY times '×' >
<!ENTITY zwj '⁠' >
]>
<!-- Copyright 2020-2021 Antenna House, Inc. -->
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- For processing TEI-encoded 'Moby-Dick' first edition from
http://purl.dlib.indiana.edu/iudl/wright/VAC7237
-->
<xsl:stylesheet
xpath-default-namespace="http://www.tei-c.org/ns/1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:m="http://www.mentea.net/"
xmlns:ahf="http://www.antennahouse.com/names/XSLT/Functions/Document"
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="ahf m tei xs xhtml"
version="3.0">
<!-- ============================================================= -->
<!-- IMPORTS -->
<!-- ============================================================= -->
<xsl:import href="river.xsl"/>
<!-- ============================================================= -->
<!-- STYLESHEET PARAMETERS -->
<!-- ============================================================= -->
<!-- ============================================================= -->
<!-- ATTRIBUTE SETS -->
<!-- ============================================================= -->
<!-- ============================================================= -->
<!-- TEMPLATES -->
<!-- ============================================================= -->
<!-- Page numbers are from the First Edition. -->
<xsl:template
match="p[preceding-sibling::*[1][self::head][@type = 'sub']]">
<xsl:param name="atts" select="()" as="attribute()*" />
<xsl:next-match>
<xsl:with-param name="atts" as="attribute()*">
<xsl:attribute name="orphans"
select="$analyze-lines-after" />
<xsl:sequence select="$atts" />
</xsl:with-param>
</xsl:next-match>
</xsl:template>
<xsl:template match="div[@type = 'chapter']/p[last()]">
<xsl:param name="atts" select="()" as="attribute()*" />
<xsl:next-match>
<xsl:with-param name="atts" as="attribute()*">
<xsl:attribute name="widows"
select="$analyze-lines-before" />
<xsl:sequence select="$atts" />
</xsl:with-param>
</xsl:next-match>
</xsl:template>
<!-- 'To accomplish his object...' (pg. 235) -->
<!-- River caused by setting 'orphans' and 'widows'. -->
<xsl:template match="/TEI/text[1]/body[1]/div[1]/div[46]/p[2]">
<xsl:param name="atts" select="()" as="attribute()*" />
<xsl:next-match>
<xsl:with-param name="atts" as="attribute()*">
<xsl:attribute name="letter-spacing.minimum" select="'-0.005em'" />
<xsl:attribute name="word-spacing.minimum" select="'-0.005em'" />
<xsl:sequence select="$atts" />
</xsl:with-param>
</xsl:next-match>
</xsl:template>
<!-- 'Walking the deck with...' (pg. 259) -->
<!-- For lines before Chapter LII (pg. 262) -->
<xsl:template match="/TEI/text[1]/body[1]/div[1]/div[51]/p[3]">
<xsl:param name="atts" select="()" as="attribute()*" />
<fo:block text-align-last="justify" xsl:use-attribute-sets="p">
<xsl:copy-of select="$atts" />
<xsl:variable name="text" select="ahf:text(text())" />
<xsl:value-of select="substring-before($text, 'so many sails,')" />
<xsl:text>so many sails,</xsl:text>
<fo:block text-indent="0" text-align-last="left">
<xsl:value-of select="substring-after($text, 'so many sails,')" />
</fo:block>
</fo:block>
</xsl:template>
</xsl:stylesheet>