]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/makeGraphLinks.xsl
ocaml 3.09 transition
[helm.git] / helm / on-line / xslt / makeGraphLinks.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 <xsl:stylesheet version="1.0"
28  xmlns="http://www.w3.org/1999/xhtml" 
29  xmlns:html="http://www.w3.org/1999/xhtml" 
30  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31  xmlns:subst="http://www.cs.unibo.it/helm/subst">
32
33 <xsl:import href="utils.xsl"/>
34 <xsl:import href="links_library.xsl"/>
35
36 <!--CSC: code cut & pasted also in metadataLib.xsl -->
37 <xsl:param name="uri_set_size" select="''"/>
38 <!--CSC: end of cut & paste also in metadataLib.xsl -->
39
40 <xsl:output method="html" encoding="iso-8859-1"/>
41
42 <xsl:template match="/|*">
43   <xsl:copy>
44    <xsl:copy-of select="@*"/>
45    <xsl:apply-templates/>
46   </xsl:copy>
47 </xsl:template>
48
49 <xsl:template match="html:head">
50   <xsl:copy>
51    <xsl:copy-of select="@*"/>
52    <subst:script language="JavaScript" src="/javascript/helmjsmenu.js"/>
53    <script>
54     var lastX, lastY;
55     var selectedURI;
56     var selectedCICURL;
57     var selectedForwardURL;
58     var selectedBackwardURL;
59    </script>
60    <xsl:apply-templates/>
61   </xsl:copy>
62 </xsl:template>
63
64 <xsl:template match="html:body">
65   <!--CSC: end of cut & paste also in metadataLib.xsl -->
66   <xsl:copy>
67    <xsl:copy-of select="@*"/>
68    <xsl:attribute name="onClick">hideMenu();</xsl:attribute>
69    <!--CSC: end of cut & paste also in metadataLib.xsl -->
70    <xsl:apply-templates/>
71    <div style="position: absolute" id="HJMmenu">
72     <!-- The two nested tables are for NS 4.0 where every -->
73     <!-- layer has a default transparent background color -->
74     <table bgColor="green" id="pippo">
75      <tr><td>
76       <table bgColor="cyan" border="2">
77        <tr><td><a href="javascript: location = selectedForwardURL">Objects this one depends on.</a></td></tr>
78        <tr><td><a href="javascript: var _ = window.open(selectedCICURL,'_top')">Render this object.</a></td></tr>
79        <tr><td><a href="javascript: location = selectedBackwardURL">Objects depending on this one.</a></td></tr>
80       </table>
81      </td></tr>
82     </table>
83    </div>
84    <script>initializeMenu()</script>
85   </xsl:copy>
86 </xsl:template>
87
88 <xsl:template match="html:area">
89  <xsl:variable name="quoteduri">
90   <xsl:call-template name="jsquote">
91    <xsl:with-param name="s" select="@href"/>
92   </xsl:call-template>
93  </xsl:variable>
94  <xsl:variable name="cicurl">
95   <xsl:call-template name="makeURL">
96    <xsl:with-param name="uri" select="@href"/>
97   </xsl:call-template>
98  </xsl:variable>
99  <xsl:variable name="quotedcicurl">
100   <xsl:call-template name="jsquote">
101    <xsl:with-param name="s" select="$cicurl"/>
102   </xsl:call-template>
103  </xsl:variable>
104  <xsl:variable name="forwardURL">
105   <xsl:call-template name="makeGraphURL">
106    <xsl:with-param name="uri" select="@href"/>
107    <xsl:with-param name="keys" select="'MDG'"/>
108    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
109   </xsl:call-template>
110  </xsl:variable>
111  <xsl:variable name="quotedForwardURL">
112   <xsl:call-template name="jsquote">
113    <xsl:with-param name="s" select="$forwardURL"/>
114   </xsl:call-template>
115  </xsl:variable>
116  <xsl:variable name="backwardURL">
117   <xsl:call-template name="makeGraphURL">
118    <xsl:with-param name="uri" select="@href"/>
119    <xsl:with-param name="keys" select="'MMG'"/>
120    <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
121   </xsl:call-template>
122  </xsl:variable>
123  <xsl:variable name="quotedBackwardURL">
124   <xsl:call-template name="jsquote">
125    <xsl:with-param name="s" select="$backwardURL"/>
126   </xsl:call-template>
127  </xsl:variable>
128  <xsl:copy>
129   <xsl:copy-of select="@*"/> 
130   <xsl:if test="starts-with(@href,&quot;cic:&quot;)">
131    <xsl:attribute name="onMouseOver">lastX = getX(event); lastY = getY(event); selectedURI='<xsl:value-of select="$quoteduri"/>'; selectedCICURL='<xsl:value-of select="$quotedcicurl"/>'; selectedForwardURL='<xsl:value-of select="$quotedForwardURL"/>'; selectedBackwardURL='<xsl:value-of select="$quotedBackwardURL"/>';</xsl:attribute>
132    <xsl:attribute name="href">javascript:moveMenu(lastX,lastY); showMenu();</xsl:attribute>
133   </xsl:if>
134   <xsl:apply-templates/>
135  </xsl:copy>
136 </xsl:template>
137
138 </xsl:stylesheet>