]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/metadataLib.xsl
###############################################################
[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 <xsl:import href="show_dc.xsl"/>
9 <xsl:import href="links_library.xsl"/>
10
11 <xsl:param name="CICURI" select="''"/>
12 <xsl:param name="getterURL" select="''"/>
13 <xsl:param name="draw_graphURL" select="''"/>
14 <xsl:param name="rdflyURL" select="'http://localhost:58086/'"/>
15
16 <!--CSC: code cut & pasted from makeGraphLinks -->
17 <xsl:param name="uri_set_size" select="'30'"/>
18 <!--CSC: end of cut & paste from makeGraphLinks -->
19
20 <xsl:variable name="BaseRDFURLForward" select="concat($rdflyURL,'get?kind=forward&amp;object=')"/>
21 <xsl:variable name="BaseRDFURLBackward" select="concat($rdflyURL,'get?kind=backward&amp;object=')"/>
22 <xsl:variable name="BaseRDFURLDC" select="concat($rdflyURL,'get?kind=dc&amp;object=')"/>
23
24 <xsl:template match="/">
25  <html>
26   <head>
27    <subst:script language="JavaScript" src="/javascript/defaults.js"/>
28    <subst:script language="JavaScript" src="/javascript/utils.js"/>
29    <subst:script language="JavaScript" src="/javascript/control.js"/>
30    <subst:script language="JavaScript" src="/javascript/graphLinks.js"/>
31
32    <title>Metadata of <xsl:value-of select="$CICURI"/></title>
33   </head>
34   <body onLoad="window.focus()" bgColor="white">
35    <xsl:variable name="CICURL">
36      <xsl:call-template name="makeURL">
37       <xsl:with-param name="uri" select="$CICURI"/>
38      </xsl:call-template>
39    </xsl:variable>
40    <h1>Metadata of <a href="{$CICURL}"><xsl:value-of select="$CICURI"/></a></h1>
41    <xsl:apply-templates select="*"/>
42    <!--CSC: code almost cut & pasted from makeGraphLinks -->
43    <form name="uri_set_size">
44     Number of nodes to show when following an hyperlink to a graph:
45     <input type="text" onClick="return false" value="{$uri_set_size}" size="2"/> (30 suggested)
46    </form>
47    <!--CSC: end of cut & paste from makeGraphLinks -->
48   <xsl:call-template name="loop_show_dc">
49    <xsl:with-param name="CICURI" select="$CICURI"/>
50   </xsl:call-template>
51   </body>
52  </html>
53 </xsl:template>
54
55 <xsl:template name="makelink">
56  <xsl:param name="name" select="''"/>
57  <xsl:param name="CICURI" select="''"/>
58  <xsl:variable name="quotedCICURI">
59   <xsl:call-template name="jsquote">
60    <xsl:with-param name="s" select="$CICURI"/>
61    <xsl:with-param name="times" select="2"/>
62   </xsl:call-template>
63  </xsl:variable>
64  <xsl:variable name="quotedCICURIforURL">
65   <xsl:call-template name="quote">
66    <xsl:with-param name="s" select="$CICURI"/>
67   </xsl:call-template>
68  </xsl:variable>
69  <xsl:choose>
70   <xsl:when test="document(concat($BaseRDFURLBackward,$quotedCICURIforURL))/*/*/*">
71    <p>
72     <script>
73      var CICURI = "<xsl:value-of select="$CICURI"/>";
74 <![CDATA[
75      document.write('<a href="' + mkMetaTheoryURL(CICURI) + '">View the objects depending on it.</a>');
76 ]]>
77     </script>
78    </p>
79    <p>
80      <xsl:variable name="forwardURL">
81       <xsl:call-template name="makeGraphURL">
82        <xsl:with-param name="uri" select="$CICURI"/>
83        <xsl:with-param name="keys" select="'MMG'"/>
84        <!-- <xsl:with-param name="uri_set_size" select="'document.uri_set_size.elements[0].value'"/> -->
85        <xsl:with-param name="uri_set_size" select="'30'"/>
86       </xsl:call-template>
87      </xsl:variable>
88      <a href="{$forwardURL}">View the graph of all the objects depending on this one.</a>
89    </p>
90   </xsl:when>
91   <xsl:otherwise>
92    <p>
93     Object <xsl:value-of select="$name"/> is never referenced in other objects
94    </p>
95   </xsl:otherwise>
96  </xsl:choose>
97
98  <xsl:choose>
99   <xsl:when test="document(concat($BaseRDFURLForward,$quotedCICURIforURL))/*/*/*">
100    <p>
101      <xsl:variable name="forwardURL">
102       <xsl:call-template name="makeGraphURL">
103        <xsl:with-param name="uri" select="$CICURI"/>
104        <xsl:with-param name="keys" select="'MDG'"/>
105        <!-- <xsl:with-param name="uri_set_size" select="'document.uri_set_size.elements[0].value'"/> -->
106        <xsl:with-param name="uri_set_size" select="'30'"/>
107       </xsl:call-template>
108      </xsl:variable>
109      <a href="{$forwardURL}">View the graph of all the dependencies of this object.</a>
110    </p>
111   </xsl:when>
112   <xsl:otherwise>
113    <p>
114     Object <xsl:value-of select="$name"/> does not reference any other object
115    </p>
116   </xsl:otherwise>
117  </xsl:choose>
118 </xsl:template>
119
120 </xsl:stylesheet>