-
Notifications
You must be signed in to change notification settings - Fork 0
/
teiunclear.xsl
108 lines (100 loc) · 4.43 KB
/
teiunclear.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:t="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="t" version="2.0">
<xsl:template match="t:unclear">
<xsl:param name="parm-edition-type" tunnel="yes" required="no"></xsl:param>
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"></xsl:param>
<xsl:param name="text-content">
<xsl:choose>
<xsl:when test="ancestor::t:orig[not(ancestor::t:choice)]">
<xsl:value-of select="translate(., $all-grc, $grc-upper-strip)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:choose>
<xsl:when test="starts-with($parm-leiden-style, 'edh')">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="$parm-edition-type = 'diplomatic'">
<!-- Calculates the number of middots to output -->
<xsl:variable name="un-len-all">
<!-- collects all children text together -->
<xsl:variable name="un-len-text">
<xsl:for-each select="text()">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<!-- Outputs one character per child <g> -->
<xsl:variable name="un-len-g">
<xsl:for-each select="t:g">
<xsl:text>a</xsl:text>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="string-length($un-len-text) + string-length($un-len-g)"/>
</xsl:variable>
<xsl:for-each select="1 to $un-len-all">
<xsl:choose>
<xsl:when test="$parm-leiden-style='london'">
<xsl:text>·</xsl:text>
</xsl:when>
<xsl:when test="$parm-leiden-style=('ddbdp','dclp','sammelbuch')">
<xsl:text>  ̣</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>.</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!--<xsl:call-template name="middot">
<xsl:with-param name="unc-len" select="$un-len-all"/>
</xsl:call-template>-->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="t:g">
<xsl:apply-templates/>
<!-- templates (including tests for parent::unclear) are in teig.xsl -->
</xsl:when>
<xsl:otherwise>
<xsl:variable name="text" select="normalize-space($text-content)"/>
<xsl:for-each select="1 to string-length()">
<xsl:value-of select="concat(substring($text,.,1),'̣')"/>
</xsl:for-each>
<!--<xsl:call-template name="subpunct">
<xsl:with-param name="unc-len" select="string-length($text-content)"/>
<xsl:with-param name="abs-len" select="string-length($text-content)+1"/>
<xsl:with-param name="text-content" select="$text-content"/>
</xsl:call-template>-->
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--<xsl:template name="middot">
<xsl:param name="unc-len"/>
<xsl:if test="not($unc-len = 0)">
<xsl:text>·</xsl:text>
<xsl:call-template name="middot">
<xsl:with-param name="unc-len" select="$unc-len - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>-->
<!--<xsl:template name="subpunct">
<xsl:param name="abs-len"/>
<xsl:param name="unc-len"/>
<xsl:param name="text-content"/>
<xsl:if test="$unc-len!=0">
<xsl:value-of select="substring($text-content, number($abs-len - $unc-len),1)"/>
<xsl:text>̣</xsl:text>
<xsl:call-template name="subpunct">
<xsl:with-param name="unc-len" select="$unc-len - 1"/>
<xsl:with-param name="abs-len" select="string-length($text-content)+1"/>
<xsl:with-param name="text-content" select="$text-content"/>
</xsl:call-template>
</xsl:if>
</xsl:template>-->
</xsl:stylesheet>