-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.xsl
189 lines (171 loc) · 7.77 KB
/
profile.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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:exsl="http://exslt.org/common"
xmlns:fcs="http://clarin.eu/fcs/1.0" xmlns:sru="http://www.loc.gov/zing/srw/"
xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xsl exsl xd tei fcs sru">
<xsl:import href="fcs/result2view_v1.xsl"/>
<xsl:output method="html" media-type="text/xhtml" indent="yes" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template name="callback-header">
<link href="{$scripts_url}style/sampleText.css" type="text/css" rel="stylesheet"/>
</xsl:template>
<xsl:template name="getTitle">
<xsl:value-of select="concat(//tei:fileDesc//tei:title, ' ')"/>
<span class="tei-authors">
<xsl:apply-templates select="//tei:fileDesc/tei:author" mode="record-data"/>
</span>
</xsl:template>
<xsl:template match="tei:head" mode="tei-body-headings">
<xsl:if test="normalize-space(./text())">
<xsl:call-template name="div-count-to-html-header">
<xsl:with-param name="div-count"><xsl:call-template name="tei-div-count"/></xsl:with-param>
<xsl:with-param name="content" select="normalize-space(./text())"></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates mode="tei-body-headings"/>
</xsl:template>
<xsl:template name="generateImgHTMLTags">
<xsl:param name="altText" select="@target"/>
<xsl:choose>
<xsl:when test="starts-with(@target, 'http://') or starts-with(@target, '/') or starts-with(@target, 'https://')">
<img src="{@target}" alt="{$altText}"/>
</xsl:when>
<xsl:otherwise>
<img src="http://corpus3.aac.ac.at/static/images/vicav/{@target}" alt="{@target}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="tei-body-headings">
<xsl:if test="normalize-space(./text())">
<h2>
<xsl:value-of select="normalize-space(./text())"/>
</h2>
</xsl:if>
<xsl:apply-templates mode="tei-body-headings"/>
</xsl:template>
<xsl:template match="text()" mode="tei-body-headings"/>
<xsl:template match="tei:name[@xml:lang]" mode="tei-body-headings">
<xsl:if test="@xml:lang='eng'">
<xsl:call-template name="div-count-to-html-header">
<xsl:with-param name="div-count"><xsl:call-template name="tei-div-count"/></xsl:with-param>
<xsl:with-param name="content">
<xsl:value-of select="."/>
</xsl:with-param>
</xsl:call-template>
<div class="nyms">
<div class="official nym-wrapper">
<span class="official nym-label">Official name </span>
<xsl:apply-templates select="../tei:name[@xml:lang='ara']" mode="record-data"/>
<xsl:apply-templates select="../tei:name[@xml:lang = 'ara-x-DMG']" mode="record-data"/>
</div>
<xsl:if test="../tei:name[@type='araLoc' or @type='latLoc']">
<div class="local nym-wrapper">
<span class="local nym-label">Local name </span>
<xsl:choose>
<xsl:when test="../tei:name[@type='araLoc']"><xsl:apply-templates select="../tei:name[@type='araLoc']" mode="record-data"/></xsl:when>
<xsl:otherwise><span class="tei-type-araLoc"/></xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="../tei:name[@type='latLoc']"><xsl:apply-templates select="../tei:name[@type='latLoc']" mode="record-data"/></xsl:when>
<xsl:otherwise><span class="tei-type-latLoc"/></xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
</div>
</xsl:if>
</xsl:template>
<xd:doc>
<xd:desc>Delegate to the default ref logic</xd:desc>
</xd:doc>
<xsl:template match="tei:ref" mode="tei-body-headings">
<xsl:apply-templates select="." mode="record-data"/>
</xsl:template>
<xsl:template match="tei:ref[contains(@target, 'author')]" mode="tei-body-headings">
<xsl:call-template name="getAuthor"/>
</xsl:template>
<xsl:template name="getAuthor">
<div class="tei-authors">
<xsl:apply-templates select="//tei:fileDesc/tei:author" mode="record-data"/>
</div>
</xsl:template>
<xd:doc>
<xd:desc>Transforms one fcs:Resource
<xd:p>This supersedes the generic template because we want a fixed order in which
the various data views are transformed (metadata last)</xd:p>
</xd:desc>
</xd:doc>
<xsl:template match="fcs:Resource" mode="record-data">
<xsl:apply-templates select=".//fcs:DataView[not(@type='metadata')]" mode="record-data"/>
<xsl:apply-templates select=".//fcs:DataView[@type='metadata']" mode="record-data"/>
</xsl:template>
<xd:doc>
<xd:desc>Suppress rendering the tei:div of type positioning as it only containse a machine
readable geo tag used by the map function.</xd:desc>
</xd:doc>
<xsl:template match="tei:div[@type='positioning']" mode="record-data">
<xsl:apply-templates select=".//tei:ref" mode="record-data"/>
</xsl:template>
<xsl:template match="tei:name[@xml:lang]" mode="record-data">
<span class="{@xml:lang}">
<xsl:value-of select="concat(., ' ')"/>
</span>
</xsl:template>
<xsl:template match="tei:name[@type]" mode="record-data" priority="2">
<span class="{@xml:lang} tei-type-{@type}">
<xsl:value-of select="concat(., ' ')"/>
</span>
</xsl:template>
<xsl:template match="tei:pc" mode="record-data">
<xsl:value-of select="."/>
<xsl:choose>
<xsl:when test="./text() = ',' or ./text() = '.'">
<xsl:text> </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:strip-space elements="tei:u tei:w tei:pc"/>
<xsl:template match="tei:w" mode="record-data">
<xsl:variable name="classes">
<xsl:choose>
<xsl:when test="@type = preceding-sibling::*[1]/@type">
<xsl:value-of select="concat('tei-w tei-type-', @type, ' lang-fr')"/>
</xsl:when>
<xsl:when test="@type">
<xsl:value-of select="concat('tei-w tei-type-', @type, ' lang-fr xsl-first-of-group')"/>
</xsl:when>
<xsl:when test="preceding-sibling::tei:w[1]/@type">
tei-w lang-aeb xsl-first-of-group
</xsl:when>
<xsl:otherwise>tei-w</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(./@*|./tei:fs)">
<xsl:value-of select="."/>
</xsl:when>
<xsl:when test="./@ana">
<xsl:variable name="linkTarget">
<xsl:call-template name="formURL">
<xsl:with-param name="action">searchRetrieve</xsl:with-param>
<xsl:with-param name="q" select="concat('entry==', substring-after(@ana, '#'))"/>
<xsl:with-param name="x-context" select="'aeb_eng_001__v001'"/>
</xsl:call-template>
</xsl:variable>
<span class="{$classes}"><xsl:apply-templates mode="record-data"/><dl class="tei-fs"><dt class="dict-ref">Dict.</dt><dd><a class="search-caller" href="{$linkTarget}">Go to entry</a></dd></dl></span>
</xsl:when>
<xsl:when test="./@type">
<span class="{$classes}"><xsl:apply-templates mode="record-data"/></span>
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(local-name(following-sibling::*[1]) = 'pc') and
not(local-name(following-sibling::*[1]) = 'w' and substring(following-sibling::*[1]/text(), 1, 1) = '-')">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="tei:kinesic" mode="record-data">
<span class="tei-kinesic"><xsl:value-of select="tei:desc"/></span>
</xsl:template>
</xsl:stylesheet>