]> matita.cs.unibo.it Git - helm.git/commitdiff
Bug fixed: now links to metadata are created iff at least one pointer is there.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 24 Oct 2001 16:40:08 +0000 (16:40 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 24 Oct 2001 16:40:08 +0000 (16:40 +0000)
helm/on-line/xslt/metadataControl.xsl
helm/on-line/xslt/metadataLib.xsl

index 4842a0f8babfafeeabcc225b63e2b24735efe0d1..9960ab776b3421bd86630fca5b1cb62d8b0b443b 100644 (file)
 
 <xsl:include href="metadataLib.xsl"/>
 
-<xsl:variable name="url" select="concat($getterURL,'resolve?uri=helm:rdf:www.cs.unibo.it/helm/rdf/forward//')"/>
-
 <xsl:template match="InductiveDefinition">
  <xsl:for-each select="InductiveType">
   <xsl:variable name="CICURIInductiveType" select="concat($CICURI,'#xpointer(1/',position())"/>
   <xsl:variable name="RDFURIInductiveType" select="concat($CICURI,',',position())"/>
   <h3>Metadata related to <xsl:value-of select="@name"/>:</h3>
-  <xsl:apply-templates select="document(concat($url,$RDFURIInductiveType))" mode="makelink">
+  <xsl:call-template name="makelink">
    <xsl:with-param name="name" select="@name"/>
    <xsl:with-param name="CICURI" select="concat($CICURIInductiveType,')')"/>
    <xsl:with-param name="RDFURI" select="$RDFURIInductiveType"/>
-  </xsl:apply-templates>
+  </xsl:call-template>
   <xsl:for-each select="Constructor">
    <xsl:variable name="CICURIConstructor" select="concat($CICURIInductiveType,'/',position(),')')"/>
    <xsl:variable name="RDFURIConstructor" select="concat($RDFURIInductiveType,',',position())"/>
    <h3>Metadata related to <xsl:value-of select="@name"/>:</h3>
-   <xsl:apply-templates select="document(concat($url,$RDFURIConstructor))" mode="makelink">
+   <xsl:call-template name="makelink">
     <xsl:with-param name="name" select="@name"/>
     <xsl:with-param name="CICURI" select="$CICURIConstructor"/>
     <xsl:with-param name="RDFURI" select="$RDFURIConstructor"/>
-   </xsl:apply-templates>
+   </xsl:call-template>
   </xsl:for-each>
  </xsl:for-each>
 </xsl:template>
 
 <!-- Not an Inductive Type -->
 <xsl:template match="*">
-  <xsl:apply-templates select="document(concat($url,$CICURI))" mode="makelink">
+  <xsl:call-template name="makelink">
    <xsl:with-param name="name" select="$CICURI"/>
    <xsl:with-param name="CICURI" select="$CICURI"/>
    <xsl:with-param name="RDFURI" select="$CICURI"/>
-  </xsl:apply-templates>
+  </xsl:call-template>
 </xsl:template>
 
 </xsl:stylesheet>
index b1434add6ae812eac4e5ebb8b135f70d251d6eac..7a2f8ec99f2fd53db9e4db32fa487bbc11c219f2 100644 (file)
@@ -8,6 +8,10 @@
 <xsl:param name="getterURL" select="''"/>
 <xsl:param name="draw_graphURL" select="''"/>
 
+<xsl:variable name="BaseRDFURL" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/')"/>
+<xsl:variable name="BaseRDFURLForward" select="concat($BaseRDFURL,'forward//')"/>
+<xsl:variable name="BaseRDFURLBackward" select="concat($BaseRDFURL,'backward//')"/>
+
 <xsl:template match="/">
  <html>
   <head>
  </html>
 </xsl:template>
 
-<xsl:template match="/" mode="makelink">
+<xsl:template name="makelink">
  <xsl:param name="name" select="''"/>
  <xsl:param name="CICURI" select="''"/>
  <xsl:param name="RDFURI" select="''"/>
- <xsl:apply-templates select="*" mode="makelink">
-  <xsl:with-param name="name" select="$name"/>
-  <xsl:with-param name="CICURI" select="$CICURI"/>
-  <xsl:with-param name="RDFURI" select="$RDFURI"/>
- </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="unresolved" mode="makelink">
- <xsl:param name="name" select="''"/>
- <xsl:param name="CICURI" select="''"/>
- <p>
-  Object <xsl:value-of select="$name"/> is never referenced in other objects
- </p>
- <xsl:apply-templates select="." mode="mk_dep_graph">
-  <xsl:with-param name="CICURI" select="$CICURI"/>
- </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="url" mode="makelink">
- <xsl:param name="name" select="''"/>
- <xsl:param name="CICURI" select="''"/>
- <xsl:param name="RDFURI" select="''"/>
- <p>
-  <script>
-   var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//<xsl:value-of select="$RDFURI"/>";
-   var getterURL = "<xsl:value-of select="$getterURL"/>";
+ <xsl:choose>
+  <xsl:when test="document(concat($BaseRDFURLBackward,$RDFURI))/*/*/*">
+   <p>
+    <script>
+     var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//<xsl:value-of select="$RDFURI"/>";
+     var getterURL = "<xsl:value-of select="$getterURL"/>";
 <![CDATA[
-   var url = setParam(location.href,"keys","meta_theory%2CT1%2CT2%2CL%2CE");
-   url = setParam(url,"xmluri", getterURL + "getxml%3Furi%3D" + RDFURI);
-   document.write('<a target="theory" href="' + url + '">View the objects depending on it.</a>');
+     var url = setParam(location.href,"keys","meta_theory%2CT1%2CT2%2CL%2CE");
+     url = setParam(url,"xmluri", getterURL + "getxml%3Furi%3D" + RDFURI);
+     document.write('<a target="theory" href="' + url + '">View the objects depending on it.</a>');
 ]]>
-  </script>
- </p>
- <p>
-  <script>
-   var CICURI = "<xsl:value-of select="$CICURI"/>";
-   var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//<xsl:value-of select="$RDFURI"/>";
-   var getterURL = "<xsl:value-of select="$getterURL"/>";
-   var draw_graphURL = "<xsl:value-of select="$draw_graphURL"/>";
+    </script>
  </p>
  <p>
+    <script>
+     var CICURI = "<xsl:value-of select="$CICURI"/>";
+     var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//<xsl:value-of select="$RDFURI"/>";
+     var getterURL = "<xsl:value-of select="$getterURL"/>";
+     var draw_graphURL = "<xsl:value-of select="$draw_graphURL"/>";
 <![CDATA[
-   var url = setParam(location.href,"keys","MMG");
-   url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
-   url = setParam(url,"param.CICURI",escape(CICURI));
-   url = draw_graphURL + 'draw?url=' + escape(url);
-   var url2 = setParam(location.href,"keys","MGL,RT");
-   url2 = setParam(url2,"xmluri",escape(url));
-   document.write('<a target="graph" href="' + url2 + '">View the graph of all the objects depending on this one.</a>');
+     var url = setParam(location.href,"keys","MMG");
+     url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
+     url = setParam(url,"param.CICURI",escape(CICURI));
+     url = draw_graphURL + 'draw?url=' + escape(url);
+     var url2 = setParam(location.href,"keys","MGL,RT");
+     url2 = setParam(url2,"xmluri",escape(url));
+     document.write('<a target="graph" href="' + url2 + '">View the graph of all the objects depending on this one.</a>');
 ]]>
-  </script>
- </p>
- <xsl:apply-templates select="." mode="mk_dep_graph">
-  <xsl:with-param name="CICURI" select="$CICURI"/>
-  <xsl:with-param name="RDFURI" select="$RDFURI"/>
- </xsl:apply-templates>
-</xsl:template>
+    </script>
+   </p>
+  </xsl:when>
+  <xsl:otherwise>
+   <p>
+    Object <xsl:value-of select="$name"/> is never referenced in other objects
+   </p>
+  </xsl:otherwise>
+ </xsl:choose>
 
-<xsl:template match="*" mode="mk_dep_graph">
- <xsl:param name="CICURI" select="''"/>
- <xsl:param name="RDFURI" select="''"/>
- <p>
-  <!-- CSC: Cut & Paster from above ==> create a single javascript function -->
-  <script>
-   var CICURI = "<xsl:value-of select="$CICURI"/>";
-   var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/forward//<xsl:value-of select="$RDFURI"/>";
-   var getterURL = "<xsl:value-of select="$getterURL"/>";
-   var draw_graphURL = "<xsl:value-of select="$draw_graphURL"/>";
+ <xsl:choose>
+  <xsl:when test="document(concat($BaseRDFURLForward,$RDFURI))/*/*/*">
+   <p>
+    <!-- CSC: Cut & Paster from above ==> create a single javascript function -->
+    <script>
+     var CICURI = "<xsl:value-of select="$CICURI"/>";
+     var RDFURI = "helm:rdf:www.cs.unibo.it/helm/rdf/forward//<xsl:value-of select="$RDFURI"/>";
+     var getterURL = "<xsl:value-of select="$getterURL"/>";
+     var draw_graphURL = "<xsl:value-of select="$draw_graphURL"/>";
 <![CDATA[
-   var url = setParam(location.href,"keys","MDG");
-   url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
-   url = setParam(url,"param.CICURI",escape(CICURI));
-   url = draw_graphURL + 'draw?url=' + escape(url);
-   var url2 = setParam(location.href,"keys","MGL,RT");
-   url2 = setParam(url2,"xmluri",escape(url));
-   document.write('<a target="graph" href="' + url2 + '">View the graph of all the dependencies of this object.</a>');
+     var url = setParam(location.href,"keys","MDG");
+     url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + RDFURI);
+     url = setParam(url,"param.CICURI",escape(CICURI));
+     url = draw_graphURL + 'draw?url=' + escape(url);
+     var url2 = setParam(location.href,"keys","MGL,RT");
+     url2 = setParam(url2,"xmluri",escape(url));
+     document.write('<a target="graph" href="' + url2 + '">View the graph of all the dependencies of this object.</a>');
 ]]>
-  </script>
- </p>
+    </script>
+   </p>
+  </xsl:when>
+  <xsl:otherwise>
+   <p>
+    Object <xsl:value-of select="$name"/> does not reference any other object
+   </p>
+  </xsl:otherwise>
+ </xsl:choose>
 </xsl:template>
 
 </xsl:stylesheet>