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 <!-- Notational extensions to the XSLT version 0.07 of MathML content -->
29 <!-- to presentation: -->
30 <!-- First draft: February 19 2000, Andrea Asperti, Irene Schena -->
31 <!-- Revised: March 3 2000, Irene Schena -->
32 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
33 <!-- Revised: March 21 2000, Irene Schena -->
34 <!--***********************************************************************-->
36 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37 xmlns:m="http://www.w3.org/1998/Math/MathML">
39 <xsl:import href="mmlctop.xsl"/>
42 <!-- *********************************** -->
43 <!-- BASE SET OF MATHML CONTENT ELEMENTS -->
44 <!-- *********************************** -->
48 <xsl:template match = "m:apply[m:eq[1]]">
49 <xsl:variable name="charlength">
50 <xsl:apply-templates select="*[1]" mode="charcount"/>
53 <xsl:when test="$charlength >= $framewidth">
54 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
56 <xsl:attribute name="xref">
57 <xsl:value-of select="@id"/>
63 <m:mo stretchy="false">(</m:mo>
64 <xsl:apply-templates select="*[position()=2]"/>
68 <xsl:for-each select = "*[position()>2]">
72 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
74 <xsl:if test="m:in/@id">
75 <xsl:attribute name="xref">
76 <xsl:value-of select="m:in/@id"/>
79 <xsl:apply-templates select="."/>
87 <m:mo stretchy="false">)</m:mo>
99 <!-- apply-imports without parenthesis -->
100 <xsl:template match = "m:apply[m:geq[1]|m:leq[1]|m:gt[1]|m:lt[1]|m:in[1]|
101 m:subset[1]|m:prsubset[1]]">
102 <xsl:variable name="symbol">
104 <xsl:when test="m:geq[1]">
105 <xsl:value-of select="'≥'"/>
107 <xsl:when test="m:leq[1]">
108 <xsl:value-of select="'≤'"/>
110 <xsl:when test="m:gt[1]">
111 <xsl:value-of select="'>'"/>
113 <xsl:when test="m:lt[1]">
114 <xsl:value-of select="'< '"/>
116 <xsl:when test="m:in[1]">
117 <xsl:value-of select="'∈'"/>
119 <xsl:when test="m:subset[1]">
120 <xsl:value-of select="'⊆'"/>
122 <xsl:when test="m:prsubset[1]">
123 <xsl:value-of select="'⊂'"/>
127 <xsl:variable name="charlength">
128 <xsl:apply-templates select="*[1]" mode="charcount"/>
131 <xsl:when test="$charlength >= $framewidth">
132 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
134 <xsl:attribute name="xref">
135 <xsl:value-of select="@id"/>
141 <m:mo stretchy="false">(</m:mo>
142 <xsl:apply-templates select="*[2]"/>
149 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
151 <xsl:if test="*[1]/@id">
152 <xsl:attribute name="xref">
153 <xsl:value-of select="*[1]/@id"/>
155 </xsl:if><xsl:value-of select="$symbol"/></m:mo>
156 <xsl:apply-templates select="*[3]"/>
163 <m:mo stretchy="false">)</m:mo>
175 <!-- apply-imports with parenthesis -->
176 <xsl:template match = "m:apply[m:and[1]|m:or[1]
177 |m:intesect[1]|m:union[1]|m:setdiff[1]]">
178 <xsl:variable name="symbol">
180 <xsl:when test="m:and[1]">
181 <xsl:value-of select="'∧'"/>
183 <xsl:when test="m:or[1]">
184 <xsl:value-of select="'∨'"/>
186 <xsl:when test="m:intersect[1]">
187 <xsl:value-of select="'⋂'"/>
189 <xsl:when test="m:union[1]">
190 <xsl:value-of select="'⋃'"/>
192 <xsl:when test="m:setdiff[1]">
193 <xsl:value-of select="'∖'"/>
197 <xsl:variable name="charlength">
198 <xsl:apply-templates select="*[1]" mode="charcount"/>
201 <xsl:when test="$charlength >= $framewidth">
202 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
204 <xsl:attribute name="xref">
205 <xsl:value-of select="@id"/>
211 <m:mo stretchy="false">(</m:mo>
212 <xsl:apply-templates select="*[position()=2]"/>
216 <xsl:for-each select = "*[position()>2]">
220 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
222 <xsl:if test="*[1]/@id">
223 <xsl:attribute name="xref">
224 <xsl:value-of select="*[1]/@id"/>
226 </xsl:if><xsl:value-of select="$symbol"/></m:mo>
227 <xsl:apply-templates select="."/>
235 <m:mo stretchy="false">)</m:mo>
242 <!-- Added mfenced because apply-imports doesn't support with-param for
243 precedence (XSLT 2.0) -->
244 <m:mfenced separators=" ">
251 <xsl:template match = "m:set">
253 <xsl:when test="count(child::*) = 0">
256 <xsl:attribute name="xref">
257 <xsl:value-of select="@id"/>
259 </xsl:if>∅</m:mi>
262 <xsl:variable name="charlength">
263 <xsl:apply-templates select="*[1]" mode="charcount"/>
266 <xsl:when test="$charlength >= $framewidth">
268 <xsl:when test="name(*[1]) = 'm:bvar'">
269 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
273 <m:mo stretchy="false">
275 <xsl:attribute name="xref">
276 <xsl:value-of select="@id"/>
279 <xsl:apply-templates select="*[position()=1]"/>
286 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
287 <m:mo stretchy="false">|</m:mo>
288 <xsl:apply-templates select="m:condition/*[1]"/>
295 <m:mo stretchy="false">
297 <xsl:attribute name="xref">
298 <xsl:value-of select="@id"/>
307 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
311 <m:mo stretchy="false">
313 <xsl:attribute name="xref">
314 <xsl:value-of select="@id"/>
317 <xsl:apply-templates select="*[position()=1]"/>
318 <xsl:if test="position() != last()">
324 <xsl:for-each select = "*[position()>2]">
328 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
329 <xsl:apply-templates select="."/>
330 <xsl:if test="position() != last()">
340 <m:mo stretchy="false">
342 <xsl:attribute name="xref">
343 <xsl:value-of select="@id"/>
361 <xsl:template match = "m:apply[m:card[1]]">
362 <m:mfenced open="|" close="|" stretchy="false">
363 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
364 <xsl:attribute name="xref">
365 <xsl:value-of select="@id"/>
368 <xsl:apply-templates select="*[2]"/>
373 <xsl:template match = "m:eq[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))] | m:neq[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))] | m:lt[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))] | m:gt[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))] | m:leq[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))] | m:geq[((preceding-sibling::*/text()='eq_chain') or (preceding-sibling::*/text()='diseq_chain'))]">
375 <xsl:when test="local-name(.) = 'neq'">
376 <xsl:value-of select="'≠'"/>
378 <xsl:when test="local-name(.) = 'lt'">
379 <xsl:value-of select="'< '"/>
381 <xsl:when test="local-name(.) = 'gt'">
382 <xsl:value-of select="'>'"/>
384 <xsl:when test="local-name(.) = 'leq'">
385 <xsl:value-of select="'≤'"/>
387 <xsl:when test="local-name(.) = 'geq'">
388 <xsl:value-of select="'≥'"/>
391 <xsl:value-of select="'='"/>