1 | <?xml version="1.0"?> |
---|
2 | <xsl:stylesheet xmlns="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" |
---|
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
4 | xmlns:xs="http://www.w3.org/2001/XMLSchema" |
---|
5 | exclude-result-prefixes="xs" |
---|
6 | xmlns:de="http://www.mpiwg-berlin.mpg.de/ns/de/1.0/" |
---|
7 | xmlns:dcterms="http://purl.org/dc/terms" |
---|
8 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
---|
9 | xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" |
---|
10 | xmlns:xhtml="http://www.w3.org/1999/xhtml" |
---|
11 | xmlns:mml="http://www.w3.org/1998/Math/MathML" |
---|
12 | xmlns:xlink="http://www.w3.org/1999/xlink" |
---|
13 | xmlns:xml="http://www.w3.org/XML/1998/namespace" |
---|
14 | version="2.0"> |
---|
15 | <!-- was noch zu machen ist |
---|
16 | - Zeilenumbrüche fehlen!!! Das ist auch nicht zu schaffen. |
---|
17 | - figures in p haben nur anchor |
---|
18 | - s und div später durch Workflowskripte |
---|
19 | --> |
---|
20 | <!-- <xsl:output method="xml" indent="yes" encoding="UTF-8"/> --> |
---|
21 | <xsl:output method="xml" encoding="UTF-8"/> |
---|
22 | <!-- output the whole document with doing nearly nothing --> |
---|
23 | <xsl:template match="@*|node()"> |
---|
24 | <xsl:copy> |
---|
25 | <xsl:apply-templates select="@*|node()"/> |
---|
26 | </xsl:copy> |
---|
27 | </xsl:template> |
---|
28 | |
---|
29 | <!-- figure not in p --> |
---|
30 | <xsl:template match="*:text/*:figure"> |
---|
31 | <xsl:variable name="filename" select="."/> |
---|
32 | <xsl:value-of select="'
'"/> |
---|
33 | <xsl:element name="figure"> |
---|
34 | <xsl:value-of select="'
'"/> |
---|
35 | <xsl:element name="image"> |
---|
36 | <xsl:attribute name="file"> |
---|
37 | <xsl:value-of select="$filename"/> |
---|
38 | </xsl:attribute> |
---|
39 | <xsl:attribute name="xlink:href"> |
---|
40 | <xsl:text>http://echo.mpiwg-berlin.mpg.de/zogilib?fn=/permanent/library/QFWN4Q67/figures/</xsl:text> |
---|
41 | <xsl:value-of select="$filename"/> |
---|
42 | </xsl:attribute> |
---|
43 | </xsl:element> |
---|
44 | <xsl:value-of select="'
'"/> |
---|
45 | </xsl:element> |
---|
46 | <xsl:value-of select="'
'"/> |
---|
47 | </xsl:template> |
---|
48 | <!-- figure in p --> |
---|
49 | <!-- <anchor type="figure" |
---|
50 | xlink:label="fig-0397-01a" xlink:href="fig-0397-01"/> --> |
---|
51 | <xsl:template match="*:p/*:figure"> |
---|
52 | <xsl:variable name="filename" select="."/> |
---|
53 | <xsl:element name="anchor"> |
---|
54 | <xsl:attribute name="type">figure</xsl:attribute> |
---|
55 | <xsl:attribute name="xlink:label"> |
---|
56 | <xsl:value-of select="$filename"/> |
---|
57 | <xsl:text>a</xsl:text> |
---|
58 | </xsl:attribute> |
---|
59 | <xsl:attribute name="xlink:href"> |
---|
60 | <xsl:value-of select="$filename"/> |
---|
61 | </xsl:attribute> |
---|
62 | </xsl:element> |
---|
63 | </xsl:template> |
---|
64 | |
---|
65 | <!-- math --> |
---|
66 | <xsl:template match="*:math"> |
---|
67 | <xsl:choose> |
---|
68 | <xsl:when test="*:content/*:power"> |
---|
69 | <xsl:element name="mml:math"> |
---|
70 | <xsl:element name="mml:msup"> |
---|
71 | <xsl:element name="mml:mi"> |
---|
72 | <!-- select only the text of this node without its children --> |
---|
73 | <xsl:value-of select="*:content/text()"/> |
---|
74 | </xsl:element> |
---|
75 | <xsl:element name="mml:mn"> |
---|
76 | <xsl:apply-templates select="*:content/*:power/node()"/> |
---|
77 | </xsl:element> |
---|
78 | </xsl:element> |
---|
79 | </xsl:element> |
---|
80 | <!-- <xsl:comment>power</xsl:comment> --> |
---|
81 | </xsl:when> |
---|
82 | <xsl:otherwise> |
---|
83 | <xsl:element name="mml:math"> |
---|
84 | <xsl:element name="mml:mi"> |
---|
85 | <xsl:apply-templates select="*:content/node()"/> |
---|
86 | </xsl:element> |
---|
87 | </xsl:element> |
---|
88 | <!-- <xsl:comment>einfaches mathml </xsl:comment> --> |
---|
89 | </xsl:otherwise> |
---|
90 | </xsl:choose> |
---|
91 | </xsl:template> |
---|
92 | |
---|
93 | |
---|
94 | <!-- cong, dag, nl and lacs --> |
---|
95 | <xsl:template match="*:cong"> |
---|
96 | <xsl:comment>begin cong</xsl:comment> |
---|
97 | <xsl:apply-templates select="node()"/> |
---|
98 | <xsl:comment>end cong</xsl:comment> |
---|
99 | </xsl:template> |
---|
100 | <xsl:template match="*:dag"> |
---|
101 | <xsl:comment>begin dag</xsl:comment> |
---|
102 | <xsl:apply-templates select="node()"/> |
---|
103 | <xsl:comment>end dag</xsl:comment> |
---|
104 | </xsl:template> |
---|
105 | <xsl:template match="*:lacs"> |
---|
106 | <xsl:comment>milestone lacs</xsl:comment> |
---|
107 | </xsl:template> |
---|
108 | <xsl:template match="*:nl"> |
---|
109 | <xsl:comment>milestone nl</xsl:comment> |
---|
110 | </xsl:template> |
---|
111 | |
---|
112 | <!-- table --> |
---|
113 | <xsl:template match="*:tabula"> |
---|
114 | <xsl:element name="xhtml:table"> |
---|
115 | <xsl:apply-templates select="node()"/> |
---|
116 | </xsl:element> |
---|
117 | </xsl:template> |
---|
118 | <xsl:template match="*:tr"> |
---|
119 | <xsl:element name="xhtml:tr"> |
---|
120 | <xsl:apply-templates select="node()"/> |
---|
121 | </xsl:element> |
---|
122 | </xsl:template> |
---|
123 | <xsl:template match="*:td"> |
---|
124 | <xsl:element name="xhtml:td"> |
---|
125 | <xsl:apply-templates select="node()"/> |
---|
126 | </xsl:element> |
---|
127 | </xsl:template> |
---|
128 | |
---|
129 | <!-- italics --> |
---|
130 | <xsl:template match="*:italics"> |
---|
131 | <xsl:element name="emph"> |
---|
132 | <xsl:attribute name="style">it</xsl:attribute> |
---|
133 | <xsl:apply-templates select="node()"/> |
---|
134 | </xsl:element> |
---|
135 | </xsl:template> |
---|
136 | |
---|
137 | <!-- underline --> |
---|
138 | <xsl:template match="*:underline"> |
---|
139 | <xsl:element name="emph"> |
---|
140 | <xsl:attribute name="style">ul</xsl:attribute> |
---|
141 | <xsl:apply-templates select="node()"/> |
---|
142 | </xsl:element> |
---|
143 | </xsl:template> |
---|
144 | |
---|
145 | <!-- enunciatio --> |
---|
146 | <xsl:template match="*:enunciatio"> |
---|
147 | <xsl:element name="head"> |
---|
148 | <xsl:attribute name="xml:space">preserve</xsl:attribute> |
---|
149 | <xsl:apply-templates select="*:content/node()"/> |
---|
150 | </xsl:element> |
---|
151 | </xsl:template> |
---|
152 | |
---|
153 | <!-- capitolo --> |
---|
154 | <xsl:template match="*:capitolo"> |
---|
155 | <xsl:element name="head"> |
---|
156 | <xsl:attribute name="xml:space">preserve</xsl:attribute> |
---|
157 | <xsl:apply-templates select="node()"/> |
---|
158 | </xsl:element> |
---|
159 | </xsl:template> |
---|
160 | |
---|
161 | <!-- citmarg - convert them to marginal notes in the left margin |
---|
162 | (most of them are in the left margin) and let the move floats |
---|
163 | script do the rest--> |
---|
164 | <xsl:template match="*:citmarg"> |
---|
165 | <xsl:value-of select="'
'"/> |
---|
166 | <xsl:element name="mgl"> |
---|
167 | <xsl:value-of select="'
'"/> |
---|
168 | <!-- <xsl:value-of select="."/> --> |
---|
169 | <xsl:apply-templates select="node()"/> |
---|
170 | <xsl:value-of select="'
'"/> |
---|
171 | </xsl:element> |
---|
172 | <xsl:value-of select="'
'"/> |
---|
173 | </xsl:template> |
---|
174 | |
---|
175 | <xsl:template match="*:citmargsign"> |
---|
176 | <xsl:value-of select="'
'"/> |
---|
177 | <xsl:element name="mgl"> |
---|
178 | <xsl:value-of select="'
'"/> |
---|
179 | <!-- <xsl:value-of select="."/> --> |
---|
180 | <xsl:apply-templates select="node()"/> |
---|
181 | <xsl:comment>citmargsign</xsl:comment> |
---|
182 | <xsl:value-of select="'
'"/> |
---|
183 | </xsl:element> |
---|
184 | <xsl:value-of select="'
'"/> |
---|
185 | </xsl:template> |
---|
186 | |
---|
187 | |
---|
188 | <!-- variant --> |
---|
189 | <xsl:template match="*:variant"> |
---|
190 | <xsl:choose> |
---|
191 | <xsl:when |
---|
192 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='SupraLineam'"> |
---|
193 | <xsl:element name="emph"> |
---|
194 | <xsl:attribute name="style">super</xsl:attribute> |
---|
195 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> <xsl:comment>variant supralineam</xsl:comment> |
---|
196 | </xsl:element> |
---|
197 | </xsl:when> |
---|
198 | <!-- using bold face for postcorrectionem --> |
---|
199 | <xsl:when |
---|
200 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='PostCorrectionem'"> |
---|
201 | <xsl:element name="emph"> |
---|
202 | <xsl:attribute name="style">bf</xsl:attribute> |
---|
203 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
204 | <xsl:comment>variant postcorrectionem</xsl:comment> |
---|
205 | </xsl:element> |
---|
206 | </xsl:when> |
---|
207 | <!-- delevit --> |
---|
208 | <xsl:when |
---|
209 | test="*:variantitem/*:description/*:descriptionitem[3]/*:ontologyreference/@id='Delevit'"> |
---|
210 | <!-- second decision, post or ante --> |
---|
211 | <xsl:choose> |
---|
212 | <!-- ante --> |
---|
213 | <xsl:when test="*:variantitem/*:description/*:descriptionitem[1]/*:ontologyreference/node()='ante'"> |
---|
214 | <xsl:comment>begin variant delevit ante</xsl:comment> |
---|
215 | <xsl:element name="emph"> |
---|
216 | <xsl:attribute name="style">st</xsl:attribute> |
---|
217 | <xsl:apply-templates select="*:variantitem/*:description/*:descriptionitem[3]/*:ontologyreference/node()"/> |
---|
218 | </xsl:element> |
---|
219 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
220 | <xsl:comment>end variant delevit ante</xsl:comment> |
---|
221 | </xsl:when> |
---|
222 | <!-- post --> |
---|
223 | <xsl:when test="*:variantitem/*:description/*:descriptionitem[1]/*:ontologyreference/node()='post'"> |
---|
224 | <xsl:comment>begin variant delevit post</xsl:comment> |
---|
225 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
226 | <xsl:element name="emph"> |
---|
227 | <xsl:attribute name="style">st</xsl:attribute> |
---|
228 | <xsl:apply-templates select="*:variantitem/*:description/*:descriptionitem[3]/*:ontologyreference/node()"/> |
---|
229 | <xsl:comment>end variant delevit post</xsl:comment> |
---|
230 | </xsl:element> |
---|
231 | </xsl:when> |
---|
232 | </xsl:choose> |
---|
233 | </xsl:when> |
---|
234 | <!-- Notlösung hier, die meisten sind "diverso atramento". |
---|
235 | Erstmal auf italics gesetzt. --> |
---|
236 | <xsl:when |
---|
237 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='Descriptio'"> |
---|
238 | <xsl:element name="emph"> |
---|
239 | <xsl:attribute name="style">it</xsl:attribute> |
---|
240 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
241 | <xsl:comment>variant descriptio: <xsl:value-of select="*:variantitem/*:description/*:descriptionitem/*:ontologyreference"/> </xsl:comment> |
---|
242 | </xsl:element> |
---|
243 | </xsl:when> |
---|
244 | <xsl:when |
---|
245 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='SignoPositoInMargine'"> |
---|
246 | <xsl:value-of select="'
'"/> |
---|
247 | <xsl:element name="mgl"> |
---|
248 | <xsl:value-of select="'
'"/> |
---|
249 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
250 | <xsl:comment>variant signopositoinmargine</xsl:comment> |
---|
251 | <xsl:value-of select="'
'"/> |
---|
252 | </xsl:element> |
---|
253 | <xsl:value-of select="'
'"/> |
---|
254 | </xsl:when> |
---|
255 | <xsl:when |
---|
256 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='EDdiverso atramento'"> |
---|
257 | <xsl:element name="emph"> |
---|
258 | <xsl:attribute name="style">it</xsl:attribute> |
---|
259 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
260 | <xsl:comment>variant EDdiverso atramento</xsl:comment> |
---|
261 | </xsl:element> |
---|
262 | </xsl:when> |
---|
263 | <xsl:when |
---|
264 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='InMargine'"> |
---|
265 | <xsl:value-of select="'
'"/> |
---|
266 | <xsl:element name="mgl"> |
---|
267 | <xsl:value-of select="'
'"/> |
---|
268 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
269 | <xsl:comment>variant inmargine</xsl:comment> |
---|
270 | <xsl:value-of select="'
'"/> |
---|
271 | </xsl:element> |
---|
272 | <xsl:value-of select="'
'"/> |
---|
273 | </xsl:when> |
---|
274 | <xsl:when |
---|
275 | test="*:variantitem/*:description/*:bis"> |
---|
276 | <xsl:element name="sic"> |
---|
277 | <xsl:attribute name="comment">bis</xsl:attribute> |
---|
278 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
279 | <xsl:comment>variant bis</xsl:comment> |
---|
280 | </xsl:element> |
---|
281 | </xsl:when> |
---|
282 | <xsl:when |
---|
283 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='EDspatium rel.'"> |
---|
284 | <xsl:value-of select="'
'"/> |
---|
285 | <xsl:element name="mgl"> |
---|
286 | <xsl:value-of select="'
'"/> |
---|
287 | <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> |
---|
288 | <xsl:comment>variant edspatium rel</xsl:comment> |
---|
289 | <xsl:value-of select="'
'"/> |
---|
290 | </xsl:element> |
---|
291 | <xsl:value-of select="'
'"/> |
---|
292 | </xsl:when> |
---|
293 | <xsl:when |
---|
294 | test="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id='CorrexitEx'"> |
---|
295 | <xsl:element name="reg"> |
---|
296 | <!-- OBS reg darf keine Tags drin haben! --> |
---|
297 | <xsl:attribute name="norm"> |
---|
298 | <xsl:apply-templates select="*:variantitem/*:description/*:descriptionitem/*:reading/*:content/node()"/> |
---|
299 | </xsl:attribute> |
---|
300 | <!-- type: a whole bunch of reg types: "lig" "abbr" "simple" "context" "wordlist" "wordlist/context" "unresolved" "punctuation" "typo" "conjecture" "arguable" "unknown" --> |
---|
301 | <xsl:attribute name="type">context</xsl:attribute> |
---|
302 | <!-- no tags in reg --> |
---|
303 | <xsl:value-of select="*:variantitem/*:reading/*:content/node()"/> |
---|
304 | <!-- <xsl:apply-templates select="*:variantitem/*:reading/*:content/node()"/> --> |
---|
305 | <xsl:comment>variant correxitex <!-- <xsl:value-of select="count(*:variantitem)"/> --> </xsl:comment> |
---|
306 | </xsl:element> |
---|
307 | </xsl:when> |
---|
308 | <xsl:when test="count(*:variantitem)=2"> |
---|
309 | <xsl:element name="reg"> |
---|
310 | <xsl:attribute name="norm"> |
---|
311 | <xsl:apply-templates select="*:variantitem[1]/*:reading/*:content/node()"/> |
---|
312 | </xsl:attribute> |
---|
313 | <xsl:attribute name="type">context</xsl:attribute> |
---|
314 | <!-- no tags in reg --> |
---|
315 | <xsl:value-of select="*:variantitem[2]/*:reading/*:content/node()"/> |
---|
316 | <!-- <xsl:apply-templates select="*:variantitem[2]/*:reading/*:content/node()"/> --> |
---|
317 | <xsl:comment>variant 2 variants</xsl:comment> |
---|
318 | </xsl:element> |
---|
319 | </xsl:when> |
---|
320 | <xsl:otherwise> |
---|
321 | <xsl:comment> |
---|
322 | <xsl:text>unresolved variant </xsl:text> |
---|
323 | <xsl:value-of select="*:variantitem/*:description/*:descriptionitem/*:ontologyreference/@id"/> |
---|
324 | </xsl:comment> |
---|
325 | </xsl:otherwise> |
---|
326 | </xsl:choose> |
---|
327 | </xsl:template> |
---|
328 | </xsl:stylesheet> |
---|