]> matita.cs.unibo.it Git - helm.git/blob - helm/style/objcontent.xsl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / style / objcontent.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 <!-- XSLT version 0.1 of CIC objects to objects and MathML content:   -->
29 <!-- First draft: March 21 2000, Irene Schena                         -->
30 <!--******************************************************************-->
31
32 <!--******************************************************************-->
33 <!-- MANCA: gestione annotation e linking                             -->
34 <!--******************************************************************-->
35
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"
38                               xmlns:helm="http://www.cs.unibo.it/helm">
39
40 <xsl:import href="content.xsl"/>
41
42 <!-- ROOT -->
43
44 <xsl:template match="cicxml">
45     <xsl:variable name="url"><xsl:value-of select="@baseurl"/></xsl:variable>
46     <xsl:variable name="stylesheet"><xsl:value-of select="@stylesheet"/></xsl:variable>
47     <!--
48     <xsl:processing-instruction name="cocoon-format">type="text/xml"</xsl:processing-instruction>
49     <xsl:processing-instruction name="xml-stylesheet">href="<xsl:value-of select='concat($url,$stylesheet)'/>" type="text/xsl"</xsl:processing-instruction>
50     <xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
51     -->
52     <xsl:apply-templates select="*[1]"/>
53 </xsl:template>
54
55 <!-- CIC OBJECTS -->
56
57 <xsl:template match="Sequent">  <!-- For Sequents there are no annotations --> 
58     <Sequent helm:xref="{@id}" no="{@no}">
59      <xsl:for-each select="Decl|Def|Hidden">
60       <xsl:copy>
61        <xsl:attribute name="name">
62         <xsl:value-of select="@name"/>
63        </xsl:attribute>
64        <xsl:attribute name="helm:xref">
65         <xsl:value-of select="@id"/>
66        </xsl:attribute>
67        <xsl:apply-templates select="*[1]"/>
68       </xsl:copy>
69      </xsl:for-each>
70      <Goal>
71       <xsl:apply-templates select="Goal/*[1]"/>
72      </Goal>
73     </Sequent> 
74 </xsl:template>
75
76 <xsl:template match="Definition" mode="noannot">
77     <Definition name="{@name}" helm:xref="{@id}">  
78      <xsl:if test="string(@params) != &quot;&quot;">
79       <Params>
80        <xsl:value-of select="@params"/>
81       </Params>
82      </xsl:if>
83 <!--     <xsl:choose>
84       <xsl:when test="$showproof=0">
85        <body>
86         <m:mi>Here</m:mi>
87        </body>
88       </xsl:when>
89       <xsl:otherwise>
90        <body>
91         <xsl:apply-templates select="body"/>
92        </body>
93       </xsl:otherwise>
94      </xsl:choose> -->
95      <body>
96       <xsl:apply-templates select="body/*[1]"/>
97      </body>
98      <type>
99        <xsl:apply-templates select="type/*[1]"/>
100      </type>
101     </Definition> 
102 </xsl:template>
103
104 <xsl:template match="Axiom" mode="noannot"> 
105     <Axiom name="{@name}" helm:xref="{@id}">
106      <xsl:if test="string(@params) != &quot;&quot;">
107       <Params>
108        <xsl:value-of select="@params"/>
109       </Params>
110      </xsl:if>
111      <type>
112        <xsl:apply-templates select="type/*[1]"/>
113      </type>
114     </Axiom> 
115 </xsl:template>
116
117 <xsl:template match="CurrentProof" mode="noannot">
118     <CurrentProof name="{@name}" helm:xref="{@id}">
119      <xsl:for-each select="Conjecture">
120       <Conjecture no="{@no}" helm:xref="{@id}">
121         <xsl:for-each select="*">
122          <xsl:copy>
123           <xsl:copy-of select="@name"/>
124           <xsl:attribute name="helm:xref">
125            <xsl:value-of select="@id"/>
126           </xsl:attribute>
127           <xsl:apply-templates select="*"/>
128          </xsl:copy>
129         </xsl:for-each>
130       </Conjecture>
131      </xsl:for-each>
132      <body>
133        <xsl:apply-templates select="body/*[1]"/>
134      </body>
135      <type>
136        <xsl:apply-templates select="type/*[1]"/>
137      </type>
138     </CurrentProof> 
139 </xsl:template>
140
141 <xsl:template match="InductiveDefinition" mode="noannot">
142     <InductiveDefinition helm:xref="{@id}">
143      <xsl:if test="string(@params) != &quot;&quot;">
144       <Params>
145        <xsl:value-of select="@params"/>
146       </Params>
147      </xsl:if> 
148      <xsl:if test="string(@noParams) != 0"> 
149       <xsl:apply-templates select="InductiveType/arity/*[1]" mode="abstparams">
150        <xsl:with-param name="noparams" select="@noParams"/>
151       </xsl:apply-templates>
152      </xsl:if>
153      <xsl:for-each select="InductiveType">
154       <InductiveType name="{./@name}" inductive="{./@inductive}">
155        <arity>
156          <xsl:apply-templates select="./arity/*[1]" mode="abstparams">
157           <xsl:with-param name="noparams" select="../@noParams"/>
158           <xsl:with-param name="target" select="1"/>
159          </xsl:apply-templates>
160        </arity>
161        <xsl:for-each select="./Constructor">
162         <Constructor name="{./@name}">
163           <xsl:apply-templates select="./*[1]" mode="abstparams">
164            <xsl:with-param name="noparams" select="../../@noParams"/>
165            <xsl:with-param name="target" select="1"/>
166           </xsl:apply-templates>
167         </Constructor>
168        </xsl:for-each>
169       </InductiveType>
170      </xsl:for-each> 
171     </InductiveDefinition>       
172 </xsl:template>
173
174 <xsl:template match="Variable" mode="noannot"> 
175     <Variable name="{@name}" helm:xref="{@id}">
176      <xsl:if test="name(*[1])='body'">
177       <body>
178        <xsl:apply-templates select="body/*[1]"/>
179       </body>
180      </xsl:if>
181      <type>
182        <xsl:apply-templates select="type/*[1]"/>
183      </type>
184     </Variable> 
185 </xsl:template>
186
187 </xsl:stylesheet>