]> matita.cs.unibo.it Git - helm.git/blob - helm/style/objcontent.xsl
Explicit substitutions for metavariables introduced and DTD changed.
[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:apply-templates select="*[1]"/>
65       </xsl:copy>
66      </xsl:for-each>
67      <Goal>
68       <xsl:apply-templates select="Goal/*[1]"/>
69      </Goal>
70     </Sequent> 
71 </xsl:template>
72
73 <xsl:template match="Definition" mode="noannot">
74     <Definition name="{@name}" helm:xref="{@id}">  
75      <xsl:if test="string(@params) != &quot;&quot;">
76       <Params>
77        <xsl:value-of select="@params"/>
78       </Params>
79      </xsl:if>
80 <!--     <xsl:choose>
81       <xsl:when test="$showproof=0">
82        <body>
83         <m:mi>Here</m:mi>
84        </body>
85       </xsl:when>
86       <xsl:otherwise>
87        <body>
88         <xsl:apply-templates select="body"/>
89        </body>
90       </xsl:otherwise>
91      </xsl:choose> -->
92      <body>
93       <xsl:apply-templates select="body/*[1]"/>
94      </body>
95      <type>
96        <xsl:apply-templates select="type/*[1]"/>
97      </type>
98     </Definition> 
99 </xsl:template>
100
101 <xsl:template match="Axiom" mode="noannot"> 
102     <Axiom name="{@name}" helm:xref="{@id}">
103      <xsl:if test="string(@params) != &quot;&quot;">
104       <Params>
105        <xsl:value-of select="@params"/>
106       </Params>
107      </xsl:if>
108      <type>
109        <xsl:apply-templates select="type/*[1]"/>
110      </type>
111     </Axiom> 
112 </xsl:template>
113
114 <xsl:template match="CurrentProof" mode="noannot">
115     <CurrentProof name="{@name}" helm:xref="{@id}">
116      <xsl:for-each select="Conjecture">
117       <Conjecture no="{@no}">
118         <xsl:for-each select="*">
119          <xsl:copy>
120           <xsl:copy-of select="@*"/>
121           <xsl:apply-templates select="*"/>
122          </xsl:copy>
123         </xsl:for-each>
124       </Conjecture>
125      </xsl:for-each>
126      <body>
127        <xsl:apply-templates select="body/*[1]"/>
128      </body>
129      <type>
130        <xsl:apply-templates select="type/*[1]"/>
131      </type>
132     </CurrentProof> 
133 </xsl:template>
134
135 <xsl:template match="InductiveDefinition" mode="noannot">
136     <InductiveDefinition helm:xref="{@id}">
137      <xsl:if test="string(@params) != &quot;&quot;">
138       <Params>
139        <xsl:value-of select="@params"/>
140       </Params>
141      </xsl:if> 
142      <xsl:if test="string(@noParams) != 0"> 
143       <xsl:apply-templates select="InductiveType/arity/*[1]" mode="abstparams">
144        <xsl:with-param name="noparams" select="@noParams"/>
145       </xsl:apply-templates>
146      </xsl:if>
147      <xsl:for-each select="InductiveType">
148       <InductiveType name="{./@name}" inductive="{./@inductive}">
149        <arity>
150          <xsl:apply-templates select="./arity/*[1]" mode="abstparams">
151           <xsl:with-param name="noparams" select="../@noParams"/>
152           <xsl:with-param name="target" select="1"/>
153          </xsl:apply-templates>
154        </arity>
155        <xsl:for-each select="./Constructor">
156         <Constructor name="{./@name}">
157           <xsl:apply-templates select="./*[1]" mode="abstparams">
158            <xsl:with-param name="noparams" select="../../@noParams"/>
159            <xsl:with-param name="target" select="1"/>
160           </xsl:apply-templates>
161         </Constructor>
162        </xsl:for-each>
163       </InductiveType>
164      </xsl:for-each> 
165     </InductiveDefinition>       
166 </xsl:template>
167
168 <xsl:template match="Variable" mode="noannot"> 
169     <Variable name="{@name}" helm:xref="{@id}">
170      <xsl:if test="name(*[1])='body'">
171       <body>
172        <xsl:apply-templates select="body/*[1]"/>
173       </body>
174      </xsl:if>
175      <type>
176        <xsl:apply-templates select="type/*[1]"/>
177      </type>
178     </Variable> 
179 </xsl:template>
180
181 </xsl:stylesheet>