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="*[position()=2]"/>
146 <xsl:for-each select = "*[position()>2]">
150 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
152 <xsl:if test="*[1]/@id">
153 <xsl:attribute name="xref">
154 <xsl:value-of select="*[1]/@id"/>
156 </xsl:if><xsl:value-of select="$symbol"/></m:mo>
157 <xsl:apply-templates select="."/>
165 <m:mo stretchy="false">)</m:mo>
177 <!-- apply-imports with parenthesis -->
178 <xsl:template match = "m:apply[m:and[1]|m:or[1]
179 |m:intesect[1]|m:union[1]|m:setdiff[1]]">
180 <xsl:variable name="symbol">
182 <xsl:when test="m:and[1]">
183 <xsl:value-of select="'∧'"/>
185 <xsl:when test="m:or[1]">
186 <xsl:value-of select="'∨'"/>
188 <xsl:when test="m:intersect[1]">
189 <xsl:value-of select="'⋂'"/>
191 <xsl:when test="m:union[1]">
192 <xsl:value-of select="'⋃'"/>
194 <xsl:when test="m:setdiff[1]">
195 <xsl:value-of select="'∖'"/>
199 <xsl:variable name="charlength">
200 <xsl:apply-templates select="*[1]" mode="charcount"/>
203 <xsl:when test="$charlength >= $framewidth">
204 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
206 <xsl:attribute name="xref">
207 <xsl:value-of select="@id"/>
213 <m:mo stretchy="false">(</m:mo>
214 <xsl:apply-templates select="*[position()=2]"/>
218 <xsl:for-each select = "*[position()>2]">
222 <m:mphantom><m:mtext>__</m:mtext></m:mphantom>
224 <xsl:if test="*[1]/@id">
225 <xsl:attribute name="xref">
226 <xsl:value-of select="*[1]/@id"/>
228 </xsl:if><xsl:value-of select="$symbol"/></m:mo>
229 <xsl:apply-templates select="."/>
237 <m:mo stretchy="false">)</m:mo>
244 <!-- Added mfenced because apply-imports doesn't support with-param for
245 precedence (XSLT 2.0) -->
246 <m:mfenced separators=" ">
253 <xsl:template match = "m:set">
255 <xsl:when test="count(child::*) = 0">
258 <xsl:attribute name="xref">
259 <xsl:value-of select="@id"/>
261 </xsl:if>∅</m:mi>
264 <xsl:variable name="charlength">
265 <xsl:apply-templates select="*[1]" mode="charcount"/>
268 <xsl:when test="$charlength >= $framewidth">
270 <xsl:when test="name(*[1]) = 'm:bvar'">
271 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
275 <m:mo stretchy="false">
277 <xsl:attribute name="xref">
278 <xsl:value-of select="@id"/>
281 <xsl:apply-templates select="*[position()=1]"/>
288 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
289 <m:mo stretchy="false">|</m:mo>
290 <xsl:apply-templates select="m:condition/*[1]"/>
297 <m:mo stretchy="false">
299 <xsl:attribute name="xref">
300 <xsl:value-of select="@id"/>
309 <m:mtable align="baseline 1" equalrows="false" columnalign="left">
313 <m:mo stretchy="false">
315 <xsl:attribute name="xref">
316 <xsl:value-of select="@id"/>
319 <xsl:apply-templates select="*[position()=1]"/>
320 <xsl:if test="position() != last()">
326 <xsl:for-each select = "*[position()>2]">
330 <m:mphantom><m:mtext>{</m:mtext></m:mphantom>
331 <xsl:apply-templates select="."/>
332 <xsl:if test="position() != last()">
342 <m:mo stretchy="false">
344 <xsl:attribute name="xref">
345 <xsl:value-of select="@id"/>
363 <xsl:template match = "m:apply[m:card[1]]">
364 <m:mfenced open="|" close="|" stretchy="false">
365 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
366 <xsl:attribute name="xref">
367 <xsl:value-of select="@id"/>
370 <xsl:apply-templates select="*[2]"/>
375 <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'))]">
377 <xsl:when test="local-name(.) = 'neq'">
378 <xsl:value-of select="'≠'"/>
380 <xsl:when test="local-name(.) = 'lt'">
381 <xsl:value-of select="'< '"/>
383 <xsl:when test="local-name(.) = 'gt'">
384 <xsl:value-of select="'>'"/>
386 <xsl:when test="local-name(.) = 'leq'">
387 <xsl:value-of select="'≤'"/>
389 <xsl:when test="local-name(.) = 'geq'">
390 <xsl:value-of select="'≥'"/>
393 <xsl:value-of select="'='"/>