3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <!--***********************************************************************-->
28 <!-- Extension to the XSLT version 0.07 of MathML content to presentation: -->
29 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
30 <!-- Revised: March 3 2000, Irene Schena -->
31 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
32 <!-- Revised: March 21 2000, Irene Schena -->
33 <!--***********************************************************************-->
35 <!-- NOTE: the namespace declaration has to be done in the stylesheets
36 which generates the toplevel element (see for instance xlink) -->
37 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
38 xmlns:m="http://www.w3.org/1998/Math/MathML"
39 xmlns:helm="http://www.cs.unibo.it/helm"
40 xmlns:xlink="http://www.w3.org/1999/xlink">
42 <!-- OLD: <xsl:import href="mml2mmlv1_0.xsl"/> -->
43 <xsl:import href="mmlctop.xsl-0.14"/>
45 <xsl:import href="mmltheoryextension.xsl"/>
47 <xsl:param name="explodeall" select="false()"/>
49 <!--***********************************************************************-->
50 <!-- Parameter affecting line-breaking -->
51 <!--***********************************************************************-->
53 <xsl:variable name="framewidth" select="35"/>
55 <!--***********************************************************************-->
56 <!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
57 <!-- math ma al di fuori di semantics. Ora vi sono tanti semantics quanti -->
58 <!-- sono i termini: la presentation per un termine e' generata come primo -->
59 <!-- figlio di un semantics e l'originario content viene inserito nel -->
60 <!-- nel secondo figlio di semantics, annotation-xml -->
61 <!--***********************************************************************-->
63 <!--**********************-->
65 <!--**********************-->
67 <xsl:param name="type" select="'standalone'"/>
69 <xsl:template match="/">
71 <xsl:when test="$type = 'standalone'">
72 <xsl:apply-templates select="*"/>
76 <xsl:apply-templates select="*"/>
84 <xsl:template match="Definition">
86 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
90 <m:mtext>DEFINITION <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
97 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
98 <xsl:apply-templates select="type/*[1]"/>
105 <m:mtext>AS</m:mtext>
112 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
113 <xsl:apply-templates select="body/*[1]"/>
123 <xsl:template match="Axiom">
125 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
129 <m:mtext>AXIOM <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>) OF TYPE</m:mtext>
136 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
137 <xsl:apply-templates select="type/*[1]"/>
145 <!-- UNFINISHED PROOF -->
147 <xsl:template match="CurrentProof">
149 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
153 <m:mtext>UNFINISHED PROOF <xsl:value-of select="@name"/>(<xsl:if test="string(./Params) != """><xsl:value-of select="Params"/></xsl:if>)</m:mtext>
160 <m:mtext>THESIS:</m:mtext>
167 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
168 <xsl:apply-templates select="type/*[1]"/>
175 <m:mtext>CONJECTURES:</m:mtext>
179 <xsl:for-each select="Conjecture">
183 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
184 <m:mtext><xsl:value-of select="./@no"/>:</m:mtext>
185 <xsl:apply-templates select="./*[1]"/>
193 <m:mtext>CORRESPONDING PROOF:</m:mtext>
200 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
201 <xsl:apply-templates select="body/*[1]"/>
209 <!-- MUTUAL INDUCTIVE DEFINITION -->
211 <xsl:template match="InductiveDefinition">
213 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
214 <xsl:for-each select="InductiveType">
219 <xsl:when test="position() = 1">
221 <xsl:when test="string(./@inductive) = "true"">
222 <m:mtext>INDUCTIVE DEFINITION</m:mtext>
225 <m:mtext>COINDUCTIVE DEFINITION</m:mtext>
230 <m:mtext>AND</m:mtext>
233 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
234 <m:mtext><xsl:value-of select="./@name"/>(<xsl:if test="string(../Params) != """><xsl:value-of select="../Params"/></xsl:if>)</m:mtext>
241 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
244 <xsl:when test="string(../Param) != """>
245 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
246 <xsl:for-each select="../Param">
250 <m:mi><xsl:value-of select="./@name"/></m:mi>
252 <xsl:apply-templates select="*"/>
276 <m:mtext>OF ARITY</m:mtext>
283 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
284 <xsl:apply-templates select="./arity/*[1]"/>
291 <m:mtext>BUILT FROM</m:mtext>
295 <xsl:for-each select="./Constructor">
300 <xsl:when test="position() = 1">
301 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
305 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
308 <m:mtext><xsl:value-of select="./@name"/> OF</m:mtext>
309 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
310 <xsl:apply-templates select="./*[1]"/>
322 <xsl:template match="Variable">
324 <m:mtable align="baseline 1" equalrows="false" columnalign="left" helm:xref="{@helm:xref}">
328 <m:mtext>VARIABLE <xsl:value-of select="@name"/> OF TYPE</m:mtext>
335 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
336 <xsl:apply-templates select="type/*[1]"/>
340 <xsl:if test="name(*[1])='body'">
344 <m:mtext>AS</m:mtext>
351 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
352 <xsl:apply-templates select="body/*[1]"/>
361 <!--**********************-->
363 <!--**********************-->
365 <xsl:template match="m:bvar">
367 <xsl:when test="m:type">
368 <xsl:variable name="charlength">
369 <xsl:apply-templates select="m:ci" mode="charcount"/>
372 <xsl:when test="$charlength >= $framewidth">
373 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
377 <xsl:apply-templates select="m:ci"/>
385 <xsl:apply-templates select="m:type"/>
393 <xsl:apply-templates select="m:ci"/>
395 <xsl:apply-templates select="m:type"/>
401 <xsl:apply-templates select="m:ci"/>
409 <xsl:template match="m:apply[m:csymbol]">
410 <xsl:param name="nopar" select="0"/>
411 <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
412 <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
415 <xsl:attribute name="m:xref"><xsl:value-of select="@id"/></xsl:attribute>
417 <xsl:variable name="id" select="m:csymbol/@id"/>
420 <xsl:when test="$name='forall'">
422 <xsl:when test="$charlength >= $framewidth">
423 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
427 <m:mo mathcolor="Blue">∀</m:mo>
428 <xsl:apply-templates select="m:bvar"/>
436 <xsl:apply-templates select="*[position()=3]"/>
443 <m:mo mathcolor="Blue">∀</m:mo>
444 <xsl:apply-templates select="m:bvar/m:ci"/>
446 <xsl:apply-templates select="m:bvar/m:type"/>
448 <xsl:apply-templates select="*[position()=3]"/>
453 <xsl:when test="$name='let_in'">
455 <xsl:when test="$charlength >= $framewidth">
456 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
461 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
462 <xsl:apply-templates select="m:bvar"/>
470 <xsl:apply-templates select="*[position()=3]"/>
478 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
479 <xsl:apply-templates select="*[position()=4]"/>
487 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
488 <xsl:apply-templates select="m:bvar/m:ci"/>
490 <xsl:apply-templates select="*[position()=3]"/>
491 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
492 <m:mtext>IN</m:mtext>
493 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
494 <xsl:apply-templates select="*[position()=4]"/>
499 <xsl:when test="$name='prod'">
501 <xsl:when test="$charlength >= $framewidth">
502 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
506 <m:mo mathcolor="Blue">Π</m:mo>
507 <xsl:apply-templates select="m:bvar"/>
515 <xsl:apply-templates select="*[position()=3]"/>
522 <m:mo mathcolor="Blue">Π</m:mo>
523 <xsl:apply-templates select="m:bvar/m:ci"/>
525 <xsl:apply-templates select="m:bvar/m:type"/>
527 <xsl:apply-templates select="*[position()=3]"/>
532 <xsl:when test="$name='arrow'">
534 <xsl:when test="$charlength >= $framewidth">
535 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
539 <xsl:if test="$nopar=0">
540 <m:mo stretchy="false">(</m:mo>
542 <xsl:apply-templates select="*[position()=2]"/>
549 <m:mo mathmathcolor="Blue">→</m:mo>
551 <xsl:when test="*[position()=3]/m:csymbol">
552 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
554 <xsl:when test="$nextp='arrow'">
555 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
558 <xsl:apply-templates select="*[position()=3]"/>
563 <xsl:apply-templates select="*[position()=3]"/>
569 <xsl:if test="$nopar=0">
573 <m:mo stretchy="false">)</m:mo>
581 <xsl:if test="$nopar=0">
582 <m:mo stretchy="false">(</m:mo>
584 <xsl:apply-templates select="*[position()=2]"/>
585 <m:mo mathcolor="Blue">→</m:mo>
587 <xsl:when test="*[position()=3]/m:csymbol">
588 <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
590 <xsl:when test="$nextp='arrow'">
591 <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
594 <xsl:apply-templates select="*[position()=3]"/>
599 <xsl:apply-templates select="*[position()=3]"/>
602 <xsl:if test="$nopar=0">
603 <m:mo stretchy="false">)</m:mo>
609 <xsl:when test="$name='app'">
611 <xsl:when test="$charlength >= $framewidth">
612 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
616 <m:mo stretchy="false">(</m:mo>
617 <xsl:apply-templates select="*[position()=2]"/>
621 <xsl:for-each select="*[position()>2]">
625 <m:mphantom><m:mtext>(</m:mtext></m:mphantom>
626 <xsl:apply-templates select="."/>
634 <m:mo stretchy="false">)</m:mo>
641 <m:mo stretchy="false">(</m:mo>
642 <xsl:apply-templates select="*[position()=2]"/>
643 <xsl:for-each select="*[position()>2]">
644 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
645 <xsl:apply-templates select="."/>
647 <m:mo stretchy="false">)</m:mo>
652 <xsl:when test="$name='cast'">
654 <xsl:when test="$charlength >= $framewidth">
655 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
659 <m:mo stretchy="false">(</m:mo>
660 <xsl:apply-templates select="*[position()=2]"/>
667 <m:mo mathcolor="Maroon">:></m:mo>
668 <xsl:apply-templates select="*[position()=3]"/>
675 <m:mo stretchy="false">)</m:mo>
682 <m:mo stretchy="false">(</m:mo>
683 <xsl:apply-templates select="*[position()=2]"/>
684 <m:mo mathcolor="Maroon">:></m:mo>
685 <xsl:apply-templates select="*[position()=3]"/>
686 <m:mo stretchy="false">)</m:mo>
691 <xsl:when test="$name='Prop'">
695 <xsl:when test="$name='Set'">
699 <xsl:when test="$name='Type'">
703 <xsl:when test="$name='mutcase'">
705 <xsl:when test="$charlength >= $framewidth">
706 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
707 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
712 <xsl:apply-templates select="*[position()=2]"/>
713 <xsl:if test="$framewidth > $charlength">
716 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
717 <xsl:apply-templates select="*[position()=3]"/>
722 <xsl:if test="$charlength >= $framewidth">
728 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
729 <xsl:apply-templates select="*[position()=3]"/>
741 <xsl:for-each select="piecewise/piece">
742 <xsl:variable name="charlength"><xsl:apply-templates select="./*[2]" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
747 <xsl:when test="position() = 1">
748 <m:mphantom><m:mtext>|</m:mtext></m:mphantom>
751 <m:mo stretchy="false">|</m:mo>
754 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
755 <xsl:apply-templates select="./*[2]"/>
756 <xsl:if test="$framewidth > $charlength">
757 <m:mo mathcolor="Green">⇒</m:mo>
758 <xsl:apply-templates select="./*[1]"/>
763 <xsl:if test="$charlength >= $framewidth">
767 <m:mphantom><m:mtext>|_</m:mtext></m:mphantom>
768 <m:mo mathcolor="Green">⇒</m:mo>
769 <xsl:apply-templates select="./*[1]"/>
785 <m:mo><</m:mo><xsl:apply-templates select="*[position()=2]"/><m:mo>></m:mo>
787 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
788 <xsl:apply-templates select="*[position()=3]"/>
789 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
791 <xsl:for-each select="piecewise/piece">
793 <xsl:when test="position() != 1">
794 <m:mo stretchy="false">|</m:mo>
797 <xsl:apply-templates select="./*[2]"/>
798 <m:mo mathcolor="Green">⇒</m:mo>
799 <xsl:apply-templates select="./*[1]"/>
801 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
807 <xsl:when test="$name='fix'">
809 <xsl:when test="$charlength >= $framewidth">
810 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
815 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
816 <m:mi><xsl:value-of select="m:ci"/></m:mi>
817 <m:mo stretchy="false">{</m:mo>
824 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
825 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
826 <xsl:for-each select="m:bvar">
827 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
831 <m:mi><xsl:value-of select="m:ci"/></m:mi>
833 <xsl:if test="$framewidth > $charlength">
834 <xsl:apply-templates select="m:type"/>
839 <xsl:if test="$charlength >= $framewidth">
843 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
844 <xsl:apply-templates select="m:type"/>
853 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
865 <m:mo stretchy="false">}</m:mo>
873 <m:mi><xsl:value-of select="m:ci"/></m:mi>
874 <m:mo stretchy="false">{</m:mo>
875 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
876 <xsl:for-each select="m:bvar">
880 <m:mi><xsl:value-of select="m:ci"/></m:mi>
882 <xsl:apply-templates select="m:type"/>
884 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
885 <xsl:if test="position()=last()">
886 <m:mo stretchy="false">}</m:mo>
897 <xsl:when test="$name='cofix'">
899 <xsl:when test="$charlength >= $framewidth">
900 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
905 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
906 <m:mi><xsl:value-of select="m:ci"/></m:mi>
907 <m:mo stretchy="false">{</m:mo>
914 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
915 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
916 <xsl:for-each select="m:bvar">
917 <xsl:variable name="charlength"><xsl:apply-templates select="m:type" mode="charcount"><xsl:with-param name="nosibling" select="1"/></xsl:apply-templates></xsl:variable>
921 <m:mi><xsl:value-of select="m:ci"/></m:mi>
923 <xsl:if test="$framewidth > $charlength">
924 <xsl:apply-templates select="m:type"/>
929 <xsl:if test="$charlength >= $framewidth">
933 <m:mphantom><m:mtext>:=</m:mtext></m:mphantom>
934 <xsl:apply-templates select="m:type"/>
943 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
955 <m:mo stretchy="false">}</m:mo>
963 <m:mi><xsl:value-of select="m:ci"/></m:mi>
964 <m:mo stretchy="false">{</m:mo>
965 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
966 <xsl:for-each select="m:bvar">
970 <m:mi><xsl:value-of select="m:ci"/></m:mi>
972 <xsl:apply-templates select="m:type"/>
974 <xsl:apply-templates select="following-sibling::*[position() = 1]"/>
975 <xsl:if test="position()=last()">
976 <m:mo stretchy="false">}</m:mo>
986 <!-- ***************************************** -->
987 <!-- *********** PROOF ELEMENTS ************** -->
988 <!-- ***************************************** -->
990 <xsl:when test="$name='proof'">
991 <m:maction actiontype="toggle">
992 <!-- CSC: $explodeall until the annotationHelper can handle mactions -->
993 <xsl:variable name="test" select="(not($explodeall)) and
994 (not(preceding-sibling::*[1]/text()='letin1')) and
995 (not(preceding-sibling::*[1]/text()='rw_step')) and
996 (not(name(..)='m:lambda'))"/>
997 <xsl:if test="$test">
998 <!-- Details hided (default) -->
999 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1003 <m:mtext mathcolor="Maroon">We can prove</m:mtext>
1004 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1005 <xsl:apply-templates select="*[position()=3]"/>
1007 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1008 <m:mtext mathcolor="Green">(explain)</m:mtext>
1015 <!-- Show details -->
1016 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1020 <xsl:apply-templates select="*[position()=2]"/>
1027 <m:mtext mathcolor="Maroon">we proved</m:mtext>
1028 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1029 <xsl:apply-templates select="*[position()=3]"/>
1032 <m:mtext>_</m:mtext>
1034 <xsl:if test="$test">
1035 <m:mtext mathcolor="Green">(hide details)</m:mtext>
1045 <xsl:when test="$name='letin1'">
1046 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1050 <xsl:apply-templates select="*[2]"/>
1057 <xsl:apply-templates select="*[3]"/>
1063 <xsl:when test="$name='by_induction'">
1064 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1068 <m:mtext mathcolor="red">We prove</m:mtext>
1069 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1070 <xsl:apply-templates select="../*[3]"/>
1077 <m:mtext mathcolor="red">by induction on</m:mtext>
1078 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1079 <xsl:apply-templates
1080 select="*[position()=last()]/*[position()=last()]"/>
1087 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1088 <xsl:for-each select="*[position()>3 and not(position()=last())]">
1092 <xsl:apply-templates select="."/>
1103 <!-- inductive_case -->
1104 <xsl:when test="$name='inductive_case'">
1105 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1109 <m:mtext mathcolor="red">Case</m:mtext>
1110 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1111 <xsl:apply-templates select="*[2]"/>
1118 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1119 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1120 <xsl:if test="*[3]/*[position()>1]">
1124 <m:mtext mathcolor="red">By induction hypothesis, we have:</m:mtext>
1131 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1132 <xsl:for-each select="*[3]/*[position()>1]">
1133 <m:mo stretchy="false">(</m:mo>
1134 <xsl:apply-templates select="m:ci"/>
1135 <m:mo stretchy="false">) </m:mo>
1136 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1137 <xsl:apply-templates select="m:type"/>
1146 <xsl:apply-templates select="*[4]"/>
1157 <xsl:when test="$name='case_lhs'">
1160 <xsl:when test="count(*)=2">
1161 <xsl:apply-templates select="*[2]"/>
1164 <m:mo stretchy="false">(</m:mo>
1165 <xsl:apply-templates select="*[2]"/>
1166 <xsl:for-each select="m:bvar">
1167 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1168 <xsl:apply-templates select="*[1]"/>
1169 <m:mtext>:</m:mtext>
1170 <xsl:apply-templates select="m:type/*[1]"/>
1172 <m:mo stretchy="false">)</m:mo>
1178 <xsl:when test="$name='false_ind'">
1179 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1183 <xsl:apply-templates select="*[3]"/>
1190 <m:mtext mathcolor="Red">Contradiction.</m:mtext>
1197 <xsl:when test="$name='letin'">
1198 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1199 <!-- <xsl:for-each select="APPLY[m:csymbol and (string(m:csymbol)='let')]"> -->
1200 <xsl:for-each select="*[(last() > position()) and (position()>1)]">
1204 <xsl:apply-templates select="."/>
1212 <xsl:apply-templates select="*[position()=last()]"/>
1219 <xsl:when test="$name='let'">
1220 <m:mtext>(</m:mtext>
1221 <xsl:apply-templates select="m:ci"/>
1222 <m:mtext>) </m:mtext>
1223 <xsl:apply-templates select="*[3]"/>
1226 <xsl:when test="$name='rw_step'">
1227 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1232 <xsl:when test="name(*[2])='m:apply'">
1233 <xsl:apply-templates select="*[2]"/>
1236 <m:mtext>Consider</m:mtext>
1237 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1238 <xsl:apply-templates select="*[2]"/>
1247 <m:mtext>Rewrite</m:mtext>
1248 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1249 <xsl:apply-templates select="*[3]"/>
1250 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1251 <m:mtext>with</m:mtext>
1252 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1253 <xsl:apply-templates select="*[4]"/>
1254 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1255 <m:mtext>by</m:mtext>
1256 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1257 <xsl:apply-templates select="*[5]"/>
1263 <!-- not existing any more
1264 <xsl:when test="$name='thread'">
1265 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1270 <xsl:when test="name(*[last()])='m:apply'">
1271 <xsl:apply-templates select="*[last()]"/>
1274 <m:mtext>Consider</m:mtext>
1275 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1276 <xsl:apply-templates select="*[last()]"/>
1282 <xsl:apply-templates mode="thread" select="*[(last()-2)]"/>
1286 <!-- REWRITE_AND_APPLY -->
1287 <xsl:when test="$name='rewrite_and_apply'">
1288 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1292 <xsl:apply-templates select="*[2]"/>
1299 <m:mtext>Then apply it to</m:mtext>
1300 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1301 <xsl:apply-templates select="*[position()>2]"/>
1308 <xsl:when test="$name='and_ind'">
1309 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1314 <xsl:when test="name(*[2])='m:apply'">
1315 <xsl:apply-templates select="*[2]"/>
1318 <m:mtext>Consider</m:mtext>
1319 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1320 <xsl:apply-templates select="*[2]"/>
1329 <m:mtext>In particular, we have</m:mtext>
1336 <m:mtext>(</m:mtext>
1337 <xsl:apply-templates select="*[3]"/>
1338 <m:mtext>)</m:mtext>
1339 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1340 <xsl:apply-templates select="*[4]"/>
1347 <m:mtext>(</m:mtext>
1348 <xsl:apply-templates select="*[5]"/>
1349 <m:mtext>)</m:mtext>
1350 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1351 <xsl:apply-templates select="*[6]"/>
1358 <xsl:apply-templates select="*[7]"/>
1364 <!-- full_or_ind -->
1365 <xsl:when test="$name='full_or_ind'">
1366 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1371 <xsl:when test="name(*[2])='m:apply'">
1372 <xsl:apply-templates select="*[2]"/>
1375 <m:mtext>Consider</m:mtext>
1376 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1377 <xsl:apply-templates select="*[2]"/>
1386 <m:mtext>We proceed by cases to prove</m:mtext>
1387 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1388 <xsl:apply-templates select="*[3]"/>
1395 <m:mtext>Left: suppose</m:mtext>
1396 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1397 <m:mo stretchy="false">(</m:mo>
1398 <xsl:apply-templates select="*[4]/m:bvar/m:ci"/>
1399 <m:mo stretchy="false">)</m:mo>
1400 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1401 <xsl:apply-templates select="*[4]/m:bvar/m:type/*[1]"/>
1408 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1409 <xsl:apply-templates select="*[4]/*[3]"/>
1416 <m:mtext>Right: suppose</m:mtext>
1417 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1418 <m:mo stretchy="false">(</m:mo>
1419 <xsl:apply-templates select="*[5]/m:bvar/m:ci"/>
1420 <m:mo stretchy="false">)</m:mo>
1421 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1422 <xsl:apply-templates select="*[5]/m:bvar/m:type/*[1]"/>
1429 <xsl:apply-templates select="*[5]/*[3]"/>
1436 <xsl:when test="$name='or_ind'">
1437 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1442 <xsl:when test="name(*[2])='m:apply'">
1443 <xsl:apply-templates select="*[2]"/>
1446 <m:mtext>Consider</m:mtext>
1447 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1448 <xsl:apply-templates select="*[2]"/>
1457 <m:mtext>We prove</m:mtext>
1458 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1459 <xsl:apply-templates select="*[3]"/>
1460 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1461 <m:mtext>by cases:</m:mtext>
1468 <m:mtext>Left</m:mtext>
1469 <xsl:apply-templates select="*[4]"/>
1476 <m:mtext>Right</m:mtext>
1477 <xsl:apply-templates select="*[5]"/>
1484 <xsl:when test="$name='ex_ind'">
1485 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1490 <xsl:when test="name(*[2])='m:apply'">
1491 <xsl:apply-templates select="*[2]"/>
1494 <m:mtext>Consider</m:mtext>
1495 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1496 <xsl:apply-templates select="*[2]"/>
1505 <m:mtext>Let</m:mtext>
1506 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1507 <xsl:apply-templates select="*[3]"/>
1508 <m:mtext>:</m:mtext>
1509 <xsl:apply-templates select="*[4]"/>
1510 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1511 <m:mtext>such that</m:mtext>
1512 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1513 <m:mtext>(</m:mtext>
1514 <xsl:apply-templates select="*[5]"/>
1515 <m:mtext>)</m:mtext>
1516 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1517 <xsl:apply-templates select="*[6]"/>
1524 <xsl:apply-templates select="*[7]"/>
1530 <!-- ***************************************** -->
1531 <!-- *********** NOTATIONS ******************* -->
1532 <!-- ***************************************** -->
1534 <xsl:when test="$name='subst'">
1535 <xsl:apply-templates select="*[3]"/>
1536 <!-- no font for ApplyFunction: <m:mo></m:mo> -->
1537 <m:mo stretchy="false">[</m:mo>
1538 <xsl:apply-templates select="*[4]"/>
1539 <m:mo mathcolor="green">
1540 <xsl:if test="$id != ''">
1541 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1542 </xsl:if>←</m:mo>
1543 <xsl:apply-templates select="*[2]"/>
1544 <m:mo stretchy="false">]</m:mo>
1547 <xsl:when test="$name='lift'">
1549 <m:mo mathcolor="green">
1550 <xsl:if test="$id != ''">
1551 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1552 </xsl:if>↑</m:mo>
1553 <xsl:apply-templates select="*[2]"/>
1556 <m:mo stretchy="false">(</m:mo>
1557 <xsl:apply-templates select="*[3]"/>
1558 <m:mo stretchy="false">)</m:mo>
1561 <!-- lift_with_base -->
1562 <xsl:when test="$name='lift_with_base'">
1564 <m:mo mathcolor="green">
1565 <xsl:if test="$id != ''">
1566 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1567 </xsl:if>↑</m:mo>
1568 <xsl:apply-templates select="*[3]"/>
1569 <xsl:apply-templates select="*[4]"/>
1572 <m:mo stretchy="false">(</m:mo>
1573 <xsl:apply-templates select="*[2]"/>
1574 <m:mo stretchy="false">)</m:mo>
1578 <xsl:when test="$name='beta_red1'">
1579 <xsl:apply-templates select="*[2]"/>
1581 <m:mo mathcolor="green">
1582 <xsl:if test="$id != ''">
1583 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1584 </xsl:if>→</m:mo>
1585 <m:mi mathcolor="green">β</m:mi>
1587 <xsl:apply-templates select="*[3]"/>
1590 <xsl:when test="$name='beta_red'">
1591 <xsl:apply-templates select="*[2]"/>
1593 <m:mo mathcolor="green">
1594 <xsl:if test="$id != ''">
1595 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1596 </xsl:if>→</m:mo>
1597 <m:mi mathcolor="green">β</m:mi>
1598 <m:mi mathcolor="green">*</m:mi>
1600 <xsl:apply-templates select="*[3]"/>
1602 <!-- par_beta_red1 -->
1603 <xsl:when test="$name='par_beta_red1'">
1604 <xsl:apply-templates select="*[2]"/>
1606 <m:mo mathcolor="green">
1607 <xsl:if test="$id != ''">
1608 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1609 </xsl:if>⇒</m:mo>
1610 <m:mi mathcolor="green">β</m:mi>
1612 <xsl:apply-templates select="*[3]"/>
1614 <!-- par_beta_red -->
1615 <xsl:when test="$name='par_beta_red'">
1616 <xsl:apply-templates select="*[2]"/>
1618 <m:mo mathcolor="green">
1619 <xsl:if test="$id != ''">
1620 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1621 </xsl:if>⇒</m:mo>
1622 <m:mi mathcolor="green">β</m:mi>
1623 <m:mi mathcolor="green">*</m:mi>
1625 <xsl:apply-templates select="*[3]"/>
1628 <xsl:when test="$name='forgetful'">
1629 <m:mfenced open="|" close="|">
1630 <xsl:if test="$id != ''">
1631 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1633 <xsl:apply-templates select="*[2]"/>
1637 <xsl:when test="$name='isomorphic'">
1638 <xsl:apply-templates select="*[2]"/>
1639 <m:mo mathcolor="green">
1640 <xsl:if test="$id != ''">
1641 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1642 </xsl:if>≅</m:mo>
1643 <xsl:apply-templates select="*[3]"/>
1646 <xsl:when test="$name='forgetful'">
1647 <m:mfenced open="[" close="]">
1648 <xsl:if test="$id != ''">
1649 <xsl:attribute name="m:xref"><xsl:value-of select="$id"/></xsl:attribute>
1651 <xsl:apply-templates select="*[2]"/>
1663 <!-- Il modo Thread non esiste piu'
1664 <xsl:template match="*" mode="thread">
1665 <xsl:variable name="name"><xsl:value-of select="following-sibling::*[position()=1]/m:csymbol"/></xsl:variable>
1667 <xsl:when test="$name='rw_step'">
1671 <m:mtext>Rewrite</m:mtext>
1672 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1673 <xsl:apply-templates select="following-sibling::*[position()=1]/*[2]"/>
1674 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1675 <m:mtext>with</m:mtext>
1676 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1677 <xsl:apply-templates select="following-sibling::*[position()=1]/*[3]"/>
1678 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1679 <m:mtext>by</m:mtext>
1680 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1681 <xsl:apply-templates select="following-sibling::*[position()=1]/*[4]"/>
1688 <m:mtext mathcolor="Maroon">we get</m:mtext>
1689 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1690 <xsl:apply-templates select="."/>
1699 <xsl:apply-templates select="following-sibling::*[position()=1]"/>
1706 <m:mtext mathcolor="Maroon">we get</m:mtext>
1707 <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
1708 <xsl:apply-templates select="."/>
1714 <xsl:apply-templates mode="thread" select="preceding-sibling::*[position()=2]"/>
1720 <xsl:template match="m:lambda">
1721 <xsl:variable name="charlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"/></xsl:variable>
1724 <xsl:attribute name="m:xref">
1725 <xsl:value-of select="@id"/>
1729 <xsl:when test="$charlength >= $framewidth">
1730 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1734 <m:mo mathcolor="Red">λ</m:mo>
1735 <xsl:apply-templates select="m:bvar"/>
1743 <xsl:apply-templates select="*[position()=2]"/>
1750 <m:mo mathcolor="Red">λ</m:mo>
1751 <xsl:apply-templates select="m:bvar/m:ci"/>
1753 <xsl:apply-templates select="m:bvar/m:type"/>
1755 <xsl:apply-templates select="*[position()=2]"/>
1761 <!-- *********************************** -->
1762 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
1763 <!-- *********************************** -->
1767 <xsl:template match = "m:apply[m:eq[1]]">
1768 <xsl:variable name="charlength">
1769 <xsl:apply-templates select="*[1]" mode="charcount"/>
1772 <xsl:when test="$charlength >= $framewidth">
1773 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1775 <xsl:attribute name="m:xref">
1776 <xsl:value-of select="@id"/>
1782 <m:mo stretchy="false">(</m:mo>
1783 <xsl:apply-templates select="*[position()=2]"/>
1787 <xsl:for-each select = "*[position()>2]">
1791 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1793 <xsl:if test="m:in/@id">
1794 <xsl:attribute name="m:xref">
1795 <xsl:value-of select="m:in/@id"/>
1798 <xsl:apply-templates select="."/>
1806 <m:mo stretchy="false">)</m:mo>
1813 <xsl:apply-imports/>
1819 <xsl:template match = "m:apply[m:and[1]|m:or[1]
1820 |m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]
1821 |m:in[1]|m:intesect[1]|m:union[1]|m:subset[1]
1822 |m:prsubset|m:setdiff[1]]">
1823 <xsl:variable name="symbol">
1825 <xsl:when test="m:and[1]">
1826 <xsl:value-of select="'∧'"/>
1828 <xsl:when test="m:or[1]">
1829 <xsl:value-of select="'∨'"/>
1831 <xsl:when test="m:geq[1]">
1832 <xsl:value-of select="'≥'"/>
1834 <xsl:when test="m:leq[1]">
1835 <xsl:value-of select="'≤'"/>
1837 <xsl:when test="m:gt[1]">
1838 <xsl:value-of select="'>'"/>
1840 <xsl:when test="m:lt[1]">
1841 <xsl:value-of select="'< '"/>
1843 <xsl:when test="m:eq[1]">
1844 <xsl:value-of select="'='"/>
1846 <xsl:when test="m:in[1]">
1847 <xsl:value-of select="'∈'"/>
1849 <xsl:when test="m:subset[1]">
1850 <xsl:value-of select="'⊆'"/>
1852 <xsl:when test="m:prsubset[1]">
1853 <xsl:value-of select="'⊂'"/>
1855 <xsl:when test="m:intersect[1]">
1856 <xsl:value-of select="'⋂'"/>
1858 <xsl:when test="m:union[1]">
1859 <xsl:value-of select="'⋃'"/>
1861 <xsl:when test="m:setdiff[1]">
1862 <xsl:value-of select="'∖'"/>
1866 <xsl:variable name="charlength">
1867 <xsl:apply-templates select="*[1]" mode="charcount"/>
1870 <xsl:when test="$charlength >= $framewidth">
1871 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1873 <xsl:attribute name="m:xref">
1874 <xsl:value-of select="@id"/>
1880 <m:mo stretchy="false">(</m:mo>
1881 <xsl:apply-templates select="*[position()=2]"/>
1885 <xsl:for-each select = "*[position()>2]">
1889 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
1891 <xsl:if test="*[1]/@id">
1892 <xsl:attribute name="m:xref">
1893 <xsl:value-of select="*[1]/@id"/>
1895 </xsl:if><xsl:value-of select="$symbol"/></m:mo>
1896 <xsl:apply-templates select="."/>
1904 <m:mo stretchy="false">)</m:mo>
1911 <xsl:apply-imports/>
1916 <xsl:template match = "m:set">
1918 <xsl:when test="count(child::*) = 0">
1921 <xsl:attribute name="m:xref">
1922 <xsl:value-of select="@id"/>
1924 </xsl:if>∅</m:mi>
1927 <xsl:variable name="charlength">
1928 <xsl:apply-templates select="*[1]" mode="charcount"/>
1931 <xsl:when test="$charlength >= $framewidth">
1933 <xsl:when test="name(*[1]) = 'm:bvar'">
1934 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1938 <m:mo stretchy="false">
1940 <xsl:attribute name="m:xref">
1941 <xsl:value-of select="@id"/>
1944 <xsl:apply-templates select="*[position()=1]"/>
1951 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1952 <m:mo stretchy="false">|</m:mo>
1953 <xsl:apply-templates select="m:condition/*[1]"/>
1960 <m:mo stretchy="false">
1962 <xsl:attribute name="m:xref">
1963 <xsl:value-of select="@id"/>
1972 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
1976 <m:mo stretchy="false">
1978 <xsl:attribute name="m:xref">
1979 <xsl:value-of select="@id"/>
1982 <xsl:apply-templates select="*[position()=1]"/>
1983 <xsl:if test="position() != last()">
1989 <xsl:for-each select = "*[position()>2]">
1993 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
1994 <xsl:apply-templates select="."/>
1995 <xsl:if test="position() != last()">
2005 <m:mo stretchy="false">
2007 <xsl:attribute name="m:xref">
2008 <xsl:value-of select="@id"/>
2019 <xsl:apply-imports/>
2026 <xsl:template match = "m:apply[m:card[1]]">
2027 <m:mfenced open="|" close="|" stretchy="false">
2028 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2029 <xsl:attribute name="m:xref">
2030 <xsl:value-of select="@id"/>
2033 <xsl:apply-templates select="*[2]"/>
2038 <!--**********************-->
2040 <!--**********************-->
2042 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:lt|m:leq|m:gt|m:geq
2043 |m:in|m:notin|m:intersect|m:union|m:subset|m:prsubset|m:card|m:setdiff
2044 |m:plus|m:minus|m:times" mode="charcount">
2045 <xsl:param name="incurrent_length" select="0"/>
2047 <xsl:when test="$framewidth > ($incurrent_length + 3 + string-length())">
2048 <xsl:variable name="siblength">
2049 <xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount">
2050 <xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/>
2051 </xsl:apply-templates>
2054 <xsl:when test="string($siblength) = """>
2055 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2058 <xsl:value-of select="number($siblength)"/>
2063 <xsl:value-of select="$incurrent_length + 3 + string-length()"/>
2068 <xsl:template match="m:ci|m:csymbol" mode="charcount">
2069 <xsl:param name="incurrent_length" select="0"/>
2070 <xsl:param name="nosibling" select="0"/>
2072 <xsl:when test="$framewidth > ($incurrent_length + string-length()) and ($nosibling = 0)">
2073 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
2075 <xsl:when test="string($siblength) = """>
2076 <xsl:value-of select="$incurrent_length + string-length()"/>
2079 <xsl:value-of select="number($siblength)"/>
2084 <xsl:value-of select="$incurrent_length + string-length()"/>
2089 <xsl:template match="*" mode="charcount">
2090 <xsl:param name="incurrent_length" select="0"/>
2091 <xsl:param name="nosibling" select="0"/>
2093 <xsl:when test="count(child::*) = 0">
2094 <xsl:value-of select="$incurrent_length"/>
2097 <xsl:variable name="childlength"><xsl:apply-templates select="*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length"/><xsl:with-param name="nosibling" select="0"/></xsl:apply-templates></xsl:variable>
2099 <xsl:when test="$framewidth > number($childlength) and ($nosibling = 0)">
2100 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$childlength"/></xsl:apply-templates></xsl:variable>
2102 <xsl:when test="string($siblength) = """>
2103 <xsl:value-of select="number($childlength)"/>
2106 <xsl:value-of select="number($siblength)"/>
2111 <xsl:value-of select="number($childlength)"/>