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:variable name="RDF_base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/rdfprova//')"/>
43 <!-- CSC: next function because I don't remember the name of the -->
44 <!-- CSC: subst function of xslt and I don't have the specs with me -->
45 <xsl:template name="quote">
46 <xsl:param name="s" select="''"/>
47 <xsl:param name="news" select="''"/>
49 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
51 <xsl:variable name="char" select="substring($s,1,1)"/>
53 <xsl:when test="$char = '/'">
54 <xsl:call-template name="quote">
55 <xsl:with-param name="s" select="substring($s,2)"/>
56 <xsl:with-param name="news" select="concat($news,'X')"/>
59 <xsl:when test="$char = ':'">
60 <xsl:call-template name="quote">
61 <xsl:with-param name="s" select="substring($s,2)"/>
62 <xsl:with-param name="news" select="concat($news,'Y')"/>
65 <xsl:when test="$char = '.'">
66 <xsl:call-template name="quote">
67 <xsl:with-param name="s" select="substring($s,2)"/>
68 <xsl:with-param name="news" select="concat($news,'Z')"/>
71 <xsl:when test='$char = "'"'>
72 <xsl:call-template name="quote">
73 <xsl:with-param name="s" select="substring($s,2)"/>
74 <xsl:with-param name="news" select="concat($news,'W')"/>
77 <xsl:when test="$char = '-'">
78 <xsl:call-template name="quote">
79 <xsl:with-param name="s" select="substring($s,2)"/>
80 <xsl:with-param name="news" select="concat($news,'J')"/>
83 <xsl:when test="$char = '#'">
84 <xsl:call-template name="quote">
85 <xsl:with-param name="s" select="substring($s,2)"/>
86 <xsl:with-param name="news" select="concat($news,'G')"/>
89 <xsl:when test="$char = '('">
90 <xsl:call-template name="quote">
91 <xsl:with-param name="s" select="substring($s,2)"/>
92 <xsl:with-param name="news" select="concat($news,'O')"/>
95 <xsl:when test="$char = ')'">
96 <xsl:call-template name="quote">
97 <xsl:with-param name="s" select="substring($s,2)"/>
98 <xsl:with-param name="news" select="concat($news,'C')"/>
102 <xsl:call-template name="quote">
103 <xsl:with-param name="s" select="substring($s,2)"/>
104 <xsl:with-param name="news" select="concat($news,$char)"/>
112 <xsl:template match="/">
114 <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
116 <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
117 <!-- The nonce is used to force the document reload -->
118 <xsl:variable name="dummy1" select="document(concat('http://phd.cs.unibo.it:8084/add_if_not_in?uri=',$CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
119 <xsl:apply-templates mode="loop" select="document(concat('http://phd.cs.unibo.it:8084/get_next?uri=',$CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
120 <xsl:variable name="dummy2" select="document(concat('http://phd.cs.unibo.it:8084/reset_to_empty?PID=',$PID))"/>
121 <xsl:text>}</xsl:text>
124 <xsl:template mode="loop" match="empty"/>
126 <xsl:template mode="loop" match="uri|marked_uri">
127 <xsl:variable name="document" select="document(concat($RDF_base_URL_of_CIC_URI,@value))"/>
129 <xsl:when test="$document/*">
130 <xsl:apply-templates mode="first_time" select="$document/*">
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>
141 <xsl:apply-templates mode="first_time" select=".">
142 <xsl:with-param name="currentCICURI" select="@value"/>
143 <xsl:with-param name="quotedCurrentCICURI">
144 <xsl:call-template name="quote">
145 <xsl:with-param name="s" select="@value"/>
148 <xsl:with-param name="do_not_visit" select="'no_deps'"/>
149 </xsl:apply-templates>
152 <!-- The couple (uri,nonce) is used to force the document reload -->
153 <xsl:apply-templates mode="loop" select="document(concat('http://phd.cs.unibo.it:8084/get_next?uri=',@value,'&nonce=',generate-id(),'&PID=',$PID))"/>
157 <xsl:template mode="first_time" match="*">
158 <xsl:param name="currentCICURI" select="''"/>
159 <xsl:param name="quotedCurrentCICURI" select="''"/>
160 <xsl:param name="do_not_visit" select="'uri'"/>
161 <xsl:text> </xsl:text>
162 <xsl:value-of select="$quotedCurrentCICURI"/>
163 <!-- <xsl:text> [fontname="LucidaSansRegular",color=red,label="</xsl:text> -->
164 <xsl:text> [label="</xsl:text>
165 <xsl:value-of select="$currentCICURI"/>
166 <xsl:text>",URL="</xsl:text>
167 <xsl:value-of select="$currentCICURI"/>
168 <xsl:text>"</xsl:text>
169 <xsl:if test="$do_not_visit='marked_uri'">
170 <xsl:text>,color=red</xsl:text>
172 <xsl:text>];&CSCbr;</xsl:text>
173 <xsl:if test="$do_not_visit='uri'">
174 <xsl:apply-templates select=".">
175 <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
176 <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
177 </xsl:apply-templates>
181 <xsl:template match="occurs">
182 <xsl:param name="currentCICURI" select="''"/>
183 <xsl:param name="quotedCurrentCICURI" select="''"/>
184 <xsl:for-each select="*">
185 <xsl:variable name="quotedURI">
186 <xsl:call-template name="quote">
187 <xsl:with-param name="s" select="@uri"/>
190 <xsl:text> </xsl:text>
191 <xsl:value-of select="$quotedCurrentCICURI"/>
192 <xsl:text> -> </xsl:text>
193 <xsl:value-of select="$quotedURI"/>
194 <xsl:text>;&CSCbr;</xsl:text>
195 <!-- The nonce is used to force the document reload -->
196 <xsl:variable name="dummy" select="document(concat('http://phd.cs.unibo.it:8084/add_if_not_in?uri=',@uri,'&nonce=',generate-id(),'&PID=',$PID))"/>