blob: 37248eeb7e448d09d0b5c0b852db47125efb7b38 [file] [log] [blame]
Akron9a8ee3e2022-01-31 13:51:49 +01001<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
bansp5e2d1c02022-03-10 04:51:40 +01003 xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:nkjp="http://www.nkjp.pl/ns/1.0"
4 xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:f="func"
Piotr Banskif8af3a92022-05-23 03:20:10 +02005 xmlns:fn="http://www.w3.org/2005/xpath-functions"
Piotr Banski763b41f2022-06-02 01:13:23 +02006 xmlns:xi="http://www.w3.org/2001/XInclude"
7 xmlns:map="http://www.w3.org/2005/xpath-functions/map" exclude-result-prefixes="xs f fn map nkjp tei xi"
bansp5e2d1c02022-03-10 04:51:40 +01008 version="3.0" expand-text="yes">
Akron9a8ee3e2022-01-31 13:51:49 +01009
banspe726b4a2022-03-28 05:47:45 +020010
11<!-- PARAMETERS -->
bansp5e2d1c02022-03-10 04:51:40 +010012
bansp8f6700b2022-03-27 05:27:09 +020013 <xsl:param name="sourceDir" select="'test/resources/nkjp2korap_sample2'" as="xs:string"/>
banspd1bf1db2022-04-04 02:16:24 +020014 <!-- the directory containing NKJP files, in the form of a collection of text-level dirs
15 (that is how we know both the $corpusID and the $docID) -->
Akron9a8ee3e2022-01-31 13:51:49 +010016
bansp8f6700b2022-03-27 05:27:09 +020017 <xsl:param name="targetDir" select="'test/output'" as="xs:string"/>
banspd1bf1db2022-04-04 02:16:24 +020018 <!-- where the corpus/document/text/annotations hierarchy is going to be created -->
banspf2b24e62022-03-28 18:12:08 +020019
20 <xsl:param name="skip_docID" as="xs:string">
Piotr Banskic5950ce2022-05-27 15:07:08 +020021 <!--<xsl:value-of select="''"/>-->
22 <xsl:value-of select="'HellerPodgladanie,IsakowiczZaleskiMoje,KolakowskiOco,MysliwskiKamien,WilkWilczy,ZycieWarszawy_Zycie'"/>
banspb5992532022-03-29 15:55:44 +020023 </xsl:param>
24 <!-- comma-separated list of document IDs to be skipped from processing
banspf2b24e62022-03-28 18:12:08 +020025 example: HellerPodgladanie,KOT
banspd1bf1db2022-04-04 02:16:24 +020026 no functionality beyond string identity is supported
27 (this is just for testing) -->
banspb5992532022-03-29 15:55:44 +020028
Piotr Banski1ae16bd2022-05-25 15:59:40 +020029 <xsl:param name="SHOW_ORTH_IN_STRUCT" as="xs:boolean" select="true()"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020030 <!-- for debugging structure.xml production -->
31
bansp8f6700b2022-03-27 05:27:09 +020032
bansp9dc10002022-05-17 22:33:34 +020033<!-- VARIABLES (= constants...) -->
banspe726b4a2022-03-28 05:47:45 +020034
35 <xsl:variable name="corpusID" as="xs:string" select="'NKJP'" static="yes"/>
36 <xsl:variable name="docID" as="xs:string" select="'NKJP'" static="yes"/>
bansp8f6700b2022-03-27 05:27:09 +020037
38 <xsl:variable name="targetCorpusDir_slashed" select="$targetDir || '/' || $corpusID || '/'" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +010039
banspd1bf1db2022-04-04 02:16:24 +020040 <xsl:variable name="systemDoctypeI5" as="xs:string"
41 select="'http://corpora.ids-mannheim.de/I5/DTD/i5.dtd'" static="true"/>
bansp5e2d1c02022-03-10 04:51:40 +010042
banspd1bf1db2022-04-04 02:16:24 +020043 <xsl:variable name="publicDoctypeI5" as="xs:string" static="true"
44 select="'-//IDS//DTD I5 1.0//EN'"/>
bansp5e2d1c02022-03-10 04:51:40 +010045
banspd1bf1db2022-04-04 02:16:24 +020046 <xsl:variable name="KorAP_namespace" static="true" as="xs:string"
47 select="'http://ids-mannheim.de/ns/KorAP'"/>
bansp5e2d1c02022-03-10 04:51:40 +010048
bansp5f841732022-03-16 06:27:31 +010049 <xsl:variable name="KorAP-XML_version" select="'KorAP-0.4'" as="xs:string" static="true"/>
50 <!-- this is only a bit funny -->
51
banspe726b4a2022-03-28 05:47:45 +020052 <xsl:variable name="collection_params" as="xs:string" static="yes"
53 select="'recurse=yes;validation=strip;select=text.xml;content-type=application/xml;on-error=warning;xinclude=yes'"
54 />
55 <!-- see https://www.saxonica.com/documentation11/index.html#!sourcedocs/collections/collection-directories -->
56
57 <xsl:variable name="collection_of_text" select="collection($sourceDir || '?' || $collection_params)" as="document-node()+"/>
banspd1bf1db2022-04-04 02:16:24 +020058
banspe726b4a2022-03-28 05:47:45 +020059<!-- MODES -->
bansp5e2d1c02022-03-10 04:51:40 +010060
Piotr Banskifaa910f2022-06-03 00:46:29 +020061 <xsl:mode name="corpus-header" on-no-match="deep-skip"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +020062 <xsl:mode name="text-header" on-no-match="deep-skip"/>
63 <xsl:mode name="text_inside_header" on-no-match="text-only-copy"/>
Piotr Banski763b41f2022-06-02 01:13:23 +020064 <xsl:mode name="copy" on-no-match="shallow-copy"/>
Piotr Banski6a4a2522022-05-24 01:16:47 +020065 <xsl:mode use-accumulators="#all"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020066
Piotr Banskie1ac5202022-05-30 21:25:21 +020067 <xsl:accumulator name="element-index" as="xs:integer" initial-value="0">
68 <xsl:accumulator-rule match="tei:*[ancestor-or-self::tei:text]" select="$value + 1" phase="start"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020069 </xsl:accumulator>
Piotr Banskifdc858a2022-05-25 02:40:32 +020070
Piotr Banski65a6d0b2022-05-31 17:23:08 +020071
72
73 <!--I think I may be able to actually merge the two accumulators, but let's see-->
74 <xsl:accumulator name="morpho-offsets" as="map(xs:string, item()+)+" initial-value="(map{'null':(0,0)})">
Piotr Banskifdc858a2022-05-25 02:40:32 +020075
76 <xsl:accumulator-rule match="tei:body/tei:p" phase="start">
77 <xsl:variable name="preceding_index" as="xs:integer">
78 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
79 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banski6a4a2522022-05-24 01:16:47 +020080 </xsl:variable>
81
Piotr Banskifdc858a2022-05-25 02:40:32 +020082 <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + 1"/>
83 <!-- for paragraphs, it's in either being initial or not -->
Piotr Banski09096ee2022-05-25 13:41:03 +020084
Piotr Banskifdc858a2022-05-25 02:40:32 +020085 <xsl:sequence select="
86 $value,
87 map {
88 string(@xml:id): ($preceding_index,$our_base)
89 }"/>
90 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +020091 <!-- this is morpho-offsets -->
Piotr Banskifdc858a2022-05-25 02:40:32 +020092 <xsl:accumulator-rule match="tei:s" phase="start">
93 <xsl:variable name="preceding_index" as="xs:integer">
94 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
95 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +020096 </xsl:variable>
Piotr Banski92791a22022-05-26 01:41:10 +020097 <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + xs:integer(f:is_preceded_by_ws(.,true()))"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020098
Piotr Banskifdc858a2022-05-25 02:40:32 +020099 <xsl:sequence select="
100 $value,
101 map {
102 string(@xml:id): ($preceding_index,$our_base)
103 }"/>
104 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200105 <!-- this is morpho-offsets -->
106
107<!-- I want something that won't be matched in other layers, for efficiency - that
108 may allow me to merge the accumulators, eventually;
109 but I also want to filter out the rejected tokenization alternatives already here -->
110 <xsl:accumulator-rule match="tei:seg[tei:fs[@type eq 'morph' and tei:f[@name eq 'disamb']]]" phase="end">
111
Piotr Banskifdc858a2022-05-25 02:40:32 +0200112 <xsl:variable name="preceding_index" as="xs:integer">
113 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
114 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200115 </xsl:variable>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200116 <xsl:variable name="our_base" as="xs:integer" select="$preceding_index + xs:integer(f:is_preceded_by_ws(.,true()))"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200117
Piotr Banski6a4a2522022-05-24 01:16:47 +0200118 <xsl:sequence select="
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200119 $value,
120 map {
121 string(@xml:id): ($our_base,$our_base + string-length(tei:fs/tei:f[@name eq 'orth']/tei:string))
122 }"/>
123
Piotr Banski6a4a2522022-05-24 01:16:47 +0200124 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200125 <!-- this is morpho-offsets -->
Piotr Banskifdc858a2022-05-25 02:40:32 +0200126 <xsl:accumulator-rule match="tei:s" phase="end">
127 <xsl:variable name="preceding_index" as="xs:integer">
128 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
129 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200130
Piotr Banskifdc858a2022-05-25 02:40:32 +0200131 </xsl:variable>
132 <xsl:variable name="our_base" as="xs:integer">
133 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
134 <xsl:sequence select="$incomplete[2]"/>
135 </xsl:variable>
Piotr Banski09096ee2022-05-25 13:41:03 +0200136
Piotr Banskifdc858a2022-05-25 02:40:32 +0200137 <xsl:sequence select="
138 $value,
139 map {
140 string(@xml:id): ($our_base,$preceding_index)
141 }"/>
142 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200143 <!-- this is morpho-offsets -->
Piotr Banskifdc858a2022-05-25 02:40:32 +0200144 <xsl:accumulator-rule match="tei:body/tei:p" phase="end">
145 <xsl:variable name="preceding_index" as="xs:integer">
146 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
147 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
148
Piotr Banskifdc858a2022-05-25 02:40:32 +0200149 </xsl:variable>
150 <xsl:variable name="our_base" as="xs:integer">
151 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
152 <xsl:sequence select="$incomplete[2]"/>
153 </xsl:variable>
Piotr Banski09096ee2022-05-25 13:41:03 +0200154
Piotr Banskifdc858a2022-05-25 02:40:32 +0200155 <xsl:sequence select="
156 $value,
157 map {
158 string(@xml:id): ($our_base,$preceding_index)
159 }"/>
160 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200161 </xsl:accumulator>
162
163
164
165 <xsl:accumulator name="segmentation-offsets" as="map(xs:string, item()+)+" initial-value="(map{'null':(0,0)})">
166
167 <xsl:accumulator-rule match="tei:body/tei:p" phase="start">
168 <xsl:variable name="preceding_index" as="xs:integer">
169 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
170 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
171 </xsl:variable>
172
173 <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + 1"/>
174 <!-- for paragraphs, it's in either being initial or not -->
175
176 <xsl:sequence select="
177 $value,
178 map {
179 string(@xml:id): ($preceding_index,$our_base)
180 }"/>
181 </xsl:accumulator-rule>
182
183 <xsl:accumulator-rule match="tei:s" phase="start">
184 <xsl:variable name="preceding_index" as="xs:integer">
185 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
186 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
187 </xsl:variable>
188 <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + xs:integer(f:is_preceded_by_ws(.,true()))"/>
189
190 <xsl:sequence select="
191 $value,
192 map {
193 string(@xml:id): ($preceding_index,$our_base)
194 }"/>
195 </xsl:accumulator-rule>
196
197 <xsl:accumulator-rule match="tei:w[parent::tei:seg[count(@nkjp:rejected) eq 0]]" phase="end">
198 <xsl:variable name="preceding_index" as="xs:integer">
199 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
200 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
201 </xsl:variable>
202 <xsl:variable name="our_base" as="xs:integer" select="$preceding_index + xs:integer(f:is_preceded_by_ws(parent::tei:seg,true()))"/>
203
204 <xsl:sequence select="
205 $value,
206 map {
207 string(parent::tei:seg/@xml:id): ($our_base,$our_base + string-length())
208 }"/>
209 </xsl:accumulator-rule>
210
211 <xsl:accumulator-rule match="tei:s" phase="end">
212 <xsl:variable name="preceding_index" as="xs:integer">
213 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
214 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
215
216 </xsl:variable>
217 <xsl:variable name="our_base" as="xs:integer">
218 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
219 <xsl:sequence select="$incomplete[2]"/>
220 </xsl:variable>
221
222 <xsl:sequence select="
223 $value,
224 map {
225 string(@xml:id): ($our_base,$preceding_index)
226 }"/>
227 </xsl:accumulator-rule>
228
229 <xsl:accumulator-rule match="tei:body/tei:p" phase="end">
230 <xsl:variable name="preceding_index" as="xs:integer">
231 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
232 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
233
234 </xsl:variable>
235 <xsl:variable name="our_base" as="xs:integer">
236 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
237 <xsl:sequence select="$incomplete[2]"/>
238 </xsl:variable>
239
240 <xsl:sequence select="
241 $value,
242 map {
243 string(@xml:id): ($our_base,$preceding_index)
244 }"/>
245 </xsl:accumulator-rule>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200246
247 <xsl:accumulator-rule match="tei:body" phase="end">
248 <xsl:variable name="preceding_index" as="xs:integer">
249 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
250 <xsl:sequence select="map:get($the_tail, map:keys($the_tail)[1])[2]"/>
251 </xsl:variable>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200252
Piotr Banskifdc858a2022-05-25 02:40:32 +0200253 <xsl:sequence select="
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200254 $value,
255 map {
256 string(@xml:id): (0, $preceding_index)
257 }"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200258 </xsl:accumulator-rule>
259
260 <xsl:accumulator-rule match="tei:text" phase="end">
261 <xsl:variable name="preceding_index" as="xs:integer">
262 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
263 <xsl:sequence select="map:get($the_tail, map:keys($the_tail)[1])[2]"/>
264 </xsl:variable>
265
266 <xsl:sequence select="
267 $value,
268 map {
269 string(@xml:id): (0, $preceding_index)
270 }"/>
271 </xsl:accumulator-rule>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200272 </xsl:accumulator>
bansp5e2d1c02022-03-10 04:51:40 +0100273
banspe726b4a2022-03-28 05:47:45 +0200274 <!-- FUNCTIONS -->
275
bansp5f841732022-03-16 06:27:31 +0100276 <xsl:function name="f:compute_nesting" as="xs:integer">
banspd1bf1db2022-04-04 02:16:24 +0200277 <xsl:param name="node" as="element()"/>
bansp5f841732022-03-16 06:27:31 +0100278 <xsl:variable name="rel_depth"
279 select="count($node/ancestor-or-self::*[local-name(.) ne 'TEI'][local-name(.) ne 'teiCorpus'])"
280 as="xs:integer"/>
bansp5f841732022-03-16 06:27:31 +0100281 <xsl:sequence select="$rel_depth"/>
282 </xsl:function>
283
Piotr Banski92791a22022-05-26 01:41:10 +0200284 <xsl:function name="f:is_preceded_by_ws" as="xs:boolean">
bansp9dc10002022-05-17 22:33:34 +0200285 <xsl:param name="node" as="element()"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200286 <xsl:param name="suppress_initial" as="xs:boolean"/>
Piotr Banski4f4c2d22022-05-19 01:44:32 +0200287
Piotr Banski92791a22022-05-26 01:41:10 +0200288 <xsl:choose>
289 <xsl:when test="local-name($node) eq 'seg'">
290 <xsl:choose>
291 <xsl:when test="$node/@nkjp:nps">
292 <xsl:sequence select="fn:false()"/>
293 </xsl:when>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200294 <xsl:when test="$node/tei:fs/tei:f[@name eq 'nps']">
295 <!--added for traversing ann_morphosyntax-->
296 <xsl:sequence select="fn:false()"/>
297 </xsl:when>
Piotr Banski92791a22022-05-26 01:41:10 +0200298 <xsl:when
299 test="$node/ancestor::tei:s[count(preceding-sibling::tei:s) eq 0] and $node/ancestor::tei:p[count(preceding-sibling::tei:p) eq 0] and not($node/preceding::tei:seg[count(@nkjp:rejected) eq 0])">
300 <xsl:sequence select="fn:false()"/>
301 <!-- the otherwise very costly check for preceding segs fires only if the first two are true, so it will have minimal search space -->
302 </xsl:when>
303 <xsl:when
304 test="$suppress_initial and $node/ancestor::tei:s/descendant::tei:seg[count(@nkjp:rejected) eq 0][1]/@xml:id eq $node/@xml:id">
305 <!-- I forget how node identity works now, so let me just compare the IDs -->
306 <xsl:sequence select="fn:false()"/>
307 </xsl:when>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200308 <xsl:when
309 test="$suppress_initial and $node/ancestor::tei:s/descendant::tei:seg[tei:fs/tei:f[@name eq 'disamb']][1]/@xml:id eq $node/@xml:id">
310 <!--added for traversing ann_morphosyntax-->
311 <xsl:sequence select="fn:false()"/>
312 </xsl:when>
Piotr Banski92791a22022-05-26 01:41:10 +0200313 <xsl:otherwise>
314 <xsl:sequence select="fn:true()"/>
315 </xsl:otherwise>
316 </xsl:choose>
317 </xsl:when>
318 <xsl:when test="local-name($node) eq 's'">
319 <xsl:choose>
320 <xsl:when test="exists($node/preceding-sibling::tei:s)">
321 <xsl:sequence select="fn:true()"/>
322 </xsl:when>
323 <xsl:otherwise>
324 <xsl:sequence
325 select="not($suppress_initial) and exists($node/ancestor::tei:p[1]/preceding-sibling::tei:p)"
326 />
327 </xsl:otherwise>
328 </xsl:choose>
329
330 </xsl:when>
331 <xsl:when test="local-name($node) eq 'p'">
332 <xsl:sequence select="exists($node/preceding-sibling::tei:p)"/>
333 </xsl:when>
334 <xsl:otherwise>
335 <xsl:message terminate="yes"
336 select="'Wrong argument passed to f:is_preceded_by_ws(): ' || local-name($node) || ' Only p, s, seg are allowed.'"
337 />
338 </xsl:otherwise>
339 </xsl:choose>
340 </xsl:function>
banspd1bf1db2022-04-04 02:16:24 +0200341
banspb5992532022-03-29 15:55:44 +0200342<!-- UTILITY TEMPLATES -->
343
bansp9103aab2022-03-19 05:10:21 +0100344 <xsl:template match="@default" mode="#all"/>
bansp97ba7ce2022-03-26 05:14:06 +0100345 <!-- this is to delete some auto-inserted attribute throughout -->
bansp9103aab2022-03-19 05:10:21 +0100346
Piotr Banski6a4a2522022-05-24 01:16:47 +0200347 <xsl:template match="tei:w" mode="#all"/>
banspe726b4a2022-03-28 05:47:45 +0200348<!-- NKJP-SGJP has apparently resigned from standoff representations by adding <w> everywhere;
Piotr Banskifdc858a2022-05-25 02:40:32 +0200349 we reach for them, but from the level of <seg>, so we don't need to process <w> separately -->
bansp8f6700b2022-03-27 05:27:09 +0200350
Piotr Banski09096ee2022-05-25 13:41:03 +0200351 <!-- fall-thru, skipping the potential <paren> element and filtering out the bad guys -->
Piotr Banski6a4a2522022-05-24 01:16:47 +0200352 <xsl:template match="tei:choice" mode="struct">
Piotr Banski09096ee2022-05-25 13:41:03 +0200353 <xsl:apply-templates select="descendant::tei:seg[count(@nkjp:rejected) eq 0]" mode="struct"/>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200354 </xsl:template>
Piotr Banskia51907c2022-05-25 15:09:41 +0200355 <xsl:template match="tei:choice" mode="morpho">
356 <xsl:apply-templates select="descendant::tei:seg[count(@nkjp:rejected) eq 0]" mode="morpho"/>
357 </xsl:template>
banspb5992532022-03-29 15:55:44 +0200358
359 <!-- MAIN PROCESSING -->
360
bansp5e2d1c02022-03-10 04:51:40 +0100361 <xsl:template name="xsl:initial-template">
banspf2b24e62022-03-28 18:12:08 +0200362 <xsl:variable name="IDs_to_skip" select="tokenize($skip_docID,',')" as="xs:string*"/>
banspd1bf1db2022-04-04 02:16:24 +0200363
banspe726b4a2022-03-28 05:47:45 +0200364 <!-- we only want to call the template below once, and we process a random NKJP corpus file for that purpose,
bansp8f6700b2022-03-27 05:27:09 +0200365 because all we need is the main corpus header, and we can (should) get to that from any NKJP corpus document -->
366 <xsl:call-template name="create_corpus_header">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200367 <xsl:with-param name="text.doc" select="$collection_of_text[1]" as="document-node()"/>
bansp8f6700b2022-03-27 05:27:09 +0200368 <xsl:with-param name="target" select="$targetCorpusDir_slashed || 'header.xml'" as="xs:string"/>
369 </xsl:call-template>
370
banspe726b4a2022-03-28 05:47:45 +0200371 <xsl:for-each select="$collection_of_text">
372 <xsl:variable name="my_dir" as="xs:string" select="replace(base-uri(),'/text\.xml','')"/>
373 <xsl:variable name="my_textID" as="xs:string" select="tokenize($my_dir,'/')[last()]"/>
374 <xsl:variable name="ann_morphosyntax.uri" select="$my_dir || '/ann_morphosyntax.xml'" as="xs:string"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200375 <!--<xsl:variable name="ann_segmentation.uri" select="$my_dir || '/ann_segmentation.xml'" as="xs:string"/>-->
Piotr Banskic5950ce2022-05-27 15:07:08 +0200376 <xsl:variable name="ann_named.uri" select="$my_dir || '/ann_named.xml'" as="xs:string"/>
377 <xsl:variable name="ann_groups.uri" select="$my_dir || '/ann_groups.xml'" as="xs:string"/>
378 <xsl:variable name="ann_words.uri" select="$my_dir || '/ann_words.xml'" as="xs:string"/>
banspe726b4a2022-03-28 05:47:45 +0200379
banspf2b24e62022-03-28 18:12:08 +0200380 <xsl:choose>
381 <xsl:when test="$my_textID = $IDs_to_skip"/>
bansp9dc10002022-05-17 22:33:34 +0200382 <!-- this is a utility step, for when we want to ignore some texts for any reason (debugging, selective update) -->
banspf2b24e62022-03-28 18:12:08 +0200383 <xsl:otherwise>
banspd1bf1db2022-04-04 02:16:24 +0200384
bansp9dc10002022-05-17 22:33:34 +0200385 <xsl:call-template name="process_single_sample">
Piotr Banskif9590692022-06-02 15:39:48 +0200386 <xsl:with-param name="text.doc" as="document-node()" select="."/>
387 <xsl:with-param name="ann_morphosyntax.doc" as="document-node()"
banspf2b24e62022-03-28 18:12:08 +0200388 select="doc($ann_morphosyntax.uri)"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200389<!-- <xsl:with-param name="ann_segmentation.xml" as="document-node()"
390 select="doc($ann_segmentation.uri)"/>-->
banspf2b24e62022-03-28 18:12:08 +0200391 <xsl:with-param name="my_textID" select="$my_textID" as="xs:string"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200392 <!-- the following parameters may happen to be null -->
Piotr Banskif9590692022-06-02 15:39:48 +0200393 <xsl:with-param name="ann_named.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200394 select="if(fn:doc-available($ann_named.uri)) then doc($ann_named.uri) else ()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200395 <xsl:with-param name="ann_groups.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200396 select="if(fn:doc-available($ann_groups.uri)) then doc($ann_groups.uri) else ()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200397 <xsl:with-param name="ann_words.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200398 select="if(fn:doc-available($ann_words.uri)) then doc($ann_words.uri) else ()"/>
399
bansp9dc10002022-05-17 22:33:34 +0200400 </xsl:call-template>
banspf2b24e62022-03-28 18:12:08 +0200401 </xsl:otherwise>
402 </xsl:choose>
banspe726b4a2022-03-28 05:47:45 +0200403 </xsl:for-each>
bansp8f6700b2022-03-27 05:27:09 +0200404 </xsl:template>
405
406 <xsl:template name="process_single_sample">
Piotr Banskif9590692022-06-02 15:39:48 +0200407 <xsl:param name="text.doc" as="document-node()"/>
408 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200409<!-- <xsl:param name="ann_segmentation.xml" as="document-node()"/>-->
banspd1bf1db2022-04-04 02:16:24 +0200410 <xsl:param name="my_textID" as="xs:string" select="'0-BAD_textID'"/>
bansp9dc10002022-05-17 22:33:34 +0200411 <!-- empty textID should never happen, but if it does, it will be signalled at the top of the output -->
Piotr Banskif9590692022-06-02 15:39:48 +0200412 <xsl:param name="ann_named.doc" as="document-node()*"/>
413 <xsl:param name="ann_groups.doc" as="document-node()*"/>
414 <xsl:param name="ann_words.doc" as="document-node()*"/>
banspe726b4a2022-03-28 05:47:45 +0200415
416 <xsl:variable name="targetBaseDir" as="xs:string" select="$targetCorpusDir_slashed || $docID || '/' || $my_textID"/>
417
418 <xsl:variable name="compoundID" as="xs:string"
419 select="$corpusID || '_' || $docID || '.' || $my_textID"/>
420 <!-- this is what occurs in the text and data layers as @docid -->
421
bansp5e2d1c02022-03-10 04:51:40 +0100422 <xsl:call-template name="create_data">
Piotr Banski081c5de2022-06-03 01:57:13 +0200423 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200424 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
425 <xsl:with-param name="target" select="$targetBaseDir || '/data.xml'" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100426 </xsl:call-template>
427
Piotr Banski081c5de2022-06-03 01:57:13 +0200428 <!-- <xsl:call-template name="create_struct">
banspe726b4a2022-03-28 05:47:45 +0200429 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100430 <xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml"
431 as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200432 <xsl:with-param name="target" select="$targetBaseDir || '/struct/structure.xml'" as="xs:string"
bansp5f841732022-03-16 06:27:31 +0100433 />
Piotr Banski081c5de2022-06-03 01:57:13 +0200434 </xsl:call-template>-->
Piotr Banski92791a22022-05-26 01:41:10 +0200435
Piotr Banski081c5de2022-06-03 01:57:13 +0200436<!-- <xsl:call-template name="create_morpho">
banspe726b4a2022-03-28 05:47:45 +0200437 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
bansp3e5b20c2022-03-18 20:22:31 +0100438 <xsl:with-param name="ann_segmentation.xml" select="$ann_segmentation.xml"
439 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200440 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
bansp5f841732022-03-16 06:27:31 +0100441 as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200442 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/morpho.xml'" as="xs:string"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200443 </xsl:call-template>-->
Piotr Banskia51907c2022-05-25 15:09:41 +0200444
Piotr Banski081c5de2022-06-03 01:57:13 +0200445<!--
446
447 THESE ARE SAFE
448
449
450 <xsl:call-template name="create_text_header">
Piotr Banskif9590692022-06-02 15:39:48 +0200451 <xsl:with-param name="text.doc" select="$text.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200452 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
453 <xsl:with-param name="target" select="$targetBaseDir || '/header.xml'" as="xs:string"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200454 </xsl:call-template>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200455
Piotr Banskif9590692022-06-02 15:39:48 +0200456 <xsl:if test="$ann_named.doc">
Piotr Banski763b41f2022-06-02 01:13:23 +0200457 <xsl:variable name="rev_lookup-seq" as="map(*)+">
458 <xsl:for-each
Piotr Banskif9590692022-06-02 15:39:48 +0200459 select="$ann_named.doc//tei:seg/tei:ptr">
Piotr Banski763b41f2022-06-02 01:13:23 +0200460 <xsl:variable name="trg" as="xs:string" select="fn:substring-before(@target, '#')"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200461 <!-\- caution: as of 01-June-2022, some of the pointers are malformed (missing '#' when referencing locally).
462 so we need to act around it but also sustainably - in case that error gets corrected -\->
Piotr Banski763b41f2022-06-02 01:13:23 +0200463
464 <xsl:if test="fn:string-length($trg) and $trg eq 'ann_morphosyntax.xml'">
465 <xsl:sequence>
466 <xsl:map-entry key="fn:substring-after(fn:string(@target), '#')" select="fn:current()"
467 />
468 </xsl:sequence>
469 </xsl:if>
470 </xsl:for-each>
471 </xsl:variable>
472 <xsl:variable name="rev_lookup" as="map(*)" select="map:merge($rev_lookup-seq,map{'duplicates':'combine'})"/>
473
Piotr Banskic5950ce2022-05-27 15:07:08 +0200474 <xsl:call-template name="create_named">
475 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200476 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200477 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200478 <xsl:with-param name="ann_named.doc" select="$ann_named.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200479 as="document-node()"/>
480 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/named.xml'" as="xs:string"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200481 <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200482 </xsl:call-template>
483 </xsl:if>
Piotr Banski081c5de2022-06-03 01:57:13 +0200484-->
Piotr Banskif9590692022-06-02 15:39:48 +0200485 <xsl:if test="$ann_words.doc and $ann_groups.doc">
Piotr Banskic5950ce2022-05-27 15:07:08 +0200486 <xsl:call-template name="create_groups">
487 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200488 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200489 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200490 <xsl:with-param name="ann_words.doc" select="$ann_words.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200491 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200492 <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200493 as="document-node()"/>
494 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/groups.xml'" as="xs:string"/>
495 </xsl:call-template>
496 </xsl:if>
497
bansp5e2d1c02022-03-10 04:51:40 +0100498 </xsl:template>
499
500 <!-- ************************** data.xml ******************* -->
501
502 <xsl:template name="create_data">
Piotr Banski081c5de2022-06-03 01:57:13 +0200503 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200504 <xsl:param name="compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100505 <xsl:param name="target" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +0100506 <!-- create the data.xml file -->
507 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
bansp5f841732022-03-16 06:27:31 +0100508 xpath-default-namespace="{$KorAP_namespace}" href="{$target}">
bansp5e2d1c02022-03-10 04:51:40 +0100509
Akron9a8ee3e2022-01-31 13:51:49 +0100510 <xsl:processing-instruction name="xml-model">href=&quot;text.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
bansp5e2d1c02022-03-10 04:51:40 +0100511 <xsl:element name="raw_text" namespace="{$KorAP_namespace}">
bansp5f841732022-03-16 06:27:31 +0100512 <xsl:attribute name="docid" select="$compoundID"/>
bansp5e2d1c02022-03-10 04:51:40 +0100513 <xsl:element name="metadata" namespace="{$KorAP_namespace}">
514 <xsl:attribute name="file" select="'metadata.xml'"/>
515 </xsl:element>
516
517 <xsl:element name="text" namespace="{$KorAP_namespace}">
bansp9dc10002022-05-17 22:33:34 +0200518 <xsl:variable name="content" as="xs:string+">
Piotr Banski081c5de2022-06-03 01:57:13 +0200519 <!--<xsl:for-each select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s//tei:seg[count(@nkjp:rejected) eq 0]">-->
520 <xsl:for-each select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s/tei:seg[tei:fs/tei:f[@name eq 'disamb']]">
bansp9dc10002022-05-17 22:33:34 +0200521 <xsl:sequence select="
Piotr Banskifdc858a2022-05-25 02:40:32 +0200522 if (f:is_preceded_by_ws(.,false())) then
bansp9dc10002022-05-17 22:33:34 +0200523 ' '
524 else
Piotr Banski081c5de2022-06-03 01:57:13 +0200525 '', ./tei:fs/tei:f[@name eq 'orth']/tei:string"/>
bansp9dc10002022-05-17 22:33:34 +0200526 </xsl:for-each>
527 </xsl:variable>
528 <xsl:value-of select="string-join($content)"/>
bansp5e2d1c02022-03-10 04:51:40 +0100529 </xsl:element>
Akron9a8ee3e2022-01-31 13:51:49 +0100530 </xsl:element>
banspf79443e2022-02-25 14:25:33 +0100531 </xsl:result-document>
Akron9a8ee3e2022-01-31 13:51:49 +0100532 </xsl:template>
533
bansp5f841732022-03-16 06:27:31 +0100534 <!-- ************************** struct ******************* -->
535
536 <xsl:template name="create_struct">
banspe726b4a2022-03-28 05:47:45 +0200537 <xsl:param name="compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100538 <xsl:param name="ann_segmentation.xml" as="document-node()"/>
539 <xsl:param name="target" as="xs:string"/>
Piotr Banski4f4c2d22022-05-19 01:44:32 +0200540
bansp5f841732022-03-16 06:27:31 +0100541 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
542 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
543 <xsl:processing-instruction name="xml-model">href=&quot;span.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
544 <xsl:element name="layer" namespace="{$KorAP_namespace}">
545 <xsl:attribute name="docid" select="$compoundID"/>
546 <xsl:attribute name="version" select="$KorAP-XML_version"/>
547
548 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banski09096ee2022-05-25 13:41:03 +0200549 <xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="struct"/>
bansp5f841732022-03-16 06:27:31 +0100550 </xsl:element>
551 </xsl:element>
552 </xsl:result-document>
553 </xsl:template>
554
555 <xsl:template match="tei:*" mode="struct">
Piotr Banski09096ee2022-05-25 13:41:03 +0200556 <xsl:variable name="offsets" as="xs:integer+">
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200557 <xsl:sequence select="map:get(fn:accumulator-after('segmentation-offsets')[last()], string(@xml:id))"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200558 </xsl:variable>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200559
bansp5f841732022-03-16 06:27:31 +0100560 <xsl:variable name="my_name" select="local-name()" as="xs:string"/>
Piotr Banskie1ac5202022-05-30 21:25:21 +0200561 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
bansp3e5b20c2022-03-18 20:22:31 +0100562
bansp5f841732022-03-16 06:27:31 +0100563 <xsl:element name="span" namespace="{$KorAP_namespace}">
564 <xsl:attribute name="id" select="'s' || $my_index"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200565 <xsl:attribute name="from" select="$offsets[1]"/>
566 <xsl:attribute name="to" select="$offsets[2]"/>
bansp5f841732022-03-16 06:27:31 +0100567 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200568 <xsl:if test="local-name() eq 'seg' and $SHOW_ORTH_IN_STRUCT">
569 <xsl:comment><xsl:value-of select="fn:normalize-space(.)"/></xsl:comment>
570 </xsl:if>
bansp5f841732022-03-16 06:27:31 +0100571 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
Piotr Banskifdc858a2022-05-25 02:40:32 +0200572 <xsl:attribute name="type" select="'struct'"></xsl:attribute> <!-- STRUCT vs. LEX for morpho -->
bansp5f841732022-03-16 06:27:31 +0100573 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
bansp3e5b20c2022-03-18 20:22:31 +0100574 <xsl:attribute name="name" select="'name'"/>
575 <xsl:value-of select="local-name()"/>
bansp5f841732022-03-16 06:27:31 +0100576 </xsl:element>
577 <xsl:if test="count(@*)">
578 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
579 <xsl:attribute name="name" select="'attr'"/>
580 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
581 <xsl:attribute name="type" select="'attr'"/>
582 <xsl:for-each select="@*">
583 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
584 <xsl:attribute name="name" select="local-name(.)"/>
585 <xsl:value-of select="."/>
586 </xsl:element>
587 </xsl:for-each>
588 </xsl:element>
589 </xsl:element>
590 </xsl:if>
591 </xsl:element>
592 </xsl:element>
Piotr Banskia51907c2022-05-25 15:09:41 +0200593 <xsl:apply-templates mode="struct"/>
bansp5f841732022-03-16 06:27:31 +0100594 </xsl:template>
595
596 <!-- ************************** morpho ******************* -->
597
598 <xsl:template name="create_morpho">
banspe726b4a2022-03-28 05:47:45 +0200599 <xsl:param name="compoundID" as="xs:string"/>
bansp3e5b20c2022-03-18 20:22:31 +0100600 <xsl:param name="ann_segmentation.xml" as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200601 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
bansp5f841732022-03-16 06:27:31 +0100602 <xsl:param name="target" as="xs:string"/>
603
604 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
605 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
606 <xsl:processing-instruction name="xml-model">href=&quot;span.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
bansp3e5b20c2022-03-18 20:22:31 +0100607 <xsl:element name="layer" namespace="{$KorAP_namespace}">
608 <xsl:attribute name="docid" select="$compoundID"/>
609 <xsl:attribute name="version" select="$KorAP-XML_version"/>
610
611 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
612 <xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="morpho">
Piotr Banskif9590692022-06-02 15:39:48 +0200613 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
bansp3e5b20c2022-03-18 20:22:31 +0100614 </xsl:apply-templates>
615 </xsl:element>
616 </xsl:element>
bansp5f841732022-03-16 06:27:31 +0100617 </xsl:result-document>
618 </xsl:template>
619
bansp3e5b20c2022-03-18 20:22:31 +0100620 <xsl:template match="tei:seg" mode="morpho">
Piotr Banskif9590692022-06-02 15:39:48 +0200621 <xsl:param name="ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
Piotr Banskia51907c2022-05-25 15:09:41 +0200622 <!-- it's so spread out because I wanted to make sure to be able to look up the individual
623 constituent values, should anything go wrong; it might get compacted at some point, but
624 the increase in efficiency will probably be minimal, compared to the decrease of readability -->
625 <xsl:variable name="offsets" as="xs:integer+">
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200626 <xsl:sequence select="map:get(fn:accumulator-after('segmentation-offsets')[last()], string(@xml:id))"/>
Piotr Banskia51907c2022-05-25 15:09:41 +0200627 </xsl:variable>
bansp3e5b20c2022-03-18 20:22:31 +0100628 <xsl:variable name="my_name" select="local-name()" as="xs:string"/>
629 <xsl:variable name="my_id" select="@xml:id" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200630 <xsl:variable name="my_morph-seg" as="node()" select="$ann_morphosyntax.doc//tei:seg[substring-after(@corresp,'#') eq $my_id]"/>
bansp3e5b20c2022-03-18 20:22:31 +0100631 <xsl:variable name="my_disamb" select="$my_morph-seg//tei:fs/tei:f[@name eq 'disamb']" as="node()"/>
632 <xsl:variable name="my_choice-id" select="substring-after($my_disamb//tei:f[@name eq 'choice']/@fVal,'#')" as="xs:string"/>
633 <xsl:variable name="my_choice-lex" select="$my_morph-seg//tei:f[@name eq 'interps']/tei:fs[@type eq 'lex'][descendant::tei:symbol[@xml:id eq $my_choice-id]]" as="node()"/>
634 <xsl:variable name="chosen-msd" as="xs:string" select="$my_choice-lex/descendant::tei:symbol[@xml:id eq $my_choice-id]/@value"/>
Piotr Banskie1ac5202022-05-30 21:25:21 +0200635 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
bansp3e5b20c2022-03-18 20:22:31 +0100636
bansp3e5b20c2022-03-18 20:22:31 +0100637 <xsl:element name="span" namespace="{$KorAP_namespace}">
Piotr Banskia51907c2022-05-25 15:09:41 +0200638 <xsl:attribute name="id" select="'m' || $my_index"/>
639 <xsl:attribute name="from" select="$offsets[1]"/>
640 <xsl:attribute name="to" select="$offsets[2]"/>
bansp3e5b20c2022-03-18 20:22:31 +0100641 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
642 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
643 <xsl:attribute name="type" select="'lex'"/>
644 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
645 <xsl:attribute name="name" select="'lex'"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200646 <xsl:comment select="(if(@nkjp:nps) then ' ' else '_') || $my_morph-seg//tei:fs/tei:f[@name eq 'orth']/tei:string"/>
bansp3e5b20c2022-03-18 20:22:31 +0100647 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
bansp3e5b20c2022-03-18 20:22:31 +0100648 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
649 <xsl:attribute name="name" select="'lemma'"/>
650 <xsl:value-of select="$my_choice-lex/tei:f[@name eq 'base']/tei:string"/>
651 </xsl:element>
652 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
653 <xsl:attribute name="name" select="'pos'"/>
654 <xsl:value-of select="$my_choice-lex/tei:f[@name eq 'ctag']/tei:symbol/@value"/>
655 </xsl:element>
656 <xsl:if test="string-length($chosen-msd)">
657 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
658 <xsl:attribute name="name" select="'msd'"/>
659 <xsl:value-of select="$chosen-msd"/>
660 </xsl:element>
661 </xsl:if>
662 <xsl:if test="$my_morph-seg//tei:fs/tei:f[@name eq 'nps']">
663 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
664 <xsl:attribute name="name" select="'join'"/>
665 <xsl:value-of select="'left'"/>
666 </xsl:element>
667 </xsl:if>
668 </xsl:element>
669 </xsl:element>
670 </xsl:element>
671 </xsl:element>
bansp3e5b20c2022-03-18 20:22:31 +0100672 </xsl:template>
banspe726b4a2022-03-28 05:47:45 +0200673
Piotr Banskic5950ce2022-05-27 15:07:08 +0200674 <!-- ************************** named entities ******************* -->
675
676 <xsl:template name="create_named">
677 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200678 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
679 <xsl:param name="ann_named.doc" as="document-node()"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200680 <xsl:param name="target" as="xs:string"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200681 <xsl:param name="rev_lookup" as="map(*)"/>
682
Piotr Banskic5950ce2022-05-27 15:07:08 +0200683 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
684 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
685 <xsl:processing-instruction name="xml-model">href=&quot;span.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
686 <xsl:element name="layer" namespace="{$KorAP_namespace}">
687 <xsl:attribute name="docid" select="$compoundID"/>
688 <xsl:attribute name="version" select="$KorAP-XML_version"/>
689
690 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banskif9590692022-06-02 15:39:48 +0200691 <xsl:apply-templates select="$ann_morphosyntax.doc//tei:text" mode="named">
692 <xsl:with-param name="ann_named.doc" select="$ann_named.doc" as="document-node()" tunnel="yes"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200693 <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)" tunnel="yes"/>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200694 </xsl:apply-templates>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200695 </xsl:element>
696 </xsl:element>
697 </xsl:result-document>
698 </xsl:template>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200699
700 <xsl:template match="tei:seg" mode="named"/>
701
702 <xsl:template match="tei:seg[tei:fs[tei:f[@name eq 'disamb']]]" mode="named">
Piotr Banskif9590692022-06-02 15:39:48 +0200703 <xsl:param name="ann_named.doc" as="document-node()" tunnel="yes"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200704 <xsl:param name="rev_lookup" as="map(*)" tunnel="yes"/>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200705
706 <xsl:variable name="offsets" as="xs:integer+">
707 <xsl:sequence select="map:get(fn:accumulator-after('morpho-offsets')[last()], string(@xml:id))"/>
708 </xsl:variable>
709
Piotr Banski763b41f2022-06-02 01:13:23 +0200710 <xsl:variable name="ptr" select="map:get($rev_lookup,fn:string(@xml:id))" as="element(tei:ptr)*"/>
711 <!-- it's an element, because we need to see where it stands in a sequence... -->
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200712
Piotr Banski763b41f2022-06-02 01:13:23 +0200713 <xsl:if test="$ptr">
714 <xsl:variable name="my_id" select="@xml:id" as="xs:string"/>
715 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
716
717 <xsl:element name="span" namespace="{$KorAP_namespace}">
718 <xsl:attribute name="id" select="'n' || $my_index"/>
719 <xsl:attribute name="from" select="$offsets[1]"/>
720 <xsl:attribute name="to" select="$offsets[2]"/>
721 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
722 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
723 <xsl:attribute name="type" select="'ne'"/>
724 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
725 <xsl:attribute name="name" select="'ne'"/>
726 <xsl:comment select="
727 (if (tei:fs/tei:f[@name eq 'nps']) then
728 ' '
729 else
730 '_') || tei:fs/tei:f[@name eq 'orth']/tei:string"/>
731 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
732 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
733 <xsl:attribute name="name" select="'complex-ent'"/>
734 <xsl:for-each select="$ptr">
735 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
736 <xsl:attribute name="type" select="'complex-ent'"/>
737 <xsl:for-each select="parent::tei:seg/tei:fs[1]/tei:f">
738 <xsl:if test="@name eq 'type' or @name eq 'subtype'">
739 <xsl:copy-of select="." copy-namespaces="no"/>
740 </xsl:if>
741 </xsl:for-each>
742 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
743 <xsl:attribute name="name" select="'nkjp-named'"/>
744 <xsl:copy-of select="parent::tei:seg/tei:fs[1]" copy-namespaces="no"/>
745 </xsl:element>
746 </xsl:element>
747 </xsl:for-each>
748
749 </xsl:element>
750
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200751 </xsl:element>
752 </xsl:element>
753 </xsl:element>
754 </xsl:element>
Piotr Banski763b41f2022-06-02 01:13:23 +0200755 </xsl:if>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200756 </xsl:template>
757
Piotr Banskic5950ce2022-05-27 15:07:08 +0200758
759 <!-- ************************** syntactic chunks ******************* -->
760
761 <xsl:template name="create_groups">
762 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200763 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
764 <xsl:param name="ann_words.doc" as="document-node()"/>
765 <xsl:param name="ann_groups.doc" as="document-node()"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200766 <xsl:param name="target" as="xs:string"/>
767
768 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
769 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
770 <xsl:processing-instruction name="xml-model">href=&quot;span.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
771 <xsl:element name="layer" namespace="{$KorAP_namespace}">
772 <xsl:attribute name="docid" select="$compoundID"/>
773 <xsl:attribute name="version" select="$KorAP-XML_version"/>
774
775 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
776 <!--<xsl:apply-templates select="$ann_segmentation.xml//tei:text" mode="groups">
Piotr Banskif9590692022-06-02 15:39:48 +0200777 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()" tunnel="yes"/>
778 <xsl:with-param name="ann_words.doc" select="$ann_words.doc" as="document-node()" tunnel="yes"/>
779 <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc" as="document-node()" tunnel="yes"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200780 </xsl:apply-templates>-->
781 </xsl:element>
782 </xsl:element>
783 </xsl:result-document>
784 </xsl:template>
785
bansp5f841732022-03-16 06:27:31 +0100786 <!-- ************************** TEXT header ******************* -->
787
788 <xsl:template name="create_text_header">
Piotr Banskif9590692022-06-02 15:39:48 +0200789 <xsl:param name="text.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200790 <xsl:param name="compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100791 <xsl:param name="target" as="xs:string"/>
792
793 <!-- create the local header.xml file -->
794 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
795 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
796
797 <idsHeader type="document" pattern="text" status="new" version="1.1" TEIform="teiHeader">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200798 <xsl:apply-templates select="$text.doc//tei:TEI/tei:teiHeader/tei:*" mode="text-header">
banspe726b4a2022-03-28 05:47:45 +0200799 <xsl:with-param name="compoundID" as="xs:string" select="$compoundID" tunnel="yes"/>
800 </xsl:apply-templates>
bansp5f841732022-03-16 06:27:31 +0100801 </idsHeader>
802 </xsl:result-document>
803 </xsl:template>
804
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200805 <xsl:template match="tei:fileDesc" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100806 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200807 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100808 </xsl:element>
bansp5f841732022-03-16 06:27:31 +0100809 </xsl:template>
810
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200811 <xsl:template match="tei:title" mode="text-header">
bansp5f841732022-03-16 06:27:31 +0100812 <t.title>
813 <xsl:apply-templates/>
814 </t.title>
815 </xsl:template>
816
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200817 <xsl:template match="tei:titleStmt" mode="text-header">
banspe726b4a2022-03-28 05:47:45 +0200818 <xsl:param name="compoundID" as="xs:string" tunnel="yes"/>
bansp5f841732022-03-16 06:27:31 +0100819 <titleStmt>
820 <textSigle>
banspe726b4a2022-03-28 05:47:45 +0200821 <xsl:value-of select="$compoundID"/>
bansp5f841732022-03-16 06:27:31 +0100822 </textSigle>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200823 <xsl:apply-templates mode="text-header"/>
bansp5f841732022-03-16 06:27:31 +0100824 </titleStmt>
825 </xsl:template>
826
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200827 <xsl:template match="tei:publicationStmt" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100828 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200829 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100830 </xsl:element>
831 </xsl:template>
832
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200833 <xsl:template match="tei:availability" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100834 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200835 <xsl:apply-templates mode="text-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100836 </xsl:element>
837 </xsl:template>
838
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200839 <xsl:template match="tei:profileDesc" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100840 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200841 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100842 </xsl:element>
843 </xsl:template>
bansp5f841732022-03-16 06:27:31 +0100844
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200845 <xsl:template match="tei:textClass" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100846 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200847 <xsl:apply-templates mode="text-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100848 </xsl:element>
849 </xsl:template>
850
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200851 <xsl:template match="tei:catRef" mode="text-header corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100852 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200853 <xsl:apply-templates mode="text-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100854 </xsl:element>
855 </xsl:template>
856
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200857 <xsl:template match="@status | @scheme | @target | @type | @xml:id[ancestor::tei:classDecl] | @xml:lang" mode="text-header corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100858 <xsl:copy-of select="."/>
859 </xsl:template>
860
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200861 <xsl:template match="tei:p" mode="text-header corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100862 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200863 <xsl:apply-templates mode="text_inside_header"/>
bansp9103aab2022-03-19 05:10:21 +0100864 </xsl:element>
865 </xsl:template>
866
867
868 <!-- OPTIMIZATION has to take modes into account -->
bansp5e2d1c02022-03-10 04:51:40 +0100869 <!-- ************************** CORPUS header ******************* -->
870 <xsl:template name="create_corpus_header">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200871 <xsl:param name="text.doc" as="document-node()"/>
bansp5f841732022-03-16 06:27:31 +0100872 <xsl:param name="target" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +0100873
874 <!-- create the corpus-level header.xml file -->
bansp5f841732022-03-16 06:27:31 +0100875 <xsl:result-document encoding="UTF-8" method="xml" indent="yes" href="{$target}">
bansp5e2d1c02022-03-10 04:51:40 +0100876
877 <!--doctype-public="{$publicDoctypeI5}"
878 doctype-system="{$systemDoctypeI5}">
879 these are, sadly, useless
880 -->
881
882 <idsHeader type="corpus" pattern="text" status="new" version="1.1" TEIform="teiHeader">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200883 <xsl:apply-templates select="$text.doc/tei:teiCorpus/tei:teiHeader/tei:*" mode="corpus-header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100884 </idsHeader>
885 </xsl:result-document>
886 </xsl:template>
887
Piotr Banskifaa910f2022-06-03 00:46:29 +0200888 <xsl:template match="tei:fileDesc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100889 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200890 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100891 </xsl:element>
bansp5e2d1c02022-03-10 04:51:40 +0100892 </xsl:template>
bansp9103aab2022-03-19 05:10:21 +0100893
bansp5e2d1c02022-03-10 04:51:40 +0100894
Piotr Banskifaa910f2022-06-03 00:46:29 +0200895 <xsl:template match="tei:title" mode="corpus-header">
bansp5e2d1c02022-03-10 04:51:40 +0100896 <c.title>
Piotr Banskifaa910f2022-06-03 00:46:29 +0200897 <xsl:apply-templates mode="corpus-header" select="@*"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200898 <xsl:apply-templates mode="text_inside_header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100899 </c.title>
900 </xsl:template>
901
Piotr Banskifaa910f2022-06-03 00:46:29 +0200902 <xsl:template match="tei:titleStmt" mode="corpus-header">
bansp5e2d1c02022-03-10 04:51:40 +0100903 <titleStmt>
904 <korpusSigle>
905 <xsl:value-of select="$corpusID"/>
906 </korpusSigle>
Piotr Banskifaa910f2022-06-03 00:46:29 +0200907 <xsl:apply-templates mode="corpus-header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100908 </titleStmt>
909 </xsl:template>
910
Piotr Banskifaa910f2022-06-03 00:46:29 +0200911 <xsl:template match="tei:publicationStmt" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100912 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200913 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100914 </xsl:element>
915 </xsl:template>
916
Piotr Banskifaa910f2022-06-03 00:46:29 +0200917 <xsl:template match="tei:availability" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100918 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200919 <xsl:apply-templates mode="corpus-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100920 </xsl:element>
921 </xsl:template>
922
Piotr Banskifaa910f2022-06-03 00:46:29 +0200923 <xsl:template match="tei:encodingDesc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100924 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200925 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100926 </xsl:element>
927 </xsl:template>
928
Piotr Banskifaa910f2022-06-03 00:46:29 +0200929 <xsl:template match="tei:classDecl | tei:taxonomy | tei:category | tei:taxonomy/tei:bibl" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100930 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200931 <xsl:apply-templates mode="corpus-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100932 </xsl:element>
933 </xsl:template>
934
Piotr Banskifaa910f2022-06-03 00:46:29 +0200935 <xsl:template match="tei:bibl/tei:title | tei:edition | tei:desc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100936 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200937 <xsl:apply-templates mode="corpus-header" select="@*"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200938 <xsl:apply-templates mode="text_inside_header"/>
bansp9103aab2022-03-19 05:10:21 +0100939 </xsl:element>
940 </xsl:template>
941<!--
Piotr Banskifaa910f2022-06-03 00:46:29 +0200942 <xsl:template match="tei:textClass" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100943 <xsl:element name="{local-name()}">
944 <xsl:apply-templates mode="corpus" select="@* | *"/>
945 </xsl:element>
946 </xsl:template>
947
Piotr Banskifaa910f2022-06-03 00:46:29 +0200948 <xsl:template match="tei:catRef" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100949 <xsl:element name="{local-name()}">
950 <xsl:apply-templates mode="corpus" select="@* | *"/>
951 </xsl:element>
952 </xsl:template>
953-->
bansp5e2d1c02022-03-10 04:51:40 +0100954
955
956
957 <!-- this template can be called by the XSPEC test; TODO: find a way to call the main() template directly -->
958 <!-- I have not fully handled the param transmission, which would have to be kludged in just for the sake of XSPec,
959 because I'm disabling this for now, due to XSpec design issues; relevant links, a.o.:
960
961 https://stackoverflow.com/questions/64933277/what-is-the-cause-of-error-cannot-execute-xslresult-document-while-evaluating
962 https://www.balisage.net/Proceedings/vol25/html/Galtman01/BalisageVol25-Galtman01.html
963
964 In short: the internal design of XSpec forces kludges when one wants to use xsl:result-document in their stylesheets. But I don't
965 want to be strangled by kludges at the beginning of work, I've already lost quite a bit of time on this investigation,
966 I will therefore "just code" and then can think of externalizing bits of templates if we want to play with tests. For now,
967 I don't want to have to handle context items is a special way inside variables, etc., because I'm not sure it's worth it.
968
969 -->
970 <!--<xsl:template name="test_full">
971 <xsl:param name="corpusID"/>
972 <xsl:param name="docID"/>
973 <xsl:param name="textID"/>
974 <xsl:call-template name="xsl:initial-template"/>
975 </xsl:template>-->
976
Akron9a8ee3e2022-01-31 13:51:49 +0100977</xsl:stylesheet>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200978
Piotr Banskifdc858a2022-05-25 02:40:32 +0200979<!-- template for serializing maps in messages <xsl:message select="('map:',serialize($map, map{'method':'adaptive'}))"/> -->