]> matita.cs.unibo.it Git - helm.git/blob - helm/style/mk_dep_graph.xsl
New graph implementation: the visit is no more pruned on a level base, but
[helm.git] / helm / style / mk_dep_graph.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 <!-- CSC: Sostituire l'andata a capo con la entity numerica opportuna -->
28 <!DOCTYPE html [
29  <!ENTITY CSCbr "
30 ">
31 ]>
32
33 <xsl:stylesheet version="0.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34                               xmlns:ht="http://www.cs.unibo.it/helm/namespaces/helm-theory">
35
36 <xsl:output method="text"/>
37
38 <xsl:param name="CICURI" select="''"/>
39 <xsl:param name="PID" select="''"/>
40 <xsl:param name="getterURL" select="''"/>
41 <xsl:param name="uri_set_queueURL" select="'http://localhost:8084/'"/>
42 <xsl:param name="uri_set_size" select="30"/>
43 <xsl:variable name="base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=')"/>
44
45 <!-- CSC: next functions because I don't remember the name of the    -->
46 <!-- CSC: subst function of xslt and I don't have the specs with me -->
47 <xsl:template name="quote">
48  <xsl:param name="s" select="''"/>
49  <xsl:param name="news" select="''"/>
50  <xsl:choose>
51   <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
52   <xsl:otherwise>
53    <xsl:variable name="char" select="substring($s,1,1)"/>
54    <xsl:choose>
55     <xsl:when test="$char = '/'">
56      <xsl:call-template name="quote">
57       <xsl:with-param name="s" select="substring($s,2)"/>
58       <xsl:with-param name="news" select="concat($news,'X')"/>
59      </xsl:call-template>
60     </xsl:when>
61     <xsl:when test="$char = ':'">
62      <xsl:call-template name="quote">
63       <xsl:with-param name="s" select="substring($s,2)"/>
64       <xsl:with-param name="news" select="concat($news,'Y')"/>
65      </xsl:call-template>
66     </xsl:when>
67     <xsl:when test="$char = '.'">
68      <xsl:call-template name="quote">
69       <xsl:with-param name="s" select="substring($s,2)"/>
70       <xsl:with-param name="news" select="concat($news,'Z')"/>
71      </xsl:call-template>
72     </xsl:when>
73     <xsl:when test='$char = "&apos;"'>
74      <xsl:call-template name="quote">
75       <xsl:with-param name="s" select="substring($s,2)"/>
76       <xsl:with-param name="news" select="concat($news,'W')"/>
77      </xsl:call-template>
78     </xsl:when>
79     <xsl:when test="$char = '-'">
80      <xsl:call-template name="quote">
81       <xsl:with-param name="s" select="substring($s,2)"/>
82       <xsl:with-param name="news" select="concat($news,'J')"/>
83      </xsl:call-template>
84     </xsl:when>
85     <xsl:when test="$char = '#'">
86      <xsl:call-template name="quote">
87       <xsl:with-param name="s" select="substring($s,2)"/>
88       <xsl:with-param name="news" select="concat($news,'G')"/>
89      </xsl:call-template>
90     </xsl:when>
91     <xsl:when test="$char = '('">
92      <xsl:call-template name="quote">
93       <xsl:with-param name="s" select="substring($s,2)"/>
94       <xsl:with-param name="news" select="concat($news,'O')"/>
95      </xsl:call-template>
96     </xsl:when>
97     <xsl:when test="$char = ')'">
98      <xsl:call-template name="quote">
99       <xsl:with-param name="s" select="substring($s,2)"/>
100       <xsl:with-param name="news" select="concat($news,'C')"/>
101      </xsl:call-template>
102     </xsl:when>
103     <xsl:otherwise>
104      <xsl:call-template name="quote">
105       <xsl:with-param name="s" select="substring($s,2)"/>
106       <xsl:with-param name="news" select="concat($news,$char)"/>
107      </xsl:call-template>
108     </xsl:otherwise>
109    </xsl:choose>
110   </xsl:otherwise>
111  </xsl:choose>
112 </xsl:template>
113
114 <xsl:template match="/">
115  <!--
116  <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
117  -->
118  <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
119  <!-- The nonce is used to force the document reload -->
120  <xsl:variable name="dummy0" select="document(concat($uri_set_queueURL,'set_uri_set_size?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID,'&amp;size=',$uri_set_size))"/>
121  <xsl:variable name="dummy1" select="document(concat($uri_set_queueURL,'add_if_not_in?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
122  <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
123  <xsl:variable name="dummy2" select="document(concat($uri_set_queueURL,'reset_to_empty?PID=',$PID))"/>
124  <xsl:text>}</xsl:text>
125 </xsl:template>
126
127 <xsl:template mode="loop" match="empty"/>
128
129 <xsl:template mode="loop" match="uri|marked_uri">
130  <xsl:apply-templates mode="first_time" select="document(concat($base_URL_of_CIC_URI,@value))/*">
131   <xsl:with-param name="currentCICURI" select="@value"/>
132   <xsl:with-param name="quotedCurrentCICURI">
133    <xsl:call-template name="quote">
134     <xsl:with-param name="s" select="@value"/>
135    </xsl:call-template>
136   </xsl:with-param>
137   <xsl:with-param name="do_not_visit" select="name(.)"/>
138  </xsl:apply-templates>
139  <!-- The couple (uri,nonce) is used to force the document reload -->
140  <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',@value,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
141 </xsl:template>
142
143 <xsl:template mode="first_time" match="*">
144  <xsl:param name="currentCICURI" select="''"/>
145  <xsl:param name="quotedCurrentCICURI" select="''"/>
146  <xsl:param name="do_not_visit" select="'uri'"/>
147  <xsl:if test="$do_not_visit='uri'">
148   <xsl:apply-templates select=".">
149    <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
150    <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
151   </xsl:apply-templates>
152  </xsl:if>
153  <xsl:text> </xsl:text>
154  <xsl:value-of select="$quotedCurrentCICURI"/>
155 <!-- <xsl:text> [fontname="LucidaSansRegular",color=red,label="</xsl:text> -->
156  <xsl:text> [label="</xsl:text>
157  <xsl:value-of select="$currentCICURI"/>
158  <xsl:text>",URL="</xsl:text>
159  <xsl:value-of select="$currentCICURI"/>
160  <xsl:text>"</xsl:text>
161  <xsl:if test="name(document(concat($uri_set_queueURL,'is_overflowed?uri=',$quotedCurrentCICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))/*)='true'">
162   <xsl:text>,color=red</xsl:text>
163  </xsl:if>
164  <xsl:text>];&CSCbr;</xsl:text>
165 </xsl:template>
166
167 <!-- CSC: uriType missing!!! -->
168 <xsl:template match="*">
169  <xsl:param name="currentCICURI" select="''"/>
170  <xsl:param name="quotedCurrentCICURI" select="''"/>
171  <xsl:if test="@uri">
172   <xsl:variable name="quotedURI">
173    <xsl:call-template name="quote">
174     <xsl:with-param name="s" select="@uri"/>
175    </xsl:call-template>
176   </xsl:variable>
177   <!-- The nonce, quotedCurrentCICURI are used to force the document reload -->
178   <xsl:if test="not(name(document(concat($uri_set_queueURL,'add_if_not_in?uri=',@uri,'&amp;nonce=',generate-id(),'&amp;PID=',$PID,'&amp;quotedCurrentCICURI=',$quotedCurrentCICURI))/*)='not_added_because_already_too_many')">
179    <xsl:text> </xsl:text>
180    <xsl:value-of select="$quotedCurrentCICURI"/>
181    <xsl:text> -&gt; </xsl:text>
182    <xsl:value-of select="$quotedURI"/>
183    <xsl:text>;&CSCbr;</xsl:text>
184   </xsl:if>
185  </xsl:if>
186  <xsl:apply-templates>
187   <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
188   <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
189  </xsl:apply-templates>
190 </xsl:template>
191
192 <xsl:template match="text()"/>
193 </xsl:stylesheet>