]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/metadataLib.xsl
There were still many problems with URIs with a ' in the middle.
[helm.git] / helm / on-line / xslt / metadataLib.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0"
4  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5  xmlns:subst="http://www.cs.unibo.it/helm/subst">
6
7 <xsl:import href="utils.xsl"/>
8
9 <xsl:param name="CICURI" select="''"/>
10 <xsl:param name="getterURL" select="''"/>
11 <xsl:param name="draw_graphURL" select="''"/>
12
13 <!--CSC: code cut & pasted from makeGraphLinks -->
14 <xsl:param name="uri_set_size" select="'30'"/>
15 <!--CSC: end of cut & paste from makeGraphLinks -->
16
17 <xsl:variable name="BaseRDFURL" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/')"/>
18 <xsl:variable name="BaseRDFURLForward" select="concat($BaseRDFURL,'forward//')"/>
19 <xsl:variable name="BaseRDFURLBackward" select="concat($BaseRDFURL,'backward//')"/>
20
21 <xsl:template match="/">
22  <html>
23   <head>
24    <subst:script language="JavaScript" src="/javascript/defaults.js"/>
25    <subst:script language="JavaScript" src="/javascript/utils.js"/>
26    <subst:script language="JavaScript" src="/javascript/control.js"/>
27    <subst:script language="JavaScript" src="/javascript/graphLinks.js"/>
28
29    <title>Metadata of <xsl:value-of select="$CICURI"/></title>
30   </head>
31   <body onLoad="window.focus()" bgColor="white">
32    <script>
33      var CICURI = "<xsl:value-of select="$CICURI"/>";
34 <![CDATA[
35      document.write('<h1>Metadata of <a target="cic" href="' + mkCICURL(CICURI) + '">' + CICURI + '</a></h1>');
36 ]]>
37    </script>
38    <xsl:apply-templates select="*"/>
39    <!--CSC: code almost cut & pasted from makeGraphLinks -->
40    <form name="uri_set_size">
41     Number of nodes to show when following an hyperlink to a graph:
42     <input type="text" onClick="return false" value="{$uri_set_size}" size="2"/> (30 suggested)
43    </form>
44    <!--CSC: end of cut & paste from makeGraphLinks -->
45   </body>
46  </html>
47 </xsl:template>
48
49 <xsl:template name="makelink">
50  <xsl:param name="name" select="''"/>
51  <xsl:param name="CICURI" select="''"/>
52  <xsl:param name="RDFURI" select="''"/>
53  <xsl:variable name="quotedCICURI">
54   <xsl:call-template name="jsquote">
55    <xsl:with-param name="s" select="$CICURI"/>
56    <xsl:with-param name="times" select="2"/>
57   </xsl:call-template>
58  </xsl:variable>
59  <xsl:choose>
60   <xsl:when test="document(concat($BaseRDFURLBackward,$RDFURI))/*/*/*">
61    <p>
62     <script>
63      var CICURI = "<xsl:value-of select="$CICURI"/>";
64 <![CDATA[
65      document.write('<a target="theory" href="' + mkMetaTheoryURL(CICURI) + '">View the objects depending on it.</a>');
66 ]]>
67     </script>
68    </p>
69    <p>
70     <script>
71 <![CDATA[
72      document.write('<a href="" onClick="window.open(mkMetaURL(\']]><xsl:value-of select="$quotedCICURI"/><![CDATA[\'),\'graph\');return false;">View the graph of all the objects depending on this one.</a>');
73 ]]>
74     </script>
75    </p>
76   </xsl:when>
77   <xsl:otherwise>
78    <p>
79     Object <xsl:value-of select="$name"/> is never referenced in other objects
80    </p>
81   </xsl:otherwise>
82  </xsl:choose>
83
84  <xsl:choose>
85   <xsl:when test="document(concat($BaseRDFURLForward,$RDFURI))/*/*/*">
86    <p>
87     <!-- CSC: Cut & Paster from above ==> create a single javascript function -->
88     <script>
89 <![CDATA[
90      document.write('<a href="" onClick="window.open(mkDepURL(\']]><xsl:value-of select="$quotedCICURI"/><![CDATA[\'),\'graph\');return false;">View the graph of all the dependencies of this object.</a>');
91 ]]>
92     </script>
93    </p>
94   </xsl:when>
95   <xsl:otherwise>
96    <p>
97     Object <xsl:value-of select="$name"/> does not reference any other object
98    </p>
99   </xsl:otherwise>
100  </xsl:choose>
101 </xsl:template>
102
103 </xsl:stylesheet>