blob: db8e6aa36201e9b71aa0e988bf30a174a239a27f [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"
Marc Kupietz9a943ad2022-12-15 17:26:49 +01007 xmlns:map="http://www.w3.org/2005/xpath-functions/map" exclude-result-prefixes="xs f fn map nkjp tei xi saxon"
8 xmlns:saxon="http://saxon.sf.net/"
bansp5e2d1c02022-03-10 04:51:40 +01009 version="3.0" expand-text="yes">
Akron9a8ee3e2022-01-31 13:51:49 +010010
banspe726b4a2022-03-28 05:47:45 +020011
12<!-- PARAMETERS -->
bansp5e2d1c02022-03-10 04:51:40 +010013
Piotr Banskib28e5882022-06-08 20:41:20 +020014 <xsl:param name="sourceDir" select="'test/resources/nkjp2korap_sample3'" as="xs:string"/>
banspd1bf1db2022-04-04 02:16:24 +020015 <!-- the directory containing NKJP files, in the form of a collection of text-level dirs
16 (that is how we know both the $corpusID and the $docID) -->
Akron9a8ee3e2022-01-31 13:51:49 +010017
bansp8f6700b2022-03-27 05:27:09 +020018 <xsl:param name="targetDir" select="'test/output'" as="xs:string"/>
banspd1bf1db2022-04-04 02:16:24 +020019 <!-- where the corpus/document/text/annotations hierarchy is going to be created -->
banspf2b24e62022-03-28 18:12:08 +020020
21 <xsl:param name="skip_docID" as="xs:string">
Piotr Banskia78e59d2022-06-03 19:35:32 +020022 <xsl:value-of select="''"/>
Piotr Banskib28e5882022-06-08 20:41:20 +020023 <!--<xsl:value-of select="'HellerPodgladanie,IsakowiczZaleskiMoje,KOT,MysliwskiKamien,WilkWilczy,ZycieWarszawy_Zycie'"/>-->
banspb5992532022-03-29 15:55:44 +020024 </xsl:param>
25 <!-- comma-separated list of document IDs to be skipped from processing
banspf2b24e62022-03-28 18:12:08 +020026 example: HellerPodgladanie,KOT
banspd1bf1db2022-04-04 02:16:24 +020027 no functionality beyond string identity is supported
28 (this is just for testing) -->
banspb5992532022-03-29 15:55:44 +020029
Piotr Banski1ae16bd2022-05-25 15:59:40 +020030 <xsl:param name="SHOW_ORTH_IN_STRUCT" as="xs:boolean" select="true()"/>
Piotr Banskid2b78b82022-06-03 17:05:59 +020031 <!-- for debugging structure.xml production; otherwise we don't see the referenced span -->
32
33 <xsl:param name="SHOW_REDUNDANT_ORTH" as="xs:boolean" select="true()"/>
34 <!-- in layers such as morpho or named, one can recover the orth, so this is a bit of
35 space-wasting luxury, useful at the early stages -->
Piotr Banski09096ee2022-05-25 13:41:03 +020036
bansp8f6700b2022-03-27 05:27:09 +020037
bansp9dc10002022-05-17 22:33:34 +020038<!-- VARIABLES (= constants...) -->
banspe726b4a2022-03-28 05:47:45 +020039
Marc Kupietz9a943ad2022-12-15 17:26:49 +010040 <xsl:variable name="line-length" as="xs:numeric" static="true" select="1024"/>
41
banspe726b4a2022-03-28 05:47:45 +020042 <xsl:variable name="corpusID" as="xs:string" select="'NKJP'" static="yes"/>
43 <xsl:variable name="docID" as="xs:string" select="'NKJP'" static="yes"/>
bansp8f6700b2022-03-27 05:27:09 +020044
45 <xsl:variable name="targetCorpusDir_slashed" select="$targetDir || '/' || $corpusID || '/'" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +010046
banspd1bf1db2022-04-04 02:16:24 +020047 <xsl:variable name="systemDoctypeI5" as="xs:string"
48 select="'http://corpora.ids-mannheim.de/I5/DTD/i5.dtd'" static="true"/>
bansp5e2d1c02022-03-10 04:51:40 +010049
banspd1bf1db2022-04-04 02:16:24 +020050 <xsl:variable name="publicDoctypeI5" as="xs:string" static="true"
51 select="'-//IDS//DTD I5 1.0//EN'"/>
bansp5e2d1c02022-03-10 04:51:40 +010052
banspd1bf1db2022-04-04 02:16:24 +020053 <xsl:variable name="KorAP_namespace" static="true" as="xs:string"
54 select="'http://ids-mannheim.de/ns/KorAP'"/>
bansp5e2d1c02022-03-10 04:51:40 +010055
bansp5f841732022-03-16 06:27:31 +010056 <xsl:variable name="KorAP-XML_version" select="'KorAP-0.4'" as="xs:string" static="true"/>
57 <!-- this is only a bit funny -->
58
banspe726b4a2022-03-28 05:47:45 +020059 <xsl:variable name="collection_params" as="xs:string" static="yes"
60 select="'recurse=yes;validation=strip;select=text.xml;content-type=application/xml;on-error=warning;xinclude=yes'"
61 />
62 <!-- see https://www.saxonica.com/documentation11/index.html#!sourcedocs/collections/collection-directories -->
63
64 <xsl:variable name="collection_of_text" select="collection($sourceDir || '?' || $collection_params)" as="document-node()+"/>
banspd1bf1db2022-04-04 02:16:24 +020065
banspe726b4a2022-03-28 05:47:45 +020066<!-- MODES -->
bansp5e2d1c02022-03-10 04:51:40 +010067
Piotr Banski43b9db02022-06-03 02:38:42 +020068 <xsl:mode name="struct" on-no-match="deep-skip"/>
Piotr Banskid2b78b82022-06-03 17:05:59 +020069 <xsl:mode name="morpho" on-no-match="deep-skip"/>
Piotr Banskifaa910f2022-06-03 00:46:29 +020070 <xsl:mode name="corpus-header" on-no-match="deep-skip"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +020071 <xsl:mode name="text-header" on-no-match="deep-skip"/>
72 <xsl:mode name="text_inside_header" on-no-match="text-only-copy"/>
Piotr Banski763b41f2022-06-02 01:13:23 +020073 <xsl:mode name="copy" on-no-match="shallow-copy"/>
Piotr Banski6a4a2522022-05-24 01:16:47 +020074 <xsl:mode use-accumulators="#all"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020075
Piotr Banskie1ac5202022-05-30 21:25:21 +020076 <xsl:accumulator name="element-index" as="xs:integer" initial-value="0">
Piotr Banskid2b78b82022-06-03 17:05:59 +020077 <!--<xsl:accumulator-rule match="tei:*[ancestor-or-self::tei:text]" select="$value + 1" phase="start"/>-->
78 <xsl:accumulator-rule
79 match="tei:teiCorpus/tei:TEI/(tei:text | tei:text/tei:body | tei:text/tei:body/tei:p | tei:text/tei:body/tei:p/tei:s | tei:text/tei:body/tei:p/tei:s/tei:seg)"
80 select="$value + 1" phase="start"/>
Piotr Banski09096ee2022-05-25 13:41:03 +020081 </xsl:accumulator>
Piotr Banskid2b78b82022-06-03 17:05:59 +020082
Piotr Banski65a6d0b2022-05-31 17:23:08 +020083 <xsl:accumulator name="morpho-offsets" as="map(xs:string, item()+)+" initial-value="(map{'null':(0,0)})">
Piotr Banskifdc858a2022-05-25 02:40:32 +020084
85 <xsl:accumulator-rule match="tei:body/tei:p" phase="start">
86 <xsl:variable name="preceding_index" as="xs:integer">
87 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
88 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banski6a4a2522022-05-24 01:16:47 +020089 </xsl:variable>
90
Piotr Banskifdc858a2022-05-25 02:40:32 +020091 <xsl:variable name="our_base" as="xs:integer" select="if($preceding_index eq 0) then $preceding_index else $preceding_index + 1"/>
92 <!-- for paragraphs, it's in either being initial or not -->
Piotr Banski09096ee2022-05-25 13:41:03 +020093
Piotr Banskifdc858a2022-05-25 02:40:32 +020094 <xsl:sequence select="
95 $value,
96 map {
97 string(@xml:id): ($preceding_index,$our_base)
98 }"/>
99 </xsl:accumulator-rule>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200100
Piotr Banskifdc858a2022-05-25 02:40:32 +0200101 <xsl:accumulator-rule match="tei:s" phase="start">
102 <xsl:variable name="preceding_index" as="xs:integer">
103 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
104 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200105 </xsl:variable>
Piotr Banski92791a22022-05-26 01:41:10 +0200106 <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 +0200107
Piotr Banskifdc858a2022-05-25 02:40:32 +0200108 <xsl:sequence select="
109 $value,
110 map {
111 string(@xml:id): ($preceding_index,$our_base)
112 }"/>
113 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200114
115<!-- I want something that won't be matched in other layers, for efficiency - that
116 may allow me to merge the accumulators, eventually;
117 but I also want to filter out the rejected tokenization alternatives already here -->
118 <xsl:accumulator-rule match="tei:seg[tei:fs[@type eq 'morph' and tei:f[@name eq 'disamb']]]" phase="end">
119
Piotr Banskifdc858a2022-05-25 02:40:32 +0200120 <xsl:variable name="preceding_index" as="xs:integer">
121 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
122 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200123 </xsl:variable>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200124 <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 +0200125
Piotr Banski6a4a2522022-05-24 01:16:47 +0200126 <xsl:sequence select="
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200127 $value,
128 map {
129 string(@xml:id): ($our_base,$our_base + string-length(tei:fs/tei:f[@name eq 'orth']/tei:string))
130 }"/>
131
Piotr Banski6a4a2522022-05-24 01:16:47 +0200132 </xsl:accumulator-rule>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200133
Piotr Banskifdc858a2022-05-25 02:40:32 +0200134 <xsl:accumulator-rule match="tei:s" phase="end">
135 <xsl:variable name="preceding_index" as="xs:integer">
136 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
137 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200138
Piotr Banskifdc858a2022-05-25 02:40:32 +0200139 </xsl:variable>
140 <xsl:variable name="our_base" as="xs:integer">
141 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
142 <xsl:sequence select="$incomplete[2]"/>
143 </xsl:variable>
Piotr Banski09096ee2022-05-25 13:41:03 +0200144
Piotr Banskifdc858a2022-05-25 02:40:32 +0200145 <xsl:sequence select="
146 $value,
147 map {
148 string(@xml:id): ($our_base,$preceding_index)
149 }"/>
150 </xsl:accumulator-rule>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200151
Piotr Banskifdc858a2022-05-25 02:40:32 +0200152 <xsl:accumulator-rule match="tei:body/tei:p" phase="end">
153 <xsl:variable name="preceding_index" as="xs:integer">
154 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
155 <xsl:sequence select="map:get($the_tail,map:keys($the_tail)[1])[2]"/>
156
Piotr Banskifdc858a2022-05-25 02:40:32 +0200157 </xsl:variable>
158 <xsl:variable name="our_base" as="xs:integer">
159 <xsl:variable name="incomplete" select="map:find($value,string(@xml:id))(1)" as="xs:integer+"/>
160 <xsl:sequence select="$incomplete[2]"/>
161 </xsl:variable>
Piotr Banski09096ee2022-05-25 13:41:03 +0200162
Piotr Banskifdc858a2022-05-25 02:40:32 +0200163 <xsl:sequence select="
164 $value,
165 map {
166 string(@xml:id): ($our_base,$preceding_index)
167 }"/>
168 </xsl:accumulator-rule>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200169
Piotr Banskifdc858a2022-05-25 02:40:32 +0200170 <xsl:accumulator-rule match="tei:body" phase="end">
171 <xsl:variable name="preceding_index" as="xs:integer">
172 <xsl:variable name="the_tail" as="map(*)" select="head(reverse($value))"/>
173 <xsl:sequence select="map:get($the_tail, map:keys($the_tail)[1])[2]"/>
174 </xsl:variable>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200175
Piotr Banskifdc858a2022-05-25 02:40:32 +0200176 <xsl:sequence select="
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200177 $value,
178 map {
179 string(@xml:id): (0, $preceding_index)
180 }"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200181 </xsl:accumulator-rule>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200182
Piotr Banskifdc858a2022-05-25 02:40:32 +0200183 <xsl:accumulator-rule match="tei:text" phase="end">
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
189 <xsl:sequence select="
190 $value,
191 map {
192 string(@xml:id): (0, $preceding_index)
193 }"/>
194 </xsl:accumulator-rule>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200195
Piotr Banski6a4a2522022-05-24 01:16:47 +0200196 </xsl:accumulator>
bansp5e2d1c02022-03-10 04:51:40 +0100197
banspe726b4a2022-03-28 05:47:45 +0200198 <!-- FUNCTIONS -->
199
bansp5f841732022-03-16 06:27:31 +0100200 <xsl:function name="f:compute_nesting" as="xs:integer">
banspd1bf1db2022-04-04 02:16:24 +0200201 <xsl:param name="node" as="element()"/>
bansp5f841732022-03-16 06:27:31 +0100202 <xsl:variable name="rel_depth"
203 select="count($node/ancestor-or-self::*[local-name(.) ne 'TEI'][local-name(.) ne 'teiCorpus'])"
204 as="xs:integer"/>
bansp5f841732022-03-16 06:27:31 +0100205 <xsl:sequence select="$rel_depth"/>
206 </xsl:function>
207
Piotr Banski92791a22022-05-26 01:41:10 +0200208 <xsl:function name="f:is_preceded_by_ws" as="xs:boolean">
bansp9dc10002022-05-17 22:33:34 +0200209 <xsl:param name="node" as="element()"/>
Piotr Banskifdc858a2022-05-25 02:40:32 +0200210 <xsl:param name="suppress_initial" as="xs:boolean"/>
Piotr Banski4f4c2d22022-05-19 01:44:32 +0200211
Piotr Banski92791a22022-05-26 01:41:10 +0200212 <xsl:choose>
213 <xsl:when test="local-name($node) eq 'seg'">
214 <xsl:choose>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200215 <xsl:when test="$node/tei:fs/tei:f[@name eq 'nps']">
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200216 <xsl:sequence select="fn:false()"/>
217 </xsl:when>
Piotr Banski92791a22022-05-26 01:41:10 +0200218 <xsl:when
219 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])">
220 <xsl:sequence select="fn:false()"/>
221 <!-- the otherwise very costly check for preceding segs fires only if the first two are true, so it will have minimal search space -->
222 </xsl:when>
223 <xsl:when
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200224 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">
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200225 <xsl:sequence select="fn:false()"/>
226 </xsl:when>
Piotr Banski92791a22022-05-26 01:41:10 +0200227 <xsl:otherwise>
228 <xsl:sequence select="fn:true()"/>
229 </xsl:otherwise>
230 </xsl:choose>
231 </xsl:when>
232 <xsl:when test="local-name($node) eq 's'">
233 <xsl:choose>
234 <xsl:when test="exists($node/preceding-sibling::tei:s)">
235 <xsl:sequence select="fn:true()"/>
236 </xsl:when>
237 <xsl:otherwise>
238 <xsl:sequence
239 select="not($suppress_initial) and exists($node/ancestor::tei:p[1]/preceding-sibling::tei:p)"
240 />
241 </xsl:otherwise>
242 </xsl:choose>
243
244 </xsl:when>
245 <xsl:when test="local-name($node) eq 'p'">
246 <xsl:sequence select="exists($node/preceding-sibling::tei:p)"/>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:message terminate="yes"
250 select="'Wrong argument passed to f:is_preceded_by_ws(): ' || local-name($node) || ' Only p, s, seg are allowed.'"
251 />
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:function>
banspd1bf1db2022-04-04 02:16:24 +0200255
banspb5992532022-03-29 15:55:44 +0200256<!-- UTILITY TEMPLATES -->
257
bansp9103aab2022-03-19 05:10:21 +0100258 <xsl:template match="@default" mode="#all"/>
bansp97ba7ce2022-03-26 05:14:06 +0100259 <!-- this is to delete some auto-inserted attribute throughout -->
bansp9103aab2022-03-19 05:10:21 +0100260
banspb5992532022-03-29 15:55:44 +0200261 <!-- MAIN PROCESSING -->
262
bansp5e2d1c02022-03-10 04:51:40 +0100263 <xsl:template name="xsl:initial-template">
banspf2b24e62022-03-28 18:12:08 +0200264 <xsl:variable name="IDs_to_skip" select="tokenize($skip_docID,',')" as="xs:string*"/>
banspd1bf1db2022-04-04 02:16:24 +0200265
banspe726b4a2022-03-28 05:47:45 +0200266 <!-- 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 +0200267 because all we need is the main corpus header, and we can (should) get to that from any NKJP corpus document -->
268 <xsl:call-template name="create_corpus_header">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200269 <xsl:with-param name="text.doc" select="$collection_of_text[1]" as="document-node()"/>
bansp8f6700b2022-03-27 05:27:09 +0200270 <xsl:with-param name="target" select="$targetCorpusDir_slashed || 'header.xml'" as="xs:string"/>
271 </xsl:call-template>
272
banspe726b4a2022-03-28 05:47:45 +0200273 <xsl:for-each select="$collection_of_text">
274 <xsl:variable name="my_dir" as="xs:string" select="replace(base-uri(),'/text\.xml','')"/>
275 <xsl:variable name="my_textID" as="xs:string" select="tokenize($my_dir,'/')[last()]"/>
276 <xsl:variable name="ann_morphosyntax.uri" select="$my_dir || '/ann_morphosyntax.xml'" as="xs:string"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200277 <!--<xsl:variable name="ann_segmentation.uri" select="$my_dir || '/ann_segmentation.xml'" as="xs:string"/>-->
Piotr Banskic5950ce2022-05-27 15:07:08 +0200278 <xsl:variable name="ann_named.uri" select="$my_dir || '/ann_named.xml'" as="xs:string"/>
279 <xsl:variable name="ann_groups.uri" select="$my_dir || '/ann_groups.xml'" as="xs:string"/>
280 <xsl:variable name="ann_words.uri" select="$my_dir || '/ann_words.xml'" as="xs:string"/>
banspe726b4a2022-03-28 05:47:45 +0200281
banspf2b24e62022-03-28 18:12:08 +0200282 <xsl:choose>
283 <xsl:when test="$my_textID = $IDs_to_skip"/>
bansp9dc10002022-05-17 22:33:34 +0200284 <!-- 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 +0200285 <xsl:otherwise>
banspd1bf1db2022-04-04 02:16:24 +0200286
bansp9dc10002022-05-17 22:33:34 +0200287 <xsl:call-template name="process_single_sample">
Piotr Banskif9590692022-06-02 15:39:48 +0200288 <xsl:with-param name="text.doc" as="document-node()" select="."/>
289 <xsl:with-param name="ann_morphosyntax.doc" as="document-node()"
banspf2b24e62022-03-28 18:12:08 +0200290 select="doc($ann_morphosyntax.uri)"/>
Piotr Banski081c5de2022-06-03 01:57:13 +0200291<!-- <xsl:with-param name="ann_segmentation.xml" as="document-node()"
292 select="doc($ann_segmentation.uri)"/>-->
banspf2b24e62022-03-28 18:12:08 +0200293 <xsl:with-param name="my_textID" select="$my_textID" as="xs:string"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200294 <!-- the following parameters may happen to be null -->
Piotr Banskif9590692022-06-02 15:39:48 +0200295 <xsl:with-param name="ann_named.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200296 select="if(fn:doc-available($ann_named.uri)) then doc($ann_named.uri) else ()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200297 <xsl:with-param name="ann_groups.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200298 select="if(fn:doc-available($ann_groups.uri)) then doc($ann_groups.uri) else ()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200299 <xsl:with-param name="ann_words.doc" as="document-node()*"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200300 select="if(fn:doc-available($ann_words.uri)) then doc($ann_words.uri) else ()"/>
301
bansp9dc10002022-05-17 22:33:34 +0200302 </xsl:call-template>
banspf2b24e62022-03-28 18:12:08 +0200303 </xsl:otherwise>
304 </xsl:choose>
banspe726b4a2022-03-28 05:47:45 +0200305 </xsl:for-each>
bansp8f6700b2022-03-27 05:27:09 +0200306 </xsl:template>
307
308 <xsl:template name="process_single_sample">
Piotr Banskif9590692022-06-02 15:39:48 +0200309 <xsl:param name="text.doc" as="document-node()"/>
310 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
banspd1bf1db2022-04-04 02:16:24 +0200311 <xsl:param name="my_textID" as="xs:string" select="'0-BAD_textID'"/>
bansp9dc10002022-05-17 22:33:34 +0200312 <!-- 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 +0200313 <xsl:param name="ann_named.doc" as="document-node()*"/>
314 <xsl:param name="ann_groups.doc" as="document-node()*"/>
315 <xsl:param name="ann_words.doc" as="document-node()*"/>
banspe726b4a2022-03-28 05:47:45 +0200316
317 <xsl:variable name="targetBaseDir" as="xs:string" select="$targetCorpusDir_slashed || $docID || '/' || $my_textID"/>
318
319 <xsl:variable name="compoundID" as="xs:string"
320 select="$corpusID || '_' || $docID || '.' || $my_textID"/>
321 <!-- this is what occurs in the text and data layers as @docid -->
322
bansp5e2d1c02022-03-10 04:51:40 +0100323 <xsl:call-template name="create_data">
Piotr Banski081c5de2022-06-03 01:57:13 +0200324 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200325 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
326 <xsl:with-param name="target" select="$targetBaseDir || '/data.xml'" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100327 </xsl:call-template>
328
Piotr Banski43b9db02022-06-03 02:38:42 +0200329 <xsl:call-template name="create_struct">
banspe726b4a2022-03-28 05:47:45 +0200330 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banski43b9db02022-06-03 02:38:42 +0200331 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
bansp5f841732022-03-16 06:27:31 +0100332 as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200333 <xsl:with-param name="target" select="$targetBaseDir || '/struct/structure.xml'" as="xs:string"
bansp5f841732022-03-16 06:27:31 +0100334 />
Piotr Banski43b9db02022-06-03 02:38:42 +0200335 </xsl:call-template>
Piotr Banski92791a22022-05-26 01:41:10 +0200336
Piotr Banskiba6cc632022-06-03 14:07:33 +0200337 <xsl:call-template name="create_morpho">
banspe726b4a2022-03-28 05:47:45 +0200338 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200339 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
bansp5f841732022-03-16 06:27:31 +0100340 as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200341 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/morpho.xml'" as="xs:string"/>
Piotr Banskiba6cc632022-06-03 14:07:33 +0200342 </xsl:call-template>
Piotr Banskia51907c2022-05-25 15:09:41 +0200343
Piotr Banskid2b78b82022-06-03 17:05:59 +0200344 <xsl:call-template name="create_text_header">
Piotr Banskif9590692022-06-02 15:39:48 +0200345 <xsl:with-param name="text.doc" select="$text.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200346 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
347 <xsl:with-param name="target" select="$targetBaseDir || '/header.xml'" as="xs:string"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200348 </xsl:call-template>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200349
Piotr Banskif9590692022-06-02 15:39:48 +0200350 <xsl:if test="$ann_named.doc">
Piotr Banski763b41f2022-06-02 01:13:23 +0200351 <xsl:variable name="rev_lookup-seq" as="map(*)+">
Piotr Banskib28e5882022-06-08 20:41:20 +0200352 <xsl:for-each select="$ann_named.doc//tei:seg/tei:ptr">
353 <xsl:variable name="trg" as="xs:string" select="fn:substring-before(@target, '#')"/>
354 <!-- caution: as of 01-June-2022, some of the pointers are malformed (missing '#' when referencing locally).
Piotr Banskid2b78b82022-06-03 17:05:59 +0200355 so we need to act around it but also sustainably - in case that error gets corrected -->
Piotr Banski763b41f2022-06-02 01:13:23 +0200356
Piotr Banskib28e5882022-06-08 20:41:20 +0200357 <xsl:if test="fn:string-length($trg) and $trg eq 'ann_morphosyntax.xml'">
Piotr Banski763b41f2022-06-02 01:13:23 +0200358 <xsl:sequence>
359 <xsl:map-entry key="fn:substring-after(fn:string(@target), '#')" select="fn:current()"
360 />
361 </xsl:sequence>
Piotr Banskib28e5882022-06-08 20:41:20 +0200362 </xsl:if>
363 </xsl:for-each>
Piotr Banski763b41f2022-06-02 01:13:23 +0200364 </xsl:variable>
Piotr Banskib28e5882022-06-08 20:41:20 +0200365 <xsl:variable name="rev_lookup" as="map(*)"
366 select="map:merge($rev_lookup-seq, map {'duplicates': 'combine'})"/>
367
Piotr Banskic5950ce2022-05-27 15:07:08 +0200368 <xsl:call-template name="create_named">
369 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200370 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200371 as="document-node()"/>
Piotr Banskib28e5882022-06-08 20:41:20 +0200372 <xsl:with-param name="ann_named.doc" select="$ann_named.doc" as="document-node()"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200373 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/named.xml'" as="xs:string"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200374 <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200375 </xsl:call-template>
376 </xsl:if>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200377
Piotr Banskib28e5882022-06-08 20:41:20 +0200378<!-- <xsl:if test="$ann_words.doc and $ann_groups.doc">
Piotr Banskic5950ce2022-05-27 15:07:08 +0200379 <xsl:call-template name="create_groups">
380 <xsl:with-param name="compoundID" select="$compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200381 <xsl:with-param name="ann_morphosyntax.doc" select="$ann_morphosyntax.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200382 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200383 <xsl:with-param name="ann_words.doc" select="$ann_words.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200384 as="document-node()"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200385 <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200386 as="document-node()"/>
387 <xsl:with-param name="target" select="$targetBaseDir || '/nkjp/groups.xml'" as="xs:string"/>
388 </xsl:call-template>
Piotr Banskib28e5882022-06-08 20:41:20 +0200389 </xsl:if>-->
Piotr Banskic5950ce2022-05-27 15:07:08 +0200390
bansp5e2d1c02022-03-10 04:51:40 +0100391 </xsl:template>
392
393 <!-- ************************** data.xml ******************* -->
394
395 <xsl:template name="create_data">
Piotr Banski081c5de2022-06-03 01:57:13 +0200396 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200397 <xsl:param name="compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100398 <xsl:param name="target" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +0100399 <!-- create the data.xml file -->
400 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100401 saxon:line-length="{$line-length}"
bansp5f841732022-03-16 06:27:31 +0100402 xpath-default-namespace="{$KorAP_namespace}" href="{$target}">
bansp5e2d1c02022-03-10 04:51:40 +0100403
Akron9a8ee3e2022-01-31 13:51:49 +0100404 <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 +0100405 <xsl:element name="raw_text" namespace="{$KorAP_namespace}">
bansp5f841732022-03-16 06:27:31 +0100406 <xsl:attribute name="docid" select="$compoundID"/>
bansp5e2d1c02022-03-10 04:51:40 +0100407 <xsl:element name="metadata" namespace="{$KorAP_namespace}">
408 <xsl:attribute name="file" select="'metadata.xml'"/>
409 </xsl:element>
410
411 <xsl:element name="text" namespace="{$KorAP_namespace}">
bansp9dc10002022-05-17 22:33:34 +0200412 <xsl:variable name="content" as="xs:string+">
Piotr Banski081c5de2022-06-03 01:57:13 +0200413 <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 +0200414 <xsl:sequence select="
Piotr Banskifdc858a2022-05-25 02:40:32 +0200415 if (f:is_preceded_by_ws(.,false())) then
bansp9dc10002022-05-17 22:33:34 +0200416 ' '
417 else
Piotr Banski081c5de2022-06-03 01:57:13 +0200418 '', ./tei:fs/tei:f[@name eq 'orth']/tei:string"/>
bansp9dc10002022-05-17 22:33:34 +0200419 </xsl:for-each>
420 </xsl:variable>
421 <xsl:value-of select="string-join($content)"/>
bansp5e2d1c02022-03-10 04:51:40 +0100422 </xsl:element>
Akron9a8ee3e2022-01-31 13:51:49 +0100423 </xsl:element>
banspf79443e2022-02-25 14:25:33 +0100424 </xsl:result-document>
Akron9a8ee3e2022-01-31 13:51:49 +0100425 </xsl:template>
426
bansp5f841732022-03-16 06:27:31 +0100427 <!-- ************************** struct ******************* -->
428
429 <xsl:template name="create_struct">
banspe726b4a2022-03-28 05:47:45 +0200430 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banski43b9db02022-06-03 02:38:42 +0200431 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
bansp5f841732022-03-16 06:27:31 +0100432 <xsl:param name="target" as="xs:string"/>
Piotr Banski4f4c2d22022-05-19 01:44:32 +0200433
bansp5f841732022-03-16 06:27:31 +0100434 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100435 saxon:line-length="{$line-length}"
bansp5f841732022-03-16 06:27:31 +0100436 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
437 <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>
438 <xsl:element name="layer" namespace="{$KorAP_namespace}">
439 <xsl:attribute name="docid" select="$compoundID"/>
440 <xsl:attribute name="version" select="$KorAP-XML_version"/>
441
442 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banski43b9db02022-06-03 02:38:42 +0200443 <xsl:apply-templates select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text" mode="struct"/>
bansp5f841732022-03-16 06:27:31 +0100444 </xsl:element>
445 </xsl:element>
446 </xsl:result-document>
447 </xsl:template>
448
Piotr Banski43b9db02022-06-03 02:38:42 +0200449 <xsl:template match="tei:text | tei:body | tei:p | tei:s | tei:seg[tei:fs/tei:f[@name eq 'disamb']]" mode="struct">
Piotr Banski09096ee2022-05-25 13:41:03 +0200450 <xsl:variable name="offsets" as="xs:integer+">
Piotr Banski43b9db02022-06-03 02:38:42 +0200451 <xsl:sequence select="map:get(fn:accumulator-after('morpho-offsets')[last()], string(@xml:id))"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200452 </xsl:variable>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200453
bansp5f841732022-03-16 06:27:31 +0100454 <xsl:variable name="my_name" select="local-name()" as="xs:string"/>
Piotr Banskie1ac5202022-05-30 21:25:21 +0200455 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
bansp3e5b20c2022-03-18 20:22:31 +0100456
bansp5f841732022-03-16 06:27:31 +0100457 <xsl:element name="span" namespace="{$KorAP_namespace}">
458 <xsl:attribute name="id" select="'s' || $my_index"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200459 <xsl:attribute name="from" select="$offsets[1]"/>
460 <xsl:attribute name="to" select="$offsets[2]"/>
bansp5f841732022-03-16 06:27:31 +0100461 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200462 <xsl:if test="local-name() eq 'seg' and $SHOW_ORTH_IN_STRUCT">
Piotr Banskid2b78b82022-06-03 17:05:59 +0200463 <xsl:comment select="
464 (if (tei:fs/tei:f[@name eq 'nps']) then
465 ' '
466 else
467 ' _') || tei:fs/tei:f[@name eq 'orth']/tei:string"/>
Piotr Banski09096ee2022-05-25 13:41:03 +0200468 </xsl:if>
bansp5f841732022-03-16 06:27:31 +0100469 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
Piotr Banskifdc858a2022-05-25 02:40:32 +0200470 <xsl:attribute name="type" select="'struct'"></xsl:attribute> <!-- STRUCT vs. LEX for morpho -->
bansp5f841732022-03-16 06:27:31 +0100471 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
bansp3e5b20c2022-03-18 20:22:31 +0100472 <xsl:attribute name="name" select="'name'"/>
473 <xsl:value-of select="local-name()"/>
bansp5f841732022-03-16 06:27:31 +0100474 </xsl:element>
475 <xsl:if test="count(@*)">
476 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
477 <xsl:attribute name="name" select="'attr'"/>
478 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
479 <xsl:attribute name="type" select="'attr'"/>
480 <xsl:for-each select="@*">
481 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
482 <xsl:attribute name="name" select="local-name(.)"/>
483 <xsl:value-of select="."/>
484 </xsl:element>
485 </xsl:for-each>
486 </xsl:element>
487 </xsl:element>
488 </xsl:if>
489 </xsl:element>
490 </xsl:element>
Piotr Banskia51907c2022-05-25 15:09:41 +0200491 <xsl:apply-templates mode="struct"/>
bansp5f841732022-03-16 06:27:31 +0100492 </xsl:template>
493
494 <!-- ************************** morpho ******************* -->
495
496 <xsl:template name="create_morpho">
banspe726b4a2022-03-28 05:47:45 +0200497 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200498 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
bansp5f841732022-03-16 06:27:31 +0100499 <xsl:param name="target" as="xs:string"/>
500
501 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100502 saxon:line-length="{$line-length}"
bansp5f841732022-03-16 06:27:31 +0100503 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
504 <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 +0100505 <xsl:element name="layer" namespace="{$KorAP_namespace}">
506 <xsl:attribute name="docid" select="$compoundID"/>
507 <xsl:attribute name="version" select="$KorAP-XML_version"/>
508
509 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banskid2b78b82022-06-03 17:05:59 +0200510 <xsl:apply-templates select="$ann_morphosyntax.doc/tei:teiCorpus/tei:TEI/tei:text/tei:body/tei:p/tei:s/tei:seg" mode="morpho"/>
bansp3e5b20c2022-03-18 20:22:31 +0100511 </xsl:element>
512 </xsl:element>
bansp5f841732022-03-16 06:27:31 +0100513 </xsl:result-document>
514 </xsl:template>
515
Piotr Banskiba6cc632022-06-03 14:07:33 +0200516 <xsl:template match="tei:seg[tei:fs/tei:f[@name eq 'disamb']]" mode="morpho">
517
Piotr Banskia51907c2022-05-25 15:09:41 +0200518 <!-- it's so spread out because I wanted to make sure to be able to look up the individual
519 constituent values, should anything go wrong; it might get compacted at some point, but
520 the increase in efficiency will probably be minimal, compared to the decrease of readability -->
521 <xsl:variable name="offsets" as="xs:integer+">
Piotr Banskiba6cc632022-06-03 14:07:33 +0200522 <xsl:sequence select="map:get(fn:accumulator-after('morpho-offsets')[last()], string(@xml:id))"/>
Piotr Banskia51907c2022-05-25 15:09:41 +0200523 </xsl:variable>
Piotr Banskiba6cc632022-06-03 14:07:33 +0200524
Piotr Banskiba6cc632022-06-03 14:07:33 +0200525 <xsl:variable name="my_disamb" select="tei:fs/tei:f[@name eq 'disamb']" as="node()"/>
bansp3e5b20c2022-03-18 20:22:31 +0100526 <xsl:variable name="my_choice-id" select="substring-after($my_disamb//tei:f[@name eq 'choice']/@fVal,'#')" as="xs:string"/>
Piotr Banskiba6cc632022-06-03 14:07:33 +0200527 <xsl:variable name="my_choice-lex" select="tei:fs/tei:f[@name eq 'interps']/tei:fs[@type eq 'lex'][descendant::tei:symbol[@xml:id eq $my_choice-id]]" as="node()"/>
bansp3e5b20c2022-03-18 20:22:31 +0100528 <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 +0200529 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
bansp3e5b20c2022-03-18 20:22:31 +0100530
bansp3e5b20c2022-03-18 20:22:31 +0100531 <xsl:element name="span" namespace="{$KorAP_namespace}">
Piotr Banskia51907c2022-05-25 15:09:41 +0200532 <xsl:attribute name="id" select="'m' || $my_index"/>
533 <xsl:attribute name="from" select="$offsets[1]"/>
534 <xsl:attribute name="to" select="$offsets[2]"/>
bansp3e5b20c2022-03-18 20:22:31 +0100535 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
536 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
537 <xsl:attribute name="type" select="'lex'"/>
538 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
539 <xsl:attribute name="name" select="'lex'"/>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200540 <xsl:if test="$SHOW_REDUNDANT_ORTH">
541 <xsl:comment select="
Piotr Banskiba6cc632022-06-03 14:07:33 +0200542 (if (tei:fs/tei:f[@name eq 'nps']) then
543 ' '
544 else
545 ' _') || tei:fs/tei:f[@name eq 'orth']/tei:string"/>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200546 </xsl:if>
bansp3e5b20c2022-03-18 20:22:31 +0100547 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
bansp3e5b20c2022-03-18 20:22:31 +0100548 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
Piotr Banskia44cd7a2022-06-03 19:19:50 +0200549 <xsl:attribute name="name" select="'orig'"/>
550 <xsl:value-of select="tei:fs/tei:f[@name eq 'orth']/tei:string"/>
551 </xsl:element>
552 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
bansp3e5b20c2022-03-18 20:22:31 +0100553 <xsl:attribute name="name" select="'lemma'"/>
554 <xsl:value-of select="$my_choice-lex/tei:f[@name eq 'base']/tei:string"/>
555 </xsl:element>
556 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
557 <xsl:attribute name="name" select="'pos'"/>
558 <xsl:value-of select="$my_choice-lex/tei:f[@name eq 'ctag']/tei:symbol/@value"/>
559 </xsl:element>
560 <xsl:if test="string-length($chosen-msd)">
561 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
562 <xsl:attribute name="name" select="'msd'"/>
563 <xsl:value-of select="$chosen-msd"/>
564 </xsl:element>
565 </xsl:if>
Piotr Banskiba6cc632022-06-03 14:07:33 +0200566 <xsl:if test="tei:fs/tei:f[@name eq 'nps']">
bansp3e5b20c2022-03-18 20:22:31 +0100567 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
568 <xsl:attribute name="name" select="'join'"/>
569 <xsl:value-of select="'left'"/>
570 </xsl:element>
571 </xsl:if>
572 </xsl:element>
573 </xsl:element>
Piotr Banskia44cd7a2022-06-03 19:19:50 +0200574 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
575 <xsl:attribute name="name" select="'interps'"/>
576 <xsl:for-each select="tei:fs/tei:f[@name eq 'interps']/tei:fs">
577 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
578 <xsl:attribute name="type" select="'alt'"/>
579 <xsl:if test="tei:f[@name eq 'msd']//tei:symbol/@xml:id = $my_choice-id">
580 <xsl:attribute name="n" select="'choice'"/>
581 </xsl:if>
582 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
583 <xsl:attribute name="name" select="'lemma'"/>
584 <xsl:value-of select="tei:f[@name eq 'base']/tei:string"/>
585 </xsl:element>
586 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
587 <xsl:attribute name="name" select="'pos'"/>
588 <xsl:value-of select="tei:f[@name eq 'ctag']/tei:symbol/@value"/>
589 </xsl:element>
590 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
591 <xsl:attribute name="name" select="'msd'"/>
592 <xsl:apply-templates select="tei:f[@name eq 'msd']/*" mode="inside-interps">
593 <xsl:with-param name="choice" select="$my_choice-id" as="xs:string" tunnel="yes"/>
594 </xsl:apply-templates>
595 </xsl:element>
596 </xsl:element>
597 </xsl:for-each>
598 </xsl:element>
bansp3e5b20c2022-03-18 20:22:31 +0100599 </xsl:element>
600 </xsl:element>
bansp3e5b20c2022-03-18 20:22:31 +0100601 </xsl:template>
banspe726b4a2022-03-28 05:47:45 +0200602
Piotr Banskia44cd7a2022-06-03 19:19:50 +0200603 <xsl:template match="tei:vAlt" mode="inside-interps">
604 <xsl:copy select="." copy-namespaces="no">
605 <xsl:apply-templates mode="inside-interps" select="*"/>
606 </xsl:copy>
607 </xsl:template>
608
609 <xsl:template match="tei:symbol" mode="inside-interps">
610 <xsl:param name="choice" as="xs:string" tunnel="yes"/>
611 <xsl:copy select="." copy-namespaces="no">
612 <xsl:attribute name="value" select="
613 if (@value eq '') then
614 0
615 else
616 @value"/>
617<!-- the check above is to appease the validator, which won't allow for empty values of @value -->
618 <xsl:if test="@xml:id eq $choice">
619 <xsl:attribute name="n" select="'choice'"/>
620 </xsl:if>
621 </xsl:copy>
622 </xsl:template>
623
Piotr Banskic5950ce2022-05-27 15:07:08 +0200624 <!-- ************************** named entities ******************* -->
625
626 <xsl:template name="create_named">
627 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200628 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
629 <xsl:param name="ann_named.doc" as="document-node()"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200630 <xsl:param name="target" as="xs:string"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200631 <xsl:param name="rev_lookup" as="map(*)"/>
632
Piotr Banskic5950ce2022-05-27 15:07:08 +0200633 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100634 saxon:line-length="{$line-length}"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200635 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
636 <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>
637 <xsl:element name="layer" namespace="{$KorAP_namespace}">
638 <xsl:attribute name="docid" select="$compoundID"/>
639 <xsl:attribute name="version" select="$KorAP-XML_version"/>
640
641 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banskif9590692022-06-02 15:39:48 +0200642 <xsl:apply-templates select="$ann_morphosyntax.doc//tei:text" mode="named">
643 <xsl:with-param name="ann_named.doc" select="$ann_named.doc" as="document-node()" tunnel="yes"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200644 <xsl:with-param name="rev_lookup" select="$rev_lookup" as="map(*)" tunnel="yes"/>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200645 </xsl:apply-templates>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200646 </xsl:element>
647 </xsl:element>
648 </xsl:result-document>
649 </xsl:template>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200650
651 <xsl:template match="tei:seg" mode="named"/>
652
653 <xsl:template match="tei:seg[tei:fs[tei:f[@name eq 'disamb']]]" mode="named">
Piotr Banskif9590692022-06-02 15:39:48 +0200654 <xsl:param name="ann_named.doc" as="document-node()" tunnel="yes"/>
Piotr Banski763b41f2022-06-02 01:13:23 +0200655 <xsl:param name="rev_lookup" as="map(*)" tunnel="yes"/>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200656
657 <xsl:variable name="offsets" as="xs:integer+">
658 <xsl:sequence select="map:get(fn:accumulator-after('morpho-offsets')[last()], string(@xml:id))"/>
659 </xsl:variable>
660
Piotr Banski763b41f2022-06-02 01:13:23 +0200661 <xsl:variable name="ptr" select="map:get($rev_lookup,fn:string(@xml:id))" as="element(tei:ptr)*"/>
662 <!-- it's an element, because we need to see where it stands in a sequence... -->
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200663
Piotr Banski763b41f2022-06-02 01:13:23 +0200664 <xsl:if test="$ptr">
665 <xsl:variable name="my_id" select="@xml:id" as="xs:string"/>
666 <xsl:variable name="my_index" select="fn:accumulator-before('element-index')" as="xs:integer"/>
667
668 <xsl:element name="span" namespace="{$KorAP_namespace}">
669 <xsl:attribute name="id" select="'n' || $my_index"/>
670 <xsl:attribute name="from" select="$offsets[1]"/>
671 <xsl:attribute name="to" select="$offsets[2]"/>
672 <xsl:attribute name="l" select="f:compute_nesting(.)"/>
673 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
674 <xsl:attribute name="type" select="'ne'"/>
675 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
676 <xsl:attribute name="name" select="'ne'"/>
Piotr Banskid2b78b82022-06-03 17:05:59 +0200677 <xsl:if test="$SHOW_REDUNDANT_ORTH">
678 <xsl:comment select="
679 (if (tei:fs/tei:f[@name eq 'nps']) then
680 ' '
681 else
682 ' _') || tei:fs/tei:f[@name eq 'orth']/tei:string"/>
683 </xsl:if>
Piotr Banski763b41f2022-06-02 01:13:23 +0200684 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
685 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
686 <xsl:attribute name="name" select="'complex-ent'"/>
687 <xsl:for-each select="$ptr">
688 <xsl:element name="fs" namespace="http://www.tei-c.org/ns/1.0">
689 <xsl:attribute name="type" select="'complex-ent'"/>
690 <xsl:for-each select="parent::tei:seg/tei:fs[1]/tei:f">
691 <xsl:if test="@name eq 'type' or @name eq 'subtype'">
692 <xsl:copy-of select="." copy-namespaces="no"/>
693 </xsl:if>
694 </xsl:for-each>
695 <xsl:element name="f" namespace="http://www.tei-c.org/ns/1.0">
696 <xsl:attribute name="name" select="'nkjp-named'"/>
697 <xsl:copy-of select="parent::tei:seg/tei:fs[1]" copy-namespaces="no"/>
698 </xsl:element>
699 </xsl:element>
700 </xsl:for-each>
701
702 </xsl:element>
703
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200704 </xsl:element>
705 </xsl:element>
706 </xsl:element>
707 </xsl:element>
Piotr Banski763b41f2022-06-02 01:13:23 +0200708 </xsl:if>
Piotr Banski65a6d0b2022-05-31 17:23:08 +0200709 </xsl:template>
710
Piotr Banskic5950ce2022-05-27 15:07:08 +0200711
712 <!-- ************************** syntactic chunks ******************* -->
713
714 <xsl:template name="create_groups">
715 <xsl:param name="compoundID" as="xs:string"/>
Piotr Banskif9590692022-06-02 15:39:48 +0200716 <xsl:param name="ann_morphosyntax.doc" as="document-node()"/>
717 <xsl:param name="ann_words.doc" as="document-node()"/>
718 <xsl:param name="ann_groups.doc" as="document-node()"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200719 <xsl:param name="target" as="xs:string"/>
720
721 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100722 saxon:line-length="{$line-length}"
Piotr Banskic5950ce2022-05-27 15:07:08 +0200723 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
724 <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>
725 <xsl:element name="layer" namespace="{$KorAP_namespace}">
726 <xsl:attribute name="docid" select="$compoundID"/>
727 <xsl:attribute name="version" select="$KorAP-XML_version"/>
728
729 <xsl:element name="spanList" namespace="{$KorAP_namespace}">
Piotr Banskid2b78b82022-06-03 17:05:59 +0200730 <!--<xsl:apply-templates select="$ann_morphosyntax.doc//tei:text" mode="groups">
Piotr Banskif9590692022-06-02 15:39:48 +0200731 <xsl:with-param name="ann_words.doc" select="$ann_words.doc" as="document-node()" tunnel="yes"/>
732 <xsl:with-param name="ann_groups.doc" select="$ann_groups.doc" as="document-node()" tunnel="yes"/>
Piotr Banskic5950ce2022-05-27 15:07:08 +0200733 </xsl:apply-templates>-->
734 </xsl:element>
735 </xsl:element>
736 </xsl:result-document>
737 </xsl:template>
738
bansp5f841732022-03-16 06:27:31 +0100739 <!-- ************************** TEXT header ******************* -->
740
741 <xsl:template name="create_text_header">
Piotr Banskif9590692022-06-02 15:39:48 +0200742 <xsl:param name="text.doc" as="document-node()"/>
banspe726b4a2022-03-28 05:47:45 +0200743 <xsl:param name="compoundID" as="xs:string"/>
bansp5f841732022-03-16 06:27:31 +0100744 <xsl:param name="target" as="xs:string"/>
745
746 <!-- create the local header.xml file -->
747 <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100748 saxon:line-length="{$line-length}"
bansp5f841732022-03-16 06:27:31 +0100749 xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" href="{$target}">
750
751 <idsHeader type="document" pattern="text" status="new" version="1.1" TEIform="teiHeader">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200752 <xsl:apply-templates select="$text.doc//tei:TEI/tei:teiHeader/tei:*" mode="text-header">
banspe726b4a2022-03-28 05:47:45 +0200753 <xsl:with-param name="compoundID" as="xs:string" select="$compoundID" tunnel="yes"/>
754 </xsl:apply-templates>
bansp5f841732022-03-16 06:27:31 +0100755 </idsHeader>
756 </xsl:result-document>
757 </xsl:template>
758
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200759 <xsl:template match="tei:fileDesc" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100760 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200761 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100762 </xsl:element>
bansp5f841732022-03-16 06:27:31 +0100763 </xsl:template>
764
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200765 <xsl:template match="tei:title" mode="text-header">
bansp5f841732022-03-16 06:27:31 +0100766 <t.title>
767 <xsl:apply-templates/>
768 </t.title>
769 </xsl:template>
770
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200771 <xsl:template match="tei:titleStmt" mode="text-header">
banspe726b4a2022-03-28 05:47:45 +0200772 <xsl:param name="compoundID" as="xs:string" tunnel="yes"/>
bansp5f841732022-03-16 06:27:31 +0100773 <titleStmt>
774 <textSigle>
banspe726b4a2022-03-28 05:47:45 +0200775 <xsl:value-of select="$compoundID"/>
bansp5f841732022-03-16 06:27:31 +0100776 </textSigle>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200777 <xsl:apply-templates mode="text-header"/>
bansp5f841732022-03-16 06:27:31 +0100778 </titleStmt>
779 </xsl:template>
780
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200781 <xsl:template match="tei:publicationStmt" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100782 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200783 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100784 </xsl:element>
785 </xsl:template>
786
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200787 <xsl:template match="tei:availability" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100788 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200789 <xsl:apply-templates mode="text-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100790 </xsl:element>
791 </xsl:template>
792
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200793 <xsl:template match="tei:profileDesc" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100794 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200795 <xsl:apply-templates mode="text-header"/>
bansp9103aab2022-03-19 05:10:21 +0100796 </xsl:element>
797 </xsl:template>
bansp5f841732022-03-16 06:27:31 +0100798
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200799 <xsl:template match="tei:textClass" mode="text-header">
bansp9103aab2022-03-19 05:10:21 +0100800 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200801 <xsl:apply-templates mode="text-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100802 </xsl:element>
803 </xsl:template>
804
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200805 <xsl:template match="tei:catRef" mode="text-header corpus-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" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100808 </xsl:element>
809 </xsl:template>
810
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200811 <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 +0100812 <xsl:copy-of select="."/>
813 </xsl:template>
814
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200815 <xsl:template match="tei:p" mode="text-header corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100816 <xsl:element name="{local-name()}">
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200817 <xsl:apply-templates mode="text_inside_header"/>
bansp9103aab2022-03-19 05:10:21 +0100818 </xsl:element>
819 </xsl:template>
820
821
822 <!-- OPTIMIZATION has to take modes into account -->
bansp5e2d1c02022-03-10 04:51:40 +0100823 <!-- ************************** CORPUS header ******************* -->
824 <xsl:template name="create_corpus_header">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200825 <xsl:param name="text.doc" as="document-node()"/>
bansp5f841732022-03-16 06:27:31 +0100826 <xsl:param name="target" as="xs:string"/>
bansp5e2d1c02022-03-10 04:51:40 +0100827
828 <!-- create the corpus-level header.xml file -->
Marc Kupietz9a943ad2022-12-15 17:26:49 +0100829 <xsl:result-document encoding="UTF-8" method="xml" indent="yes" saxon:line-length="{$line-length}" href="{$target}">
bansp5e2d1c02022-03-10 04:51:40 +0100830
831 <!--doctype-public="{$publicDoctypeI5}"
832 doctype-system="{$systemDoctypeI5}">
833 these are, sadly, useless
834 -->
835
836 <idsHeader type="corpus" pattern="text" status="new" version="1.1" TEIform="teiHeader">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200837 <xsl:apply-templates select="$text.doc/tei:teiCorpus/tei:teiHeader/tei:*" mode="corpus-header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100838 </idsHeader>
839 </xsl:result-document>
840 </xsl:template>
841
Piotr Banskifaa910f2022-06-03 00:46:29 +0200842 <xsl:template match="tei:fileDesc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100843 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200844 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100845 </xsl:element>
bansp5e2d1c02022-03-10 04:51:40 +0100846 </xsl:template>
bansp9103aab2022-03-19 05:10:21 +0100847
bansp5e2d1c02022-03-10 04:51:40 +0100848
Piotr Banskifaa910f2022-06-03 00:46:29 +0200849 <xsl:template match="tei:title" mode="corpus-header">
bansp5e2d1c02022-03-10 04:51:40 +0100850 <c.title>
Piotr Banskifaa910f2022-06-03 00:46:29 +0200851 <xsl:apply-templates mode="corpus-header" select="@*"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200852 <xsl:apply-templates mode="text_inside_header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100853 </c.title>
854 </xsl:template>
855
Piotr Banskifaa910f2022-06-03 00:46:29 +0200856 <xsl:template match="tei:titleStmt" mode="corpus-header">
bansp5e2d1c02022-03-10 04:51:40 +0100857 <titleStmt>
858 <korpusSigle>
859 <xsl:value-of select="$corpusID"/>
860 </korpusSigle>
Piotr Banskifaa910f2022-06-03 00:46:29 +0200861 <xsl:apply-templates mode="corpus-header"/>
bansp5e2d1c02022-03-10 04:51:40 +0100862 </titleStmt>
863 </xsl:template>
864
Piotr Banskifaa910f2022-06-03 00:46:29 +0200865 <xsl:template match="tei:publicationStmt" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100866 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200867 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100868 </xsl:element>
869 </xsl:template>
870
Piotr Banskifaa910f2022-06-03 00:46:29 +0200871 <xsl:template match="tei:availability" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100872 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200873 <xsl:apply-templates mode="corpus-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100874 </xsl:element>
875 </xsl:template>
876
Piotr Banskifaa910f2022-06-03 00:46:29 +0200877 <xsl:template match="tei:encodingDesc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100878 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200879 <xsl:apply-templates mode="corpus-header"/>
bansp9103aab2022-03-19 05:10:21 +0100880 </xsl:element>
881 </xsl:template>
882
Piotr Banskifaa910f2022-06-03 00:46:29 +0200883 <xsl:template match="tei:classDecl | tei:taxonomy | tei:category | tei:taxonomy/tei:bibl" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100884 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200885 <xsl:apply-templates mode="corpus-header" select="@* | *"/>
bansp9103aab2022-03-19 05:10:21 +0100886 </xsl:element>
887 </xsl:template>
888
Piotr Banskifaa910f2022-06-03 00:46:29 +0200889 <xsl:template match="tei:bibl/tei:title | tei:edition | tei:desc" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100890 <xsl:element name="{local-name()}">
Piotr Banskifaa910f2022-06-03 00:46:29 +0200891 <xsl:apply-templates mode="corpus-header" select="@*"/>
Piotr Banskia0a9fc02022-06-03 01:20:18 +0200892 <xsl:apply-templates mode="text_inside_header"/>
bansp9103aab2022-03-19 05:10:21 +0100893 </xsl:element>
894 </xsl:template>
895<!--
Piotr Banskifaa910f2022-06-03 00:46:29 +0200896 <xsl:template match="tei:textClass" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100897 <xsl:element name="{local-name()}">
898 <xsl:apply-templates mode="corpus" select="@* | *"/>
899 </xsl:element>
900 </xsl:template>
901
Piotr Banskifaa910f2022-06-03 00:46:29 +0200902 <xsl:template match="tei:catRef" mode="corpus-header">
bansp9103aab2022-03-19 05:10:21 +0100903 <xsl:element name="{local-name()}">
904 <xsl:apply-templates mode="corpus" select="@* | *"/>
905 </xsl:element>
906 </xsl:template>
907-->
bansp5e2d1c02022-03-10 04:51:40 +0100908
909
910
911 <!-- this template can be called by the XSPEC test; TODO: find a way to call the main() template directly -->
912 <!-- I have not fully handled the param transmission, which would have to be kludged in just for the sake of XSPec,
913 because I'm disabling this for now, due to XSpec design issues; relevant links, a.o.:
914
915 https://stackoverflow.com/questions/64933277/what-is-the-cause-of-error-cannot-execute-xslresult-document-while-evaluating
916 https://www.balisage.net/Proceedings/vol25/html/Galtman01/BalisageVol25-Galtman01.html
917
918 In short: the internal design of XSpec forces kludges when one wants to use xsl:result-document in their stylesheets. But I don't
919 want to be strangled by kludges at the beginning of work, I've already lost quite a bit of time on this investigation,
920 I will therefore "just code" and then can think of externalizing bits of templates if we want to play with tests. For now,
921 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.
922
923 -->
924 <!--<xsl:template name="test_full">
925 <xsl:param name="corpusID"/>
926 <xsl:param name="docID"/>
927 <xsl:param name="textID"/>
928 <xsl:call-template name="xsl:initial-template"/>
929 </xsl:template>-->
930
Akron9a8ee3e2022-01-31 13:51:49 +0100931</xsl:stylesheet>
Piotr Banski6a4a2522022-05-24 01:16:47 +0200932
Piotr Banskifdc858a2022-05-25 02:40:32 +0200933<!-- template for serializing maps in messages <xsl:message select="('map:',serialize($map, map{'method':'adaptive'}))"/> -->