]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/metadataLib.xsl
Code clean-up: the code to create the link to the theory automatically
[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:param name="CICURI" select="''"/>
8 <xsl:param name="getterURL" select="''"/>
9 <xsl:param name="draw_graphURL" select="''"/>
10
11 <xsl:variable name="BaseRDFURL" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/')"/>
12 <xsl:variable name="BaseRDFURLForward" select="concat($BaseRDFURL,'forward//')"/>
13 <xsl:variable name="BaseRDFURLBackward" select="concat($BaseRDFURL,'backward//')"/>
14
15 <xsl:template match="/">
16  <html>
17   <head>
18    <subst:script language="JavaScript" src="/javascript/defaults.js"/>
19    <subst:script language="JavaScript" src="/javascript/utils.js"/>
20    <subst:script language="JavaScript" src="/javascript/control.js"/>
21    <subst:script language="JavaScript" src="/javascript/graphLinks.js"/>
22
23    <title>Metadata of <xsl:value-of select="$CICURI"/></title>
24   </head>
25   <body onLoad="window.focus()" bgColor="white">
26    <script>
27      var CICURI = "<xsl:value-of select="$CICURI"/>";
28 <![CDATA[
29      document.write('<h1>Metadata of <a target="cic" href="' + mkCICURL(CICURI) + '">' + CICURI + '</a></h1>');
30 ]]>
31    </script>
32    <xsl:apply-templates select="*"/>
33   </body>
34  </html>
35 </xsl:template>
36
37 <xsl:template name="makelink">
38  <xsl:param name="name" select="''"/>
39  <xsl:param name="CICURI" select="''"/>
40  <xsl:param name="RDFURI" select="''"/>
41  <xsl:choose>
42   <xsl:when test="document(concat($BaseRDFURLBackward,$RDFURI))/*/*/*">
43    <p>
44     <script>
45      var CICURI = "<xsl:value-of select="$CICURI"/>";
46 <![CDATA[
47      document.write('<a target="theory" href="' + mkMetaTheoryURL(CICURI) + '">View the objects depending on it.</a>');
48 ]]>
49     </script>
50    </p>
51    <p>
52     <script>
53      var CICURI = "<xsl:value-of select="$CICURI"/>";
54 <![CDATA[
55      document.write('<a target="graph" href="' + mkMetaURL(CICURI,true) + '">View the graph of all the objects depending on this one.</a>');
56 ]]>
57     </script>
58    </p>
59   </xsl:when>
60   <xsl:otherwise>
61    <p>
62     Object <xsl:value-of select="$name"/> is never referenced in other objects
63    </p>
64   </xsl:otherwise>
65  </xsl:choose>
66
67  <xsl:choose>
68   <xsl:when test="document(concat($BaseRDFURLForward,$RDFURI))/*/*/*">
69    <p>
70     <!-- CSC: Cut & Paster from above ==> create a single javascript function -->
71     <script>
72      var CICURI = "<xsl:value-of select="$CICURI"/>";
73 <![CDATA[
74      document.write('<a target="graph" href="' + mkDepURL(CICURI,true) + '">View the graph of all the dependencies of this object.</a>');
75 ]]>
76     </script>
77    </p>
78   </xsl:when>
79   <xsl:otherwise>
80    <p>
81     Object <xsl:value-of select="$name"/> does not reference any other object
82    </p>
83   </xsl:otherwise>
84  </xsl:choose>
85 </xsl:template>
86
87 </xsl:stylesheet>