]> matita.cs.unibo.it Git - helm.git/blob - helm/style/contentlib.xsl
6efe8d6c993476cca6bdbb24a660cf5f9424bda8
[helm.git] / helm / style / contentlib.xsl
1 <?xml version="1.0"?>
2
3 <!-- Copyright (C) 2000, HELM Team                                     -->
4 <!--                                                                   -->
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.                         -->
8 <!--                                                                   -->
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.            -->
13 <!--                                                                   -->
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.                      -->
18 <!--                                                                   -->
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.                                              -->
23 <!--                                                                   -->
24 <!-- For details, see the HELM World-Wide-Web page,                    -->
25 <!-- http://cs.unibo.it/helm/.                                         -->
26
27 <!--******************************************************************--> 
28 <!-- Library for MML Content                                          -->
29 <!-- First draft: March 20 2001, Ferruccio Guidi                      -->
30 <!--******************************************************************-->
31
32 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33                               xmlns:m="http://www.w3.org/1998/Math/MathML"
34                               xmlns:helm="http://www.cs.unibo.it/helm"
35                               xmlns:xlink="http://www.w3.org/1999/xlink">
36
37 <xsl:template name="mkmml-op-noannot"> <!-- make MML node for operators (noannot mode) --> 
38    <xsl:param name="arity"/>           <!-- operator arity        -->
39    <xsl:param name="c-tag"/>           <!-- CIC    tag            -->
40    <xsl:param name="m-tag"/>           <!-- MathML tag            -->
41    <xsl:choose>
42       <xsl:when test="count(child::*) = $arity + 1">
43          <m:apply helm:xref="{@id}">
44             <xsl:element name="{concat('m:',$m-tag)}">
45                <xsl:attribute name="definitionURL">
46                   <xsl:value-of select="$c-tag/@uri"/> 
47                </xsl:attribute>
48                <xsl:attribute name="helm:xref">
49                   <xsl:value-of select="$c-tag/@id"/>
50                </xsl:attribute>
51             </xsl:element>
52             <xsl:apply-templates select="*[position() > 1]" mode="noannot"/>
53          </m:apply>
54       </xsl:when>
55       <xsl:otherwise>
56          <xsl:apply-imports/>
57       </xsl:otherwise>
58    </xsl:choose>
59 </xsl:template>
60
61 <xsl:template name="start-interp"> <!-- interp mode starter -->
62    <xsl:param name="rtree"/>
63    <xsl:param name="atree"/>   
64    <m:apply helm:xref="{@id}">
65       <m:csymbol>interp</m:csymbol>
66       <xsl:apply-templates mode="interp" select="$rtree">
67          <xsl:with-param name="atree" select="$atree"/>
68       </xsl:apply-templates>
69    </m:apply>
70 </xsl:template>
71
72 <xsl:template name="mkmml-op-interp"> <!-- make MML node for operators (interp mode) --> 
73    <xsl:param name="arity"/>          <!-- operator arity        -->
74    <xsl:param name="c-tag"/>          <!-- CIC    tag            -->
75    <xsl:param name="m-tag"/>          <!-- MathML tag            -->
76    <xsl:param name="atree"/>          <!-- abstract tree pointer -->
77    <xsl:choose>
78       <xsl:when test="count(child::*) = $arity + 1">
79          <m:apply helm:xref="{@id}">
80             <xsl:element name="{concat('m:',$m-tag)}">
81                <xsl:attribute name="definitionURL">
82                   <xsl:value-of select="$c-tag/@uri"/> 
83                </xsl:attribute>
84                <xsl:attribute name="helm:xref">
85                   <xsl:value-of select="$c-tag/@id"/>
86                </xsl:attribute>
87             </xsl:element>
88             <xsl:apply-templates select="*[position() > 1]" mode="interp">
89                <xsl:with-param name="atree" select="$atree"/>
90             </xsl:apply-templates>
91          </m:apply>
92       </xsl:when>
93       <xsl:otherwise>
94          <xsl:apply-imports/>
95       </xsl:otherwise>
96    </xsl:choose>
97 </xsl:template>
98
99 </xsl:stylesheet>