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 <!-- CSC: Sostituire l'andata a capo con la entity numerica opportuna -->
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">
36 <xsl:output method="text"/>
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=')"/>
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="''"/>
51 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
53 <xsl:variable name="char" select="substring($s,1,1)"/>
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')"/>
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')"/>
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')"/>
73 <xsl:when test='$char = "'"'>
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')"/>
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')"/>
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')"/>
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')"/>
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')"/>
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)"/>
114 <xsl:template match="/">
116 <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
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,'&nonce=',generate-id(),'&PID=',$PID,'&size=',$uri_set_size))"/>
121 <xsl:variable name="dummy1" select="document(concat($uri_set_queueURL,'add_if_not_in?uri=',$CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
122 <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',$CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
123 <xsl:variable name="dummy2" select="document(concat($uri_set_queueURL,'reset_to_empty?PID=',$PID))"/>
124 <xsl:text>}</xsl:text>
127 <xsl:template mode="loop" match="empty"/>
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"/>
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,'&nonce=',generate-id(),'&PID=',$PID))"/>
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>
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,'&nonce=',generate-id(),'&PID=',$PID))/*)='true'">
162 <xsl:text>,color=red</xsl:text>
164 <xsl:text>];&CSCbr;</xsl:text>
167 <!-- CSC: uriType missing!!! -->
168 <xsl:template match="*">
169 <xsl:param name="currentCICURI" select="''"/>
170 <xsl:param name="quotedCurrentCICURI" select="''"/>
172 <xsl:variable name="quotedURI">
173 <xsl:call-template name="quote">
174 <xsl:with-param name="s" select="@uri"/>
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,'&nonce=',generate-id(),'&PID=',$PID,'&quotedCurrentCICURI=',$quotedCurrentCICURI))/*)='not_added_because_already_too_many')">
179 <xsl:text> </xsl:text>
180 <xsl:value-of select="$quotedCurrentCICURI"/>
181 <xsl:text> -> </xsl:text>
182 <xsl:value-of select="$quotedURI"/>
183 <xsl:text>;&CSCbr;</xsl:text>
186 <xsl:apply-templates>
187 <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
188 <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
189 </xsl:apply-templates>
192 <xsl:template match="text()"/>