]> Lady’s Gitweb - LesML/blob - parser.xslt
Support attributes
[LesML] / parser.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ 💄📝 Les·M·L ∷ parser.xslt
8
9 © 2024–2025 Lady [@ Ladys Computer]
10
11 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
12 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
13 -->
14 <!DOCTYPE transform [
15 <!ENTITY LesML "urn:fdc:ladys.computer:20240512:LesML">
16 <!ENTITY section-break "*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~">
17 <!ENTITY sigiled-text "(string-length($text)=1 or substring($text, 2, 1)=' ')">
18 <!ENTITY unsigiled-text "substring($text, 3, string-length($text)-2)">
19 <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
20 ]>
21 <transform
22 xmlns="http://www.w3.org/1999/XSL/Transform"
23 xmlns:LesML="urn:fdc:ladys.computer:20240512:LesML"
24 xmlns:exsl="http://exslt.org/common"
25 xmlns:exsldyn="http://exslt.org/dynamic"
26 xmlns:exslset="http://exslt.org/sets"
27 xmlns:exslstr="http://exslt.org/strings"
28 xmlns:html="http://www.w3.org/1999/xhtml"
29 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
30 exclude-result-prefixes="LesML"
31 extension-element-prefixes="exsl exsldyn exslset exslstr"
32 version="1.0"
33 >
34 <书社:id>urn:fdc:ladys.computer:20240512:LesML:parser.xslt</书社:id>
35 <template name="LesML:split">
36 <param name="source"/>
37 <param name="separator" select="'&#xA;'"/>
38 <choose>
39 <when test="contains($source, $separator)">
40 <html:span>
41 <value-of select="substring-before($source, $separator)"/>
42 </html:span>
43 <call-template name="LesML:split">
44 <with-param name="source" select="substring-after($source, $separator)"/>
45 <with-param name="separator" select="$separator"/>
46 </call-template>
47 </when>
48 <otherwise>
49 <html:span>
50 <value-of select="$source"/>
51 </html:span>
52 </otherwise>
53 </choose>
54 </template>
55 <template name="LesML:break-and-unescape">
56 <param name="source"/>
57 <variable name="broken-fragment">
58 <call-template name="LesML:split">
59 <with-param name="source" select="$source"/>
60 <with-param name="separator" select="'&#xA;'"/>
61 </call-template>
62 </variable>
63 <variable name="broken" select="exsl:node-set($broken-fragment)/node()"/>
64 <for-each select="$broken">
65 <call-template name="LesML:unescape">
66 <with-param name="source" select="string()"/>
67 </call-template>
68 <if test="position()!=count($broken)">
69 <element name="br" namespace="&xhtml;"/>
70 </if>
71 </for-each>
72 </template>
73 <template name="LesML:unescape">
74 <param name="source"/>
75 <choose>
76 <when test="contains($source, '{U+')">
77 <variable name="after" select="substring-after($source, '{U+')"/>
78 <choose>
79 <when test="contains($after, '}')">
80 <variable name="inner" select="substring-before($after, '}')"/>
81 <variable name="components">
82 <call-template name="LesML:split">
83 <with-param name="source" select="$inner"/>
84 <with-param name="separator" select="'.'"/>
85 </call-template>
86 </variable>
87 <variable name="component-nodes" select="exsl:node-set($components)/node()"/>
88 <value-of select="substring-before($source, '{U+')"/>
89 <choose>
90 <when test="$component-nodes[string(.)='' or translate(., '0123456789ABCDEF', '')!='']">
91 <text>{U+</text>
92 <value-of select="$inner"/>
93 <text>}</text>
94 <call-template name="LesML:unescape">
95 <with-param name="source" select="substring-after($after, '}')"/>
96 </call-template>
97 </when>
98 <otherwise>
99 <for-each select="$component-nodes">
100 <text disable-output-escaping="yes">&amp;#x</text>
101 <value-of select="."/>
102 <text>;</text>
103 </for-each>
104 <call-template name="LesML:unescape">
105 <with-param name="source" select="substring-after($after, '}')"/>
106 </call-template>
107 </otherwise>
108 </choose>
109 </when>
110 <otherwise>
111 <value-of select="substring-before($source, '{U+')"/>
112 <text>{U+</text>
113 <call-template name="LesML:unescape">
114 <with-param name="source" select="$after"/>
115 </call-template>
116 </otherwise>
117 </choose>
118 </when>
119 <otherwise>
120 <value-of select="$source"/>
121 </otherwise>
122 </choose>
123 </template>
124 <template name="LesML:id-and-contents">
125 <param name="source"/>
126 <choose>
127 <when test="starts-with($source, '¶')">
128 <choose>
129 <when test="contains($source, ' ')">
130 <variable name="id" select="substring-before(substring-after($source, '¶'), ' ')"/>
131 <if test="$id!=''">
132 <attribute name="id">
133 <value-of select="$id"/>
134 </attribute>
135 </if>
136 <value-of select="substring-after($source, ' ')"/>
137 </when>
138 <otherwise>
139 <attribute name="id">
140 <value-of select="substring-after($source, '¶')"/>
141 </attribute>
142 </otherwise>
143 </choose>
144 </when>
145 <otherwise>
146 <value-of select="$source"/>
147 </otherwise>
148 </choose>
149 </template>
150 <template name="LesML:parse">
151 <param name="lines" select="/.."/>
152 <param name="parent-params" select="/.."/>
153 <variable name="first-line" select="$lines[1]"/>
154 <variable name="shebang">
155 <if test="starts-with($first-line, '#!lesml')">
156 <value-of select="$first-line"/>
157 </if>
158 </variable>
159 <variable name="params-string">
160 <choose>
161 <when test="starts-with($shebang, '#!lesml@')">
162 <value-of select="substring-after($shebang, '$')"/>
163 </when>
164 <otherwise>
165 <value-of select="substring-after($shebang, '#!lesml')"/>
166 </otherwise>
167 </choose>
168 </variable>
169 <variable name="params-fragment">
170 <choose>
171 <when test="$shebang!=''">
172 <html:dl>
173 <if test="starts-with($shebang, '#!lesml@') and contains($shebang, '$')">
174 <html:div>
175 <html:dt>
176 <text> LANG </text>
177 </html:dt>
178 <html:dd>
179 <value-of select="substring-before(substring-after($shebang, '#!lesml@'), '$')"/>
180 </html:dd>
181 </html:div>
182 </if>
183 <for-each select="exslstr:tokenize($params-string)">
184 <choose>
185 <when test="contains(., '=')">
186 <html:div>
187 <html:dt>
188 <value-of select="substring-before(., '=')"/>
189 </html:dt>
190 <html:dd>
191 <value-of select="substring-after(., '=')"/>
192 </html:dd>
193 </html:div>
194 </when>
195 <otherwise>
196 <html:div>
197 <html:dt>
198 <value-of select="."/>
199 </html:dt>
200 <html:dd/>
201 </html:div>
202 </otherwise>
203 </choose>
204 </for-each>
205 </html:dl>
206 </when>
207 <when test="$parent-params">
208 <copy-of select="$parent-params"/>
209 </when>
210 <otherwise>
211 <html:dl/>
212 </otherwise>
213 </choose>
214 </variable>
215 <variable name="params" select="exsl:node-set($params-fragment)/*"/>
216 <variable name="noshebang" select="$lines[position()>1 or not(starts-with(., '#!lesml') or starts-with(., '##'))]"/>
217 <variable name="docsep" select="$noshebang[starts-with(., '#!lesml') or starts-with(., '##')][1]"/>
218 <variable name="doclines" select="exslset:leading($noshebang, $docsep)"/>
219 <if test="starts-with($first-line, '##') and $first-line!='##'">
220 <comment>
221 <value-of select="substring-after($first-line, '##')"/>
222 </comment>
223 </if>
224 <if test="$doclines[normalize-space()!='']">
225 <variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
226 <element name="article" namespace="&xhtml;">
227 <for-each select="$params/html:div/html:dt[string()=' LANG ']">
228 <attribute name="lang">
229 <value-of select="following-sibling::html:dd"/>
230 </attribute>
231 <attribute name="xml:lang">
232 <value-of select="following-sibling::html:dd"/>
233 </attribute>
234 </for-each>
235 <for-each select="$params/html:div/html:dt[string()='profile']">
236 <attribute name="data-lesml-profile">
237 <value-of select="following-sibling::html:dd"/>
238 </attribute>
239 </for-each>
240 <if test="$record-separators[preceding-sibling::*[normalize-space()!='']]">
241 <element name="footer" namespace="&xhtml;">
242 <attribute name="class">
243 <text>head</text>
244 </attribute>
245 <for-each select="$record-separators">
246 <variable name="position" select="position()"/>
247 <variable name="prev-separator" select="$record-separators[($position)-1]"/>
248 <variable name="fields" select="exslset:leading(exslset:trailing($doclines, $prev-separator), .)"/>
249 <if test="$fields">
250 <element name="dl" namespace="&xhtml;">
251 <for-each select="$fields">
252 <choose>
253 <when test="starts-with(., ' ') and exslset:leading($fields, .)"/>
254 <otherwise>
255 <variable name="next" select="exslset:intersection(following-sibling::*[not(starts-with(., ' '))][1], $fields)"/>
256 <element name="div" namespace="&xhtml;">
257 <element name="dt" namespace="&xhtml;">
258 <value-of select="normalize-space(substring-before(., ':'))"/>
259 </element>
260 <element name="dd" namespace="&xhtml;">
261 <variable name="firstline">
262 <choose>
263 <when test="contains(., ':')">
264 <value-of select="normalize-space(substring-after(., ':'))"/>
265 </when>
266 <otherwise>
267 <value-of select="normalize-space(.)"/>
268 </otherwise>
269 </choose>
270 </variable>
271 <choose>
272 <when test="substring($firstline, string-length($firstline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
273 <value-of select="substring($firstline, 1, string-length($firstline)-1)"/>
274 </when>
275 <otherwise>
276 <value-of select="$firstline"/>
277 </otherwise>
278 </choose>
279 <for-each select="exslset:intersection(following-sibling::*[starts-with(., ' ')], exslset:leading($fields, $next))">
280 <variable name="nextline" select="normalize-space(.)"/>
281 <choose>
282 <when test="substring($nextline, string-length($nextline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
283 <value-of select="substring($nextline, 1, string-length($nextline)-1)"/>
284 </when>
285 <otherwise>
286 <value-of select="$nextline"/>
287 </otherwise>
288 </choose>
289 </for-each>
290 </element>
291 </element>
292 </otherwise>
293 </choose>
294 </for-each>
295 </element>
296 </if>
297 <if test=".!='%%'">
298 <comment>
299 <value-of select="substring-after(., '%%')"/>
300 </comment>
301 </if>
302 </for-each>
303 </element>
304 </if>
305 <element name="div" namespace="&xhtml;">
306 <attribute name="class">
307 <text>body</text>
308 </attribute>
309 <call-template name="LesML:paragraphize">
310 <with-param name="lines" select="exslset:trailing($doclines, $record-separators[last()])"/>
311 </call-template>
312 </element>
313 </element>
314 </if>
315 <if test="$docsep">
316 <call-template name="LesML:parse">
317 <with-param name="lines" select="$docsep|exslset:trailing($lines, $docsep)"/>
318 <with-param name="parent-params" select="$params"/>
319 </call-template>
320 </if>
321 </template>
322 <template name="LesML:paragraphize">
323 <param name="lines" select="/.."/>
324 <variable name="last-lines" select="$lines[normalize-space()!='' and normalize-space(following-sibling::*[1])='']|$lines[last()]"/>
325 <variable name="blocked">
326 <for-each select="$last-lines">
327 <variable name="position" select="position()"/>
328 <variable name="prev-last" select="$last-lines[($position)-1]"/>
329 <variable name="linespans" select="(exslset:intersection(exslset:trailing($lines, $prev-last), exslset:leading($lines, .))|.)[normalize-space()!='']"/>
330 <variable name="quoted" select="not($linespans[not(starts-with(., ' ') or starts-with(., '&#x9;'))])"/>
331 <variable name="preformatted" select="not($linespans[not(starts-with(normalize-space(), '|'))])"/>
332 <variable name="text">
333 <for-each select="$linespans">
334 <choose>
335 <when test="$preformatted">
336 <value-of select="substring-after(., '|')"/>
337 </when>
338 <otherwise>
339 <value-of select="normalize-space()"/>
340 </otherwise>
341 </choose>
342 <if test="position()!=count($linespans)">
343 <choose>
344 <when test="$preformatted">
345 <text>&#xA;</text>
346 </when>
347 <otherwise>
348 <text> </text>
349 </otherwise>
350 </choose>
351 </if>
352 </for-each>
353 </variable>
354 <if test="string($text)!=''">
355 <variable name="par">
356 <choose>
357 <when test="$preformatted">
358 <element name="pre" namespace="&xhtml;">
359 <call-template name="LesML:id-and-contents">
360 <with-param name="source" select="$text"/>
361 </call-template>
362 </element>
363 </when>
364 <when test="starts-with($text, '⁌') and &sigiled-text;">
365 <element name="h1" namespace="&xhtml;">
366 <call-template name="LesML:id-and-contents">
367 <with-param name="source" select="&unsigiled-text;"/>
368 </call-template>
369 </element>
370 </when>
371 <when test="starts-with($text, '§') and &sigiled-text;">
372 <element name="h2" namespace="&xhtml;">
373 <call-template name="LesML:id-and-contents">
374 <with-param name="source" select="&unsigiled-text;"/>
375 </call-template>
376 </element>
377 </when>
378 <when test="starts-with($text, '❦') and &sigiled-text;">
379 <element name="h3" namespace="&xhtml;">
380 <call-template name="LesML:id-and-contents">
381 <with-param name="source" select="&unsigiled-text;"/>
382 </call-template>
383 </element>
384 </when>
385 <when test="starts-with($text, '✠') and &sigiled-text;">
386 <element name="h4" namespace="&xhtml;">
387 <call-template name="LesML:id-and-contents">
388 <with-param name="source" select="&unsigiled-text;"/>
389 </call-template>
390 </element>
391 </when>
392 <when test="starts-with($text, '•') and &sigiled-text;">
393 <element name="li" namespace="&xhtml;">
394 <attribute name="class">
395 <text>unordered</text>
396 </attribute>
397 <attribute name="data-level">
398 <text>1</text>
399 </attribute>
400 <element name="p" namespace="&xhtml;">
401 <call-template name="LesML:id-and-contents">
402 <with-param name="source" select="&unsigiled-text;"/>
403 </call-template>
404 </element>
405 </element>
406 </when>
407 <when test="starts-with($text, '🔢') and &sigiled-text;">
408 <element name="li" namespace="&xhtml;">
409 <attribute name="class">
410 <text>ordered</text>
411 </attribute>
412 <attribute name="data-level">
413 <text>1</text>
414 </attribute>
415 <element name="p" namespace="&xhtml;">
416 <call-template name="LesML:id-and-contents">
417 <with-param name="source" select="&unsigiled-text;"/>
418 </call-template>
419 </element>
420 </element>
421 </when>
422 <when test="starts-with($text, '◦') and &sigiled-text;">
423 <element name="li" namespace="&xhtml;">
424 <attribute name="class">
425 <text>unordered</text>
426 </attribute>
427 <attribute name="data-level">
428 <text>2</text>
429 </attribute>
430 <element name="p" namespace="&xhtml;">
431 <call-template name="LesML:id-and-contents">
432 <with-param name="source" select="&unsigiled-text;"/>
433 </call-template>
434 </element>
435 </element>
436 </when>
437 <when test="starts-with($text, '🔠') and &sigiled-text;">
438 <element name="li" namespace="&xhtml;">
439 <attribute name="class">
440 <text>ordered</text>
441 </attribute>
442 <attribute name="data-level">
443 <text>2</text>
444 </attribute>
445 <element name="p" namespace="&xhtml;">
446 <call-template name="LesML:id-and-contents">
447 <with-param name="source" select="&unsigiled-text;"/>
448 </call-template>
449 </element>
450 </element>
451 </when>
452 <when test="starts-with($text, '▪') and &sigiled-text;">
453 <element name="li" namespace="&xhtml;">
454 <attribute name="class">
455 <text>unordered</text>
456 </attribute>
457 <attribute name="data-level">
458 <text>3</text>
459 </attribute>
460 <element name="p" namespace="&xhtml;">
461 <call-template name="LesML:id-and-contents">
462 <with-param name="source" select="&unsigiled-text;"/>
463 </call-template>
464 </element>
465 </element>
466 </when>
467 <when test="starts-with($text, '🔡') and &sigiled-text;">
468 <element name="li" namespace="&xhtml;">
469 <attribute name="class">
470 <text>ordered</text>
471 </attribute>
472 <attribute name="data-level">
473 <text>3</text>
474 </attribute>
475 <element name="p" namespace="&xhtml;">
476 <call-template name="LesML:id-and-contents">
477 <with-param name="source" select="&unsigiled-text;"/>
478 </call-template>
479 </element>
480 </element>
481 </when>
482 <when test="starts-with($text, '⁃') and &sigiled-text;">
483 <element name="li" namespace="&xhtml;">
484 <attribute name="class">
485 <text>unordered</text>
486 </attribute>
487 <attribute name="data-level">
488 <text>4</text>
489 </attribute>
490 <element name="p" namespace="&xhtml;">
491 <call-template name="LesML:id-and-contents">
492 <with-param name="source" select="&unsigiled-text;"/>
493 </call-template>
494 </element>
495 </element>
496 </when>
497 <when test="starts-with($text, '🔣') and &sigiled-text;">
498 <element name="li" namespace="&xhtml;">
499 <attribute name="class">
500 <text>ordered</text>
501 </attribute>
502 <attribute name="data-level">
503 <text>4</text>
504 </attribute>
505 <element name="p" namespace="&xhtml;">
506 <call-template name="LesML:id-and-contents">
507 <with-param name="source" select="&unsigiled-text;"/>
508 </call-template>
509 </element>
510 </element>
511 </when>
512 <when test="starts-with($text, '🛈') and &sigiled-text;">
513 <element name="div" namespace="&xhtml;">
514 <attribute name="role">
515 <text>note</text>
516 </attribute>
517 <attribute name="class">
518 <text>info</text>
519 </attribute>
520 <element name="p" namespace="&xhtml;">
521 <call-template name="LesML:id-and-contents">
522 <with-param name="source" select="&unsigiled-text;"/>
523 </call-template>
524 </element>
525 </element>
526 </when>
527 <when test="starts-with($text, '⯑') and &sigiled-text;">
528 <element name="div" namespace="&xhtml;">
529 <attribute name="role">
530 <text>note</text>
531 </attribute>
532 <attribute name="class">
533 <text>query</text>
534 </attribute>
535 <element name="p" namespace="&xhtml;">
536 <call-template name="LesML:id-and-contents">
537 <with-param name="source" select="&unsigiled-text;"/>
538 </call-template>
539 </element>
540 </element>
541 </when>
542 <when test="starts-with($text, '⚠︎') and &sigiled-text;">
543 <element name="div" namespace="&xhtml;">
544 <attribute name="role">
545 <text>note</text>
546 </attribute>
547 <attribute name="class">
548 <text>warn</text>
549 </attribute>
550 <element name="p" namespace="&xhtml;">
551 <call-template name="LesML:id-and-contents">
552 <with-param name="source" select="&unsigiled-text;"/>
553 </call-template>
554 </element>
555 </element>
556 </when>
557 <when test="starts-with($text, '※') and &sigiled-text;">
558 <element name="div" namespace="&xhtml;">
559 <attribute name="role">
560 <text>note</text>
561 </attribute>
562 <attribute name="class">
563 <text>note</text>
564 </attribute>
565 <element name="p" namespace="&xhtml;">
566 <call-template name="LesML:id-and-contents">
567 <with-param name="source" select="&unsigiled-text;"/>
568 </call-template>
569 </element>
570 </element>
571 </when>
572 <when test="starts-with($text, '☡') and &sigiled-text;">
573 <element name="div" namespace="&xhtml;">
574 <attribute name="role">
575 <text>note</text>
576 </attribute>
577 <attribute name="class">
578 <text>caution</text>
579 </attribute>
580 <element name="p" namespace="&xhtml;">
581 <call-template name="LesML:id-and-contents">
582 <with-param name="source" select="&unsigiled-text;"/>
583 </call-template>
584 </element>
585 </element>
586 </when>
587 <when test="starts-with($text, '⋯') and &sigiled-text;">
588 <element name="div" namespace="&xhtml;">
589 <attribute name="class">
590 <text>continuation</text>
591 </attribute>
592 <element name="p" namespace="&xhtml;">
593 <call-template name="LesML:id-and-contents">
594 <with-param name="source" select="&unsigiled-text;"/>
595 </call-template>
596 </element>
597 </element>
598 </when>
599 <when test="starts-with($text, '#') and &sigiled-text;">
600 <comment>
601 <value-of select="&unsigiled-text;"/>
602 </comment>
603 </when>
604 <otherwise>
605 <element name="p" namespace="&xhtml;">
606 <call-template name="LesML:id-and-contents">
607 <with-param name="source" select="$text"/>
608 </call-template>
609 </element>
610 </otherwise>
611 </choose>
612 </variable>
613 <choose>
614 <when test="translate(string($text), '&section-break; ', '')=''">
615 <element name="hr" namespace="&xhtml;"/>
616 </when>
617 <when test="$quoted">
618 <element name="blockquote" namespace="&xhtml;">
619 <copy-of select="$par"/>
620 </element>
621 </when>
622 <otherwise>
623 <copy-of select="$par"/>
624 </otherwise>
625 </choose>
626 </if>
627 </for-each>
628 </variable>
629 <variable name="inlined">
630 <apply-templates select="exsl:node-set($blocked)/node()" mode="LesML:comment"/>
631 </variable>
632 <apply-templates select="exsl:node-set($inlined)/node()" mode="LesML:finalize-tree"/>
633 </template>
634 <template match="html:script[@type='text/lesml']">
635 <variable name="lines-fragment">
636 <call-template name="LesML:split">
637 <with-param name="source">
638 <for-each select=".//text()">
639 <value-of select="."/>
640 </for-each>
641 </with-param>
642 </call-template>
643 </variable>
644 <element name="div" namespace="&xhtml;">
645 <call-template name="LesML:parse">
646 <with-param name="lines" select="exsl:node-set($lines-fragment)/*"/>
647 </call-template>
648 </element>
649 </template>
650 <template match="node()" mode="LesML:finalize-attributes">
651 <variable name="notattr" select="following-sibling::node()[not(self::text() and translate(., ' &#x9;', '')='' or self::LesML:attribute)]"/>
652 <for-each select="(.|exslset:leading(following-sibling::node(), $notattr)[self::LesML:attribute])/@*">
653 <copy-of select="."/>
654 <if test="local-name()='lang' and namespace-uri()=''">
655 <attribute name="xml:lang">
656 <value-of select="."/>
657 </attribute>
658 </if>
659 </for-each>
660 </template>
661 <template match="LesML:attribute[preceding-sibling::node()[position()=1 and (self::text() or self::*)]]|text()[preceding-sibling::node()[position()=1 and self::*] and following-sibling::node()[position()=1 and self::LesML:attribute] and translate(., ' &#x9;', '')='']" mode="LesML:finalize-tree" priority="2"/>
662 <template match="LesML:attribute|text()[following-sibling::node()[position()=1 and self::LesML:attribute]]" mode="LesML:finalize-tree" priority="1">
663 <element name="span" namespace="&xhtml;">
664 <apply-templates select="." mode="LesML:finalize-attributes"/>
665 <if test="self::text()">
666 <call-template name="LesML:break-and-unescape">
667 <with-param name="source" select="string(.)"/>
668 </call-template>
669 </if>
670 </element>
671 </template>
672 <template match="html:blockquote" mode="LesML:finalize-tree">
673 <if test="not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:blockquote)]">
674 <variable name="notquote" select="following-sibling::node()[not(self::html:blockquote)][1]"/>
675 <variable name="contents">
676 <copy-of select="node()"/>
677 <for-each select="exslset:leading(following-sibling::node(), $notquote)">
678 <copy-of select="node()"/>
679 </for-each>
680 </variable>
681 <variable name="content-nodes" select="exsl:node-set($contents)/node()"/>
682 <variable name="laststarttext" select="$content-nodes[last()]/self::html:p[not(@class) and not(@role)]/node()[self::text() or self::*][position()=1 and self::text()]"/>
683 <choose>
684 <when test="starts-with($laststarttext, '— ')">
685 <variable name="caption">
686 <copy-of select="$laststarttext/preceding-sibling::node()"/>
687 <value-of select="substring-after($laststarttext, '— ')"/>
688 <copy-of select="$laststarttext/following-sibling::node()"/>
689 </variable>
690 <element name="figure" namespace="&xhtml;">
691 <copy>
692 <apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
693 </copy>
694 <element name="figcaption" namespace="&xhtml;">
695 <for-each select="$content-nodes[last()]">
696 <copy>
697 <apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
698 </copy>
699 </for-each>
700 </element>
701 </element>
702 </when>
703 <otherwise>
704 <copy>
705 <apply-templates select="@*|$content-nodes" mode="LesML:finalize-tree"/>
706 </copy>
707 </otherwise>
708 </choose>
709 </if>
710 </template>
711 <template match="html:div" mode="LesML:finalize-tree">
712 <if test="not(@class='continuation') or not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:div or self::html:li)]">
713 <variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
714 <copy>
715 <apply-templates select="@*|node()" mode="LesML:finalize-tree"/>
716 <for-each select="exslset:leading(following-sibling::node(), $notcontinuation)">
717 <apply-templates select="node()" mode="LesML:finalize-tree"/>
718 </for-each>
719 </copy>
720 </if>
721 </template>
722 <template match="html:li" mode="LesML:finalize-tree">
723 <if test="not(preceding-sibling::node()) or preceding-sibling::node()[not(preceding-sibling::* and self::html:div and @class='continuation')][position()=1 and not(self::html:li)]">
724 <apply-templates select="." mode="LesML:finalize-list"/>
725 </if>
726 </template>
727 <template match="html:li" mode="LesML:finalize-list">
728 <param name="parent-level" select="0"/>
729 <variable name="current-class" select="string(@class)"/>
730 <variable name="current-level" select="number(@data-level)"/>
731 <variable name="wrapper">
732 <choose>
733 <when test="@class='ordered'">
734 <text>ol</text>
735 </when>
736 <otherwise>
737 <text>ul</text>
738 </otherwise>
739 </choose>
740 </variable>
741 <variable name="notinlist" select="following-sibling::node()[not(self::html:div and @class='continuation' or self::html:li and (@data-level>$current-level or @data-level=$current-level and @class=$current-class))][1]"/>
742 <element name="{$wrapper}" namespace="&xhtml;">
743 <for-each select=".|exslset:leading(following-sibling::node(), $notinlist)[self::html:li and @data-level=$current-level]">
744 <variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
745 <copy>
746 <apply-templates select="@*|node()" mode="LesML:finalize-tree"/>
747 <for-each select="exslset:leading(following-sibling::node(), $notcontinuation)">
748 <apply-templates select="node()" mode="LesML:finalize-tree"/>
749 </for-each>
750 <if test="$notcontinuation/self::html:li[@data-level>$current-level]">
751 <apply-templates select="$notcontinuation" mode="LesML:finalize-list">
752 <with-param name="parent-level" select="$current-level"/>
753 </apply-templates>
754 </if>
755 </copy>
756 </for-each>
757 </element>
758 <if test="$notinlist/self::html:li[@data-level>$parent-level]">
759 <apply-templates select="$notinlist" mode="LesML:finalize-list">
760 <with-param name="parent-level" select="$parent-level"/>
761 </apply-templates>
762 </if>
763 </template>
764 <template match="processing-instruction()[local-name()='LesML-Token-Escape']" mode="LesML:finalize-tree">
765 <value-of select="."/>
766 </template>
767 <template match="text()" mode="LesML:finalize-tree">
768 <call-template name="LesML:break-and-unescape">
769 <with-param name="source" select="string(.)"/>
770 </call-template>
771 </template>
772 <template match="@*|node()" mode="LesML:finalize-tree" priority="-1">
773 <copy>
774 <apply-templates select="." mode="LesML:finalize-attributes"/>
775 <apply-templates select="node()" mode="LesML:finalize-tree"/>
776 </copy>
777 </template>
778 <template match="node()" mode="LesML:comment">
779 <variable name="result">
780 <choose>
781 <when test="self::*">
782 <variable name="start-node" select="text()[contains(., '⌦')][1]"/>
783 <variable name="after-start">
784 <if test="$start-node">
785 <value-of select="substring-after($start-node, '⌦')"/>
786 </if>
787 </variable>
788 <variable name="has-end-node" select="contains($after-start, '⌫') or $start-node/following-sibling::text()[contains(., '⌫')]"/>
789 <choose>
790 <when test="$start-node and $has-end-node">
791 <variable name="following">
792 <value-of select="$after-start"/>
793 <copy-of select="$start-node/following-sibling::node()"/>
794 </variable>
795 <variable name="end-node" select="exsl:node-set($following)/text()[contains(., '⌫')][last()]"/>
796 <variable name="comment">
797 <for-each select="$end-node/preceding-sibling::node()">
798 <value-of select="."/>
799 </for-each>
800 <value-of select="substring-before($end-node, '⌫')"/>
801 </variable>
802 <variable name="comment-split-fragment">
803 <call-template name="LesML:split">
804 <with-param name="source" select="string($comment)"/>
805 <with-param name="separator" select="'--'"/>
806 </call-template>
807 </variable>
808 <variable name="rest-fragment">
809 <element name="span" namespace="&xhtml;">
810 <value-of select="substring-after($end-node, '⌫')"/>
811 <copy-of select="$end-node/following-sibling::node()"/>
812 </element>
813 </variable>
814 <variable name="commented-rest-fragment">
815 <apply-templates select="exsl:node-set($rest-fragment)/node()" mode="LesML:comment"/>
816 </variable>
817 <copy>
818 <copy-of select="@*"/>
819 <copy-of select="$start-node/preceding-sibling::node()"/>
820 <copy-of select="substring-before($start-node, '⌦')"/>
821 <comment>
822 <for-each select="exsl:node-set($comment-split-fragment)/*">
823 <if test="string()='' or starts-with(., '‐')">
824 <text>&#x034F;</text>
825 </if>
826 <value-of select="."/>
827 <if test="substring(., string-length(.), 1)='‐'">
828 <text>&#x034F;</text>
829 </if>
830 <choose>
831 <when test="position()!=last()">
832 <text>-&#x034F;-</text>
833 </when>
834 </choose>
835 </for-each>
836 </comment>
837 <copy-of select="exsl:node-set($commented-rest-fragment)/*/node()"/>
838 </copy>
839 </when>
840 <otherwise>
841 <copy>
842 <copy-of select="@*"/>
843 <apply-templates select="node()" mode="LesML:comment"/>
844 </copy>
845 </otherwise>
846 </choose>
847 </when>
848 <when test="self::text()[contains(., '⌧')]">
849 <variable name="split-fragment">
850 <call-template name="LesML:split">
851 <with-param name="source" select="string()"/>
852 <with-param name="separator" select="'⌧'"/>
853 </call-template>
854 </variable>
855 <for-each select="exsl:node-set($split-fragment)/node()">
856 <value-of select="."/>
857 <if test="position()!=last()">
858 <comment>
859 <text>&#x034F;</text>
860 </comment>
861 </if>
862 </for-each>
863 </when>
864 <otherwise>
865 <copy-of select="."/>
866 </otherwise>
867 </choose>
868 </variable>
869 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:attrify"/>
870 </template>
871 <template match="node()" mode="LesML:inline">
872 <param name="element-name"/>
873 <param name="element-namespace" select="'http://www.w3.org/1999/xhtml'"/>
874 <param name="start-sigil"/>
875 <param name="end-sigil"/>
876 <param name="class"/>
877 <param name="role"/>
878 <param name="langtag-supported" select="false()"/>
879 <choose>
880 <when test="self::*">
881 <variable name="end-node" select="text()[contains(., $end-sigil)][1]"/>
882 <variable name="has-start-node" select="$end-node/preceding-sibling::text()[contains(., $start-sigil)] or string-length(substring-after($end-node, $start-sigil))>string-length(substring-after($end-node, $end-sigil))"/>
883 <choose>
884 <when test="$end-node and $has-start-node">
885 <variable name="preceding">
886 <copy-of select="$end-node/preceding-sibling::node()"/>
887 <value-of select="substring-before($end-node, $end-sigil)"/>
888 </variable>
889 <variable name="start-node" select="exsl:node-set($preceding)/text()[contains(., $start-sigil)][last()]"/>
890 <variable name="restoftext" select="substring-after($end-node, $end-sigil)"/>
891 <variable name="maybe-langtag">
892 <if test="$langtag-supported and starts-with($restoftext, '@') and contains($restoftext, '$')">
893 <value-of select="substring-before(substring-after($restoftext, '@'), '$')"/>
894 </if>
895 </variable>
896 <variable name="langtag">
897 <if test="translate($maybe-langtag, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-', '')=''">
898 <value-of select="$maybe-langtag"/>
899 </if>
900 </variable>
901 <variable name="start-tokens-fragment">
902 <call-template name="LesML:split">
903 <with-param name="source" select="string($start-node)"/>
904 <with-param name="separator" select="$start-sigil"/>
905 </call-template>
906 </variable>
907 <variable name="start-tokens" select="exsl:node-set($start-tokens-fragment)/*"/>
908 <variable name="wrapped">
909 <copy>
910 <copy-of select="@*"/>
911 <copy-of select="$start-node/preceding-sibling::node()"/>
912 <for-each select="$start-tokens[position()!=last()]">
913 <value-of select="."/>
914 <if test="position()!=last()">
915 <value-of select="$start-sigil"/>
916 </if>
917 </for-each>
918 <element name="{$element-name}" namespace="{$element-namespace}">
919 <if test="string($role)!=''">
920 <attribute name="role">
921 <value-of select="$role"/>
922 </attribute>
923 </if>
924 <if test="string($class)!=''">
925 <attribute name="class">
926 <value-of select="$class"/>
927 </attribute>
928 </if>
929 <if test="string($langtag)!=''">
930 <if test="$element-namespace='http://www.w3.org/1999/xhtml'">
931 <attribute name="lang">
932 <value-of select="$langtag"/>
933 </attribute>
934 </if>
935 <attribute name="xml:lang">
936 <value-of select="$langtag"/>
937 </attribute>
938 </if>
939 <value-of select="$start-tokens[last()]"/>
940 <copy-of select="$start-node/following-sibling::node()"/>
941 </element>
942 <choose>
943 <when test="string($langtag)!=''">
944 <value-of select="substring-after($restoftext, '$')"/>
945 </when>
946 <otherwise>
947 <value-of select="$restoftext"/>
948 </otherwise>
949 </choose>
950 <copy-of select="$end-node/following-sibling::node()"/>
951 </copy>
952 </variable>
953 <apply-templates select="exsl:node-set($wrapped)/*" mode="LesML:inline">
954 <with-param name="element-name" select="$element-name"/>
955 <with-param name="element-namespace" select="$element-namespace"/>
956 <with-param name="start-sigil" select="$start-sigil"/>
957 <with-param name="end-sigil" select="$end-sigil"/>
958 <with-param name="role" select="$role"/>
959 <with-param name="langtag-supported" select="$langtag-supported"/>
960 </apply-templates>
961 </when>
962 <otherwise>
963 <copy>
964 <copy-of select="@*"/>
965 <apply-templates select="node()" mode="LesML:inline">
966 <with-param name="element-name" select="$element-name"/>
967 <with-param name="element-namespace" select="$element-namespace"/>
968 <with-param name="start-sigil" select="$start-sigil"/>
969 <with-param name="end-sigil" select="$end-sigil"/>
970 <with-param name="role" select="$role"/>
971 <with-param name="langtag-supported" select="$langtag-supported"/>
972 </apply-templates>
973 </copy>
974 </otherwise>
975 </choose>
976 </when>
977 <otherwise>
978 <copy-of select="."/>
979 </otherwise>
980 </choose>
981 </template>
982 <template match="*" mode="LesML:partition">
983 <param name="start-sigil"/>
984 <param name="end-sigil"/>
985 <param name="separator"/>
986 <param name="ncname-keys" select="false()"/>
987 <variable name="end-node" select="text()[contains(., $end-sigil)][1]"/>
988 <variable name="has-start-node" select="$end-node/preceding-sibling::text()[contains(., $start-sigil) and not(following-sibling::* or following-sibling::comment())] or string-length(substring-after($end-node, $start-sigil))>string-length(substring-after($end-node, $end-sigil))"/>
989 <choose>
990 <when test="$end-node and $has-start-node">
991 <variable name="preceding">
992 <copy-of select="$end-node/preceding-sibling::node()"/>
993 <value-of select="substring-before($end-node, $end-sigil)"/>
994 </variable>
995 <variable name="start-node" select="exsl:node-set($preceding)/text()[contains(., $start-sigil) and not(following-sibling::*)][last()]"/>
996 <variable name="start-tokens-fragment">
997 <call-template name="LesML:split">
998 <with-param name="source" select="string($start-node)"/>
999 <with-param name="separator" select="$start-sigil"/>
1000 </call-template>
1001 </variable>
1002 <variable name="start-tokens" select="exsl:node-set($start-tokens-fragment)/*"/>
1003 <variable name="innards">
1004 <value-of select="$start-tokens[last()]"/>
1005 <for-each select="$start-node/following-sibling::node()">
1006 <value-of select="."/>
1007 </for-each>
1008 </variable>
1009 <choose>
1010 <when test="contains($innards, $separator)">
1011 <variable name="keyval-fragment">
1012 <call-template name="LesML:split">
1013 <with-param name="source" select="$innards"/>
1014 <with-param name="separator" select="$separator"/>
1015 </call-template>
1016 </variable>
1017 <variable name="keyval" select="exsl:node-set($keyval-fragment)/*"/>
1018 <variable name="key">
1019 <choose>
1020 <when test="$ncname-keys">
1021 <value-of select="$keyval[1]"/>
1022 </when>
1023 <otherwise>
1024 <for-each select="$keyval[position()!=last()]">
1025 <value-of select="."/>
1026 <if test="position()!=last()">
1027 <value-of select="$separator"/>
1028 </if>
1029 </for-each>
1030 </otherwise>
1031 </choose>
1032 </variable>
1033 <variable name="value">
1034 <choose>
1035 <when test="$ncname-keys">
1036 <for-each select="$keyval[position()!=1]">
1037 <value-of select="."/>
1038 <if test="position()!=last()">
1039 <value-of select="$separator"/>
1040 </if>
1041 </for-each>
1042 </when>
1043 <otherwise>
1044 <value-of select="$keyval[last()]"/>
1045 </otherwise>
1046 </choose>
1047 </variable>
1048 <choose>
1049 <when test="not($ncname-keys) or /self::node()[translate(normalize-space($key), ' /([,*', '')=string($key) and exsldyn:evaluate(concat('not(self::html:', $key, ')'))]">
1050 <element name="span" namespace="&xhtml;">
1051 <copy-of select="$start-node/preceding-sibling::node()"/>
1052 <for-each select="$start-tokens[position()!=last()]">
1053 <value-of select="."/>
1054 <if test="position()!=last()">
1055 <value-of select="$start-sigil"/>
1056 </if>
1057 </for-each>
1058 </element>
1059 <element name="span" namespace="&xhtml;">
1060 <value-of select="$key"/>
1061 </element>
1062 <element name="span" namespace="&xhtml;">
1063 <value-of select="$value"/>
1064 </element>
1065 <element name="span" namespace="&xhtml;">
1066 <value-of select="substring-after($end-node, $end-sigil)"/>
1067 <copy-of select="$end-node/following-sibling::node()"/>
1068 </element>
1069 </when>
1070 <otherwise>
1071 <element name="span" namespace="&xhtml;">
1072 <copy-of select="$start-node/preceding-sibling::node()"/>
1073 <for-each select="$start-tokens[position()!=last()]">
1074 <value-of select="."/>
1075 <if test="position()!=last()">
1076 <value-of select="$start-sigil"/>
1077 </if>
1078 </for-each>
1079 <processing-instruction name="LesML-Token-Escape">
1080 <value-of select="$start-sigil"/>
1081 </processing-instruction>
1082 <value-of select="$start-tokens[last()]"/>
1083 <value-of select="$start-node/following-sibling::node()"/>
1084 <value-of select="$end-sigil"/>
1085 <value-of select="substring-after($end-node, $end-sigil)"/>
1086 <copy-of select="$end-node/following-sibling::node()"/>
1087 </element>
1088 </otherwise>
1089 </choose>
1090 </when>
1091 <otherwise>
1092 <element name="span" namespace="&xhtml;">
1093 <copy-of select="$start-node/preceding-sibling::node()"/>
1094 <for-each select="$start-tokens[position()!=last()]">
1095 <value-of select="."/>
1096 <if test="position()!=last()">
1097 <value-of select="$start-sigil"/>
1098 </if>
1099 </for-each>
1100 <processing-instruction name="LesML-Token-Escape">
1101 <value-of select="$start-sigil"/>
1102 </processing-instruction>
1103 <value-of select="$start-tokens[last()]"/>
1104 <value-of select="$start-node/following-sibling::node()"/>
1105 <value-of select="$end-sigil"/>
1106 <value-of select="substring-after($end-node, $end-sigil)"/>
1107 <copy-of select="$end-node/following-sibling::node()"/>
1108 </element>
1109 </otherwise>
1110 </choose>
1111 </when>
1112 <when test="$end-node">
1113 <element name="span" namespace="&xhtml;">
1114 <copy-of select="$end-node/preceding-sibling::node()"/>
1115 <value-of select="substring-before($end-node, $end-sigil)"/>
1116 <processing-instruction name="LesML-Token-Escape">
1117 <value-of select="$end-sigil"/>
1118 </processing-instruction>
1119 <value-of select="substring-after($end-node, $end-sigil)"/>
1120 <copy-of select="$end-node/following-sibling::node()"/>
1121 </element>
1122 </when>
1123 <otherwise>
1124 <processing-instruction name="LesML-All-Done"/>
1125 </otherwise>
1126 </choose>
1127 </template>
1128 <template match="node()" mode="LesML:attrify">
1129 <variable name="result">
1130 <choose>
1131 <when test="self::*">
1132 <variable name="partitioned-fragment">
1133 <apply-templates mode="LesML:partition" select=".">
1134 <with-param name="start-sigil" select="'{@'"/>
1135 <with-param name="end-sigil" select="'&quot;}'"/>
1136 <with-param name="separator" select="'=&quot;'"/>
1137 <with-param name="ncname-keys" select="true()"/>
1138 </apply-templates>
1139 </variable>
1140 <variable name="partitioned" select="exsl:node-set($partitioned-fragment)/node()"/>
1141 <choose>
1142 <when test="count($partitioned)>1">
1143 <variable name="processed">
1144 <copy>
1145 <copy-of select="@*"/>
1146 <copy-of select="$partitioned[1]/node()"/>
1147 <element name="LesML:attribute" namespace="&LesML;">
1148 <attribute name="{$partitioned[2]}">
1149 <value-of select="$partitioned[3]"/>
1150 </attribute>
1151 </element>
1152 <copy-of select="$partitioned[4]/node()"/>
1153 </copy>
1154 </variable>
1155 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:attrify"/>
1156 </when>
1157 <when test="$partitioned[self::processing-instruction() and local-name()='LesML-All-Done']">
1158 <copy>
1159 <copy-of select="@*"/>
1160 <apply-templates select="node()" mode="LesML:attrify"/>
1161 </copy>
1162 </when>
1163 <otherwise>
1164 <variable name="processed">
1165 <copy>
1166 <copy-of select="@*"/>
1167 <copy-of select="$partitioned/node()"/>
1168 </copy>
1169 </variable>
1170 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:attrify"/>
1171 </otherwise>
1172 </choose>
1173 </when>
1174 <otherwise>
1175 <copy-of select="."/>
1176 </otherwise>
1177 </choose>
1178 </variable>
1179 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:linkify"/>
1180 </template>
1181 <template match="node()" mode="LesML:linkify">
1182 <variable name="result">
1183 <choose>
1184 <when test="processing-instruction()[local-name()='LesML-All-Done']">
1185 <copy>
1186 <copy-of select="@*|node()[not(self::processing-instruction() and local-name()='LesML-All-Done')]"/>
1187 </copy>
1188 </when>
1189 <when test="self::*">
1190 <variable name="partitioned-fragment">
1191 <apply-templates mode="LesML:partition" select=".">
1192 <with-param name="start-sigil" select="'{🔗'"/>
1193 <with-param name="end-sigil" select="'>}'"/>
1194 <with-param name="separator" select="'&lt;'"/>
1195 </apply-templates>
1196 </variable>
1197 <variable name="partitioned" select="exsl:node-set($partitioned-fragment)/node()"/>
1198 <choose>
1199 <when test="count($partitioned)>1">
1200 <variable name="processed">
1201 <copy>
1202 <copy-of select="@*"/>
1203 <copy-of select="$partitioned[1]/node()"/>
1204 <element name="a" namespace="&xhtml;">
1205 <attribute name="href">
1206 <value-of select="$partitioned[3]"/>
1207 </attribute>
1208 <processing-instruction name="LesML-All-Done"/>
1209 <choose>
1210 <when test="string($partitioned[2])=''">
1211 <value-of select="$partitioned[3]"/>
1212 </when>
1213 <otherwise>
1214 <value-of select="$partitioned[2]"/>
1215 </otherwise>
1216 </choose>
1217 </element>
1218 <copy-of select="$partitioned[4]/node()"/>
1219 </copy>
1220 </variable>
1221 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:linkify"/>
1222 </when>
1223 <when test="$partitioned[self::processing-instruction() and local-name()='LesML-All-Done']">
1224 <copy>
1225 <copy-of select="@*"/>
1226 <apply-templates select="node()" mode="LesML:linkify"/>
1227 </copy>
1228 </when>
1229 <otherwise>
1230 <variable name="processed">
1231 <copy>
1232 <copy-of select="@*"/>
1233 <copy-of select="$partitioned/node()"/>
1234 </copy>
1235 </variable>
1236 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:linkify"/>
1237 </otherwise>
1238 </choose>
1239 </when>
1240 <otherwise>
1241 <copy-of select="."/>
1242 </otherwise>
1243 </choose>
1244 </variable>
1245 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:strikethrough"/>
1246 </template>
1247 <template match="node()" mode="LesML:strikethrough">
1248 <variable name="result">
1249 <apply-templates select="." mode="LesML:inline">
1250 <with-param name="element-name" select="'s'"/>
1251 <with-param name="element-namespace" select="'&xhtml;'"/>
1252 <with-param name="start-sigil" select="'⸠'"/>
1253 <with-param name="end-sigil" select="'⸡'"/>
1254 </apply-templates>
1255 </variable>
1256 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:underline"/>
1257 </template>
1258 <template match="node()" mode="LesML:underline">
1259 <variable name="result">
1260 <apply-templates select="." mode="LesML:inline">
1261 <with-param name="element-name" select="'u'"/>
1262 <with-param name="element-namespace" select="'&xhtml;'"/>
1263 <with-param name="start-sigil" select="'⸤'"/>
1264 <with-param name="end-sigil" select="'⸥'"/>
1265 </apply-templates>
1266 </variable>
1267 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:noted"/>
1268 </template>
1269 <template match="node()" mode="LesML:noted">
1270 <variable name="result">
1271 <apply-templates select="." mode="LesML:inline">
1272 <with-param name="element-name" select="'small'"/>
1273 <with-param name="element-namespace" select="'&xhtml;'"/>
1274 <with-param name="start-sigil" select="'⟦'"/>
1275 <with-param name="end-sigil" select="'⟧'"/>
1276 <with-param name="role" select="'note'"/>
1277 </apply-templates>
1278 </variable>
1279 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:parenthetical"/>
1280 </template>
1281 <template match="node()" mode="LesML:parenthetical">
1282 <variable name="result">
1283 <apply-templates select="." mode="LesML:inline">
1284 <with-param name="element-name" select="'small'"/>
1285 <with-param name="element-namespace" select="'&xhtml;'"/>
1286 <with-param name="start-sigil" select="'⸨'"/>
1287 <with-param name="end-sigil" select="'⸩'"/>
1288 </apply-templates>
1289 </variable>
1290 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:code"/>
1291 </template>
1292 <template match="node()" mode="LesML:code">
1293 <variable name="result">
1294 <apply-templates select="." mode="LesML:inline">
1295 <with-param name="element-name" select="'code'"/>
1296 <with-param name="element-namespace" select="'&xhtml;'"/>
1297 <with-param name="start-sigil" select="'`'"/>
1298 <with-param name="end-sigil" select="'´'"/>
1299 </apply-templates>
1300 </variable>
1301 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:titled"/>
1302 </template>
1303 <template match="node()" mode="LesML:titled">
1304 <variable name="result">
1305 <apply-templates select="." mode="LesML:inline">
1306 <with-param name="element-name" select="'cite'"/>
1307 <with-param name="element-namespace" select="'&xhtml;'"/>
1308 <with-param name="start-sigil" select="'⟪'"/>
1309 <with-param name="end-sigil" select="'⟫'"/>
1310 </apply-templates>
1311 </variable>
1312 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:named"/>
1313 </template>
1314 <template match="node()" mode="LesML:named">
1315 <variable name="result">
1316 <apply-templates select="." mode="LesML:inline">
1317 <with-param name="element-name" select="'u'"/>
1318 <with-param name="element-namespace" select="'&xhtml;'"/>
1319 <with-param name="start-sigil" select="'⸶'"/>
1320 <with-param name="end-sigil" select="'⸷'"/>
1321 <with-param name="class" select="'name'"/>
1322 </apply-templates>
1323 </variable>
1324 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:offset"/>
1325 </template>
1326 <template match="node()" mode="LesML:offset">
1327 <variable name="result">
1328 <apply-templates select="." mode="LesML:inline">
1329 <with-param name="element-name" select="'i'"/>
1330 <with-param name="element-namespace" select="'&xhtml;'"/>
1331 <with-param name="start-sigil" select="'⟨'"/>
1332 <with-param name="end-sigil" select="'⟩'"/>
1333 <with-param name="langtag-supported" select="true()"/>
1334 </apply-templates>
1335 </variable>
1336 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:bolded"/>
1337 </template>
1338 <template match="node()" mode="LesML:bolded">
1339 <variable name="result">
1340 <apply-templates select="." mode="LesML:inline">
1341 <with-param name="element-name" select="'b'"/>
1342 <with-param name="element-namespace" select="'&xhtml;'"/>
1343 <with-param name="start-sigil" select="'⦃'"/>
1344 <with-param name="end-sigil" select="'⦄'"/>
1345 </apply-templates>
1346 </variable>
1347 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:important"/>
1348 </template>
1349 <template match="node()" mode="LesML:important">
1350 <variable name="result">
1351 <apply-templates select="." mode="LesML:inline">
1352 <with-param name="element-name" select="'strong'"/>
1353 <with-param name="element-namespace" select="'&xhtml;'"/>
1354 <with-param name="start-sigil" select="'☞'"/>
1355 <with-param name="end-sigil" select="'☜'"/>
1356 </apply-templates>
1357 </variable>
1358 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:emphasized"/>
1359 </template>
1360 <template match="node()" mode="LesML:emphasized">
1361 <apply-templates select="." mode="LesML:inline">
1362 <with-param name="element-name" select="'em'"/>
1363 <with-param name="element-namespace" select="'&xhtml;'"/>
1364 <with-param name="start-sigil" select="'⹐'"/>
1365 <with-param name="end-sigil" select="'⹑'"/>
1366 </apply-templates>
1367 </template>
1368 </transform>
This page took 0.18929 seconds and 5 git commands to generate.