You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/10/29 13:22:57 UTC

svn commit: r589598 - /maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl

Author: vsiveton
Date: Mon Oct 29 05:22:57 2007
New Revision: 589598

URL: http://svn.apache.org/viewvc?rev=589598&view=rev
Log:
o cleaned the xsl and the generated dot file
o used <xsl:test/> for all text
o removed cluster

Modified:
    maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl

Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl?rev=589598&r1=589597&r2=589598&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/resources/org/apache/maven/jxr/java/doc/xml2dot.xsl Mon Oct 29 05:22:57 2007
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
@@ -16,186 +16,239 @@
   limitations under the License.
 -->
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <xsl:output method = "text"
-                omit-xml-declaration="yes"/>
-<!--
-  c46 [label="CharScanner"];
-  c46 -> c45 [dir=back,arrowtail=empty];
-  c42 -> c45 [dir=back,arrowtail=empty,style=dashed];	//org.apache.alexandria.javasrc.xref.JavaLexer implements antlr.CharScanner
-  // org.apache.alexandria.jsdoc.GenerateHTMLDoc
-  c47 [label="{GenerateHTMLDoc\n||}"];
-  // org.apache.alexandria.jsdoc.GenerateHTMLIndex
-  c48 [label="{GenerateHTMLIndex\n||}"];
-  // org.apache.alexandria.jsdoc.JSDocTask
-  c49 [label="{JSDocTask\n||}"];
-  //org.apache.alexandria.jsdoc.JSDocTask extends org.apache.tools.ant.Task
-  // org.apache.tools.ant.Task
-  c50 [label="{Task\n||}", fontname="Helvetica-Oblique"];
-  c50 -> c49 [dir=back,arrowtail=empty];
--->
-  <xsl:template match="javadoc">#!/usr/local/bin/dot
+  <xsl:output method="text" omit-xml-declaration="yes"/>
+
+  <xsl:template match="javadoc">
+    <xsl:text>#!/usr/local/bin/dot
 #
 # Class diagram
 #
 
     digraph G {
-      ranksep=1.4;
-      edge [fontname="Helvetica",fontsize=9,labelfontname="Helvetica",labelfontsize=9];
-      node [fontname="Helvetica",fontsize=9,shape=record];
-      cluster [fontname="Helvetica",fontsize=9,shape=record];
+        ranksep=1.4;
+        edge [fontname="Helvetica", fontsize=9, labelfontname="Helvetica", labelfontsize=9];
+        node [fontname="Helvetica", fontsize=9, shape=record];
+  </xsl:text>
+
+    <xsl:apply-templates/>
 
-      <xsl:apply-templates/>
     <xsl:for-each select="package/class">
       <xsl:if test="extends_class and extends_class/classref/@name!='java.lang.Object'">
+        <xsl:text>        </xsl:text>
         <xsl:call-template name="fullname">
           <xsl:with-param name="name" select="extends_class/classref/@name"/>
         </xsl:call-template>
-                     ->
-                  <xsl:call-template name="fullname">
+        <xsl:text> ->
+        </xsl:text>
+        <xsl:call-template name="fullname">
           <xsl:with-param name="name" select="../@name"/>
           <xsl:with-param name="parentname" select="@name"/>
-        </xsl:call-template> [dir=back,arrowtail=empty];
-        </xsl:if>
+        </xsl:call-template>
+        <xsl:text> [dir=back, arrowtail=empty];&#10;</xsl:text>
+      </xsl:if>
       <xsl:if test="implements">
+        <xsl:text>        </xsl:text>
         <xsl:for-each select="implements/interfaceref">
           <xsl:call-template name="fullname">
             <xsl:with-param name="name" select="../../../@name"/>
             <xsl:with-param name="parentname" select="../../@name"/>
           </xsl:call-template>
-                ->
-                <xsl:call-template name="fullname">
+          <xsl:text> ->
+          </xsl:text>
+          <xsl:call-template name="fullname">
             <xsl:with-param name="name" select="@name"/>
           </xsl:call-template>
-                    [dir=back,arrowtail=empty,style=dashed];
-             </xsl:for-each>
+          <xsl:text> [dir=back, arrowtail=empty, style=dashed];&#10;</xsl:text>
+        </xsl:for-each>
       </xsl:if>
     </xsl:for-each>
+
     <xsl:for-each select="package/interface">
       <xsl:if test="extends_class and extends_class/classref/@name!='java.lang.Object'">
-        <xsl:value-of select="extends_class/classref/@name"/> -> <xsl:value-of select="../@name"/>.<xsl:value-of select="@name"/> [dir=back,arrowtail=empty];
-        </xsl:if>
+        <xsl:value-of select="extends_class/classref/@name"/>
+        <xsl:text> ->
+        </xsl:text>
+        <xsl:value-of select="../@name"/>
+        <xsl:text>.</xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text> [dir=back, arrowtail=empty]; </xsl:text>
+      </xsl:if>
       <xsl:if test="implements">
         <xsl:for-each select="implements/interfaceref">
-          <xsl:value-of select="../../../@name"/>.<xsl:value-of select="../../@name"/> -> <xsl:value-of select="@name"/> [dir=back,arrowtail=empty,style=dashed];
-             </xsl:for-each>
+          <xsl:value-of select="../../../@name"/>
+          <xsl:text>.</xsl:text>
+          <xsl:value-of select="../../@name"/>
+          <xsl:text> ->
+          </xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text> [dir=back, arrowtail=empty, style=dashed]; </xsl:text>
+        </xsl:for-each>
       </xsl:if>
     </xsl:for-each>
-
-
-    }
+    <xsl:text>
+    }}</xsl:text>
   </xsl:template>
+
   <xsl:template match="package">
-    subgraph cluster<xsl:call-template name="fullname">
+    <xsl:text>        subgraph cluster</xsl:text>
+    <xsl:call-template name="fullname">
       <xsl:with-param name="name" select="@name"/>
-    </xsl:call-template> {
-    node [style=filled];
-
-
-      <xsl:apply-templates/>
-<!-- rank same, min, max, source or sink
+    </xsl:call-template>
+    <xsl:text> {
+            node [style=filled];</xsl:text>
+    <xsl:apply-templates/>
+    <!-- rank same, min, max, source or sink
              rankdir TB LR (left to right) or TB (top to bottom)
              ranksep .75 separation between ranks, in inches.
              ratio approximate aspect ratio desired, fill or auto
              remincross if true and there are multiple clusters, re-run crossing minimization
            -->
-<!-- rank=same;
+    <!-- rank=same;
              rankdir=TB;
              ranksep=1;
              ratio=fill;
              remincross=true;
            -->
-
-        label = "<xsl:value-of select="@name"/>";
-    color="#000000";
-    fillcolor="#dddddd";
-
-    }
+    <xsl:text>
+            label = "</xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:text>";
+            color="#000000";
+            fillcolor="#dddddd";
+        }
+</xsl:text>
   </xsl:template>
+
   <xsl:template match="class">
+    <xsl:text>&#10;        </xsl:text>
     <xsl:call-template name="fullname">
       <xsl:with-param name="name" select="../@name"/>
       <xsl:with-param name="parentname" select="@name"/>
-    </xsl:call-template> [
-         <xsl:choose>
+    </xsl:call-template>
+    <xsl:text> [ </xsl:text>
+    <xsl:choose>
       <xsl:when test="@extensiblity='abstract'">
-             color="#848684", fillcolor="#ced7ce", fontname="Helvetica-Italic"
-           </xsl:when>
+        <xsl:text>
+            color="#848684",
+            fillcolor="#ced7ce",
+            fontname="Helvetica-Italic"</xsl:text>
+      </xsl:when>
       <xsl:otherwise>
-             color="#9c0031", fillcolor="#ffffce",
-           </xsl:otherwise>
+        <xsl:text>
+            color="#9c0031",
+            fillcolor="#ffffce",</xsl:text>
+      </xsl:otherwise>
     </xsl:choose>
-<!-- need to replace newline chars with \n -->
-<!--comment="<xsl:value-of select="doc" />" ,-->
-            URL="<xsl:call-template name="filepath">
+    <!-- need to replace newline chars with \n -->
+    <!--comment="<xsl:value-of select="doc" />" ,-->
+    <xsl:text>
+            URL="</xsl:text>
+    <xsl:call-template name="filepath">
       <xsl:with-param name="name" select="../@name"/>
       <xsl:with-param name="parentname" select="@name"/>
-    </xsl:call-template>",
+    </xsl:call-template>
+    <xsl:text>",
             style=filled,
-            label="{<xsl:value-of select="@name"/>\n|<xsl:if test="show">
-      <xsl:for-each select = "field">
+            label="{</xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:text>\n|</xsl:text>
+    <xsl:if test="show">
+      <xsl:for-each select="field">
         <xsl:choose>
-          <xsl:when test="@access='public'">+</xsl:when>
-          <xsl:when test="@access='private'">-</xsl:when>
-          <xsl:when test="@access='protected'">#</xsl:when>
-          <xsl:otherwise>/</xsl:otherwise>
+          <xsl:when test="@access='public'">
+            <xsl:text>+</xsl:text>
+          </xsl:when>
+          <xsl:when test="@access='private'">
+            <xsl:text>-</xsl:text>
+          </xsl:when>
+          <xsl:when test="@access='protected'">
+            <xsl:text>#</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>/</xsl:text>
+          </xsl:otherwise>
         </xsl:choose>
         <xsl:call-template name="substring-after-last">
-          <xsl:with-param name="input" select="returns/primitive/@type" />
-          <xsl:with-param name="marker" select="'.'" />
+          <xsl:with-param name="input" select="returns/primitive/@type"/>
+          <xsl:with-param name="marker" select="'.'"/>
         </xsl:call-template>
         <xsl:call-template name="substring-after-last">
-          <xsl:with-param name="input" select="returns/classref/@name" />
-          <xsl:with-param name="marker" select="'.'" />
-        </xsl:call-template>\l<!--
-            -->
+          <xsl:with-param name="input" select="returns/classref/@name"/>
+          <xsl:with-param name="marker" select="'.'"/>
+        </xsl:call-template>
+        <xsl:text>\n</xsl:text>
       </xsl:for-each>
-    </xsl:if>|<xsl:if test="show">
-<!--
-                  constructor
-            -->
-      <xsl:for-each select = "method">
+    </xsl:if>
+    <xsl:text>|</xsl:text>
+    <xsl:if test="show">
+      <!-- constructor -->
+      <xsl:for-each select="method">
         <xsl:choose>
-          <xsl:when test="@access='public'">+</xsl:when>
-          <xsl:when test="@access='private'">-</xsl:when>
-          <xsl:when test="@access='protected'">#</xsl:when>
-          <xsl:otherwise>/</xsl:otherwise>
+          <xsl:when test="@access='public'">
+            <xsl:text>+</xsl:text>
+          </xsl:when>
+          <xsl:when test="@access='private'">
+            <xsl:text>-</xsl:text>
+          </xsl:when>
+          <xsl:when test="@access='protected'">
+            <xsl:text>#</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>/</xsl:text>
+          </xsl:otherwise>
         </xsl:choose>
         <xsl:call-template name="substring-after-last">
-          <xsl:with-param name="input" select="returns/primitive/@type" />
-          <xsl:with-param name="marker" select="'.'" />
+          <xsl:with-param name="input" select="returns/primitive/@type"/>
+          <xsl:with-param name="marker" select="'.'"/>
         </xsl:call-template>
         <xsl:call-template name="substring-after-last">
-          <xsl:with-param name="input" select="returns/classref/@name" />
-          <xsl:with-param name="marker" select="'.'" />
+          <xsl:with-param name="input" select="returns/classref/@name"/>
+          <xsl:with-param name="marker" select="'.'"/>
         </xsl:call-template>
         <xsl:text> </xsl:text>
-        <xsl:value-of select="@name" />( <!--
-              -->
-        <xsl:for-each select = "parameter">
-          <xsl:value-of select="primitive/@type" />
+        <xsl:value-of select="@name"/>
+        <xsl:text>( </xsl:text>
+        <xsl:for-each select="parameter">
+          <xsl:value-of select="primitive/@type"/>
           <xsl:call-template name="substring-after-last">
-            <xsl:with-param name="input" select="classref/@name" />
-            <xsl:with-param name="marker" select="'.'" />
-          </xsl:call-template>,<!--
-              -->
-        </xsl:for-each>)\l<!--
-            -->
+            <xsl:with-param name="input" select="classref/@name"/>
+            <xsl:with-param name="marker" select="'.'"/>
+          </xsl:call-template>
+          <xsl:text>,</xsl:text>
+        </xsl:for-each>
+        <xsl:text>)\n</xsl:text>
       </xsl:for-each>
-<!--
-           -->
-    </xsl:if>}"];
+    </xsl:if>
+    <xsl:text>}"
+            ];</xsl:text>
   </xsl:template>
+
   <xsl:template match="interface">
+    <xsl:text>
+        </xsl:text>
     <xsl:call-template name="fullname">
       <xsl:with-param name="name" select="../@name"/>
       <xsl:with-param name="parentname" select="@name"/>
-    </xsl:call-template> [ color="#9c0031", fillcolor="#deffff", label="{«interface»\n<xsl:value-of select="@name"/>\n}"];
+    </xsl:call-template>
+    <xsl:text> [
+            color="#9c0031",
+            fillcolor="#deffff",
+            label="{«interface»\n</xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:text>\n}"
+            ];</xsl:text>
   </xsl:template>
-  <xsl:template match="doc"></xsl:template>
-  <xsl:template match="extends"></xsl:template>
-  <xsl:template match="field"></xsl:template>
-  <xsl:template match="constructor"></xsl:template>
-  <xsl:template match="method"></xsl:template>
+
+  <xsl:template match="doc"/>
+
+  <xsl:template match="extends"/>
+
+  <xsl:template match="field"/>
+
+  <xsl:template match="constructor"/>
+
+  <xsl:template match="method"/>
+
   <xsl:template name="fullname">
     <xsl:param name="name"/>
     <xsl:param name="parentname"/>
@@ -204,13 +257,14 @@
       <xsl:with-param name="replace" select="'.'"/>
       <xsl:with-param name="with" select="'_'"/>
     </xsl:call-template>
-    <xsl:if test = "$parentname!=''">_</xsl:if>
+    <xsl:if test="$parentname!=''">_</xsl:if>
     <xsl:call-template name="replace-string">
       <xsl:with-param name="text" select="$parentname"/>
       <xsl:with-param name="replace" select="'.'"/>
       <xsl:with-param name="with" select="'_'"/>
     </xsl:call-template>
   </xsl:template>
+
   <xsl:template name="filepath">
     <xsl:param name="name"/>
     <xsl:param name="parentname"/>
@@ -219,13 +273,14 @@
       <xsl:with-param name="replace" select="'.'"/>
       <xsl:with-param name="with" select="'/'"/>
     </xsl:call-template>
-    <xsl:if test = "$parentname!=''">/</xsl:if>
+    <xsl:if test="$parentname!=''">/</xsl:if>
     <xsl:call-template name="replace-string">
       <xsl:with-param name="text" select="$parentname"/>
       <xsl:with-param name="replace" select="'.'"/>
       <xsl:with-param name="with" select="'/'"/>
     </xsl:call-template>
   </xsl:template>
+
   <xsl:template name="replace-string">
     <xsl:param name="text"/>
     <xsl:param name="replace"/>
@@ -235,8 +290,7 @@
         <xsl:value-of select="substring-before($text,$replace)"/>
         <xsl:value-of select="$with"/>
         <xsl:call-template name="replace-string">
-          <xsl:with-param name="text"
-select="substring-after($text,$replace)"/>
+          <xsl:with-param name="text" select="substring-after($text,$replace)"/>
           <xsl:with-param name="replace" select="$replace"/>
           <xsl:with-param name="with" select="$with"/>
         </xsl:call-template>
@@ -246,19 +300,19 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
+
   <xsl:template name="substring-after-last">
-    <xsl:param name="input" />
-    <xsl:param name="marker" />
+    <xsl:param name="input"/>
+    <xsl:param name="marker"/>
     <xsl:choose>
       <xsl:when test="contains($input,$marker)">
         <xsl:call-template name="substring-after-last">
-          <xsl:with-param name="input"
-          select="substring-after($input,$marker)" />
-          <xsl:with-param name="marker" select="$marker" />
+          <xsl:with-param name="input" select="substring-after($input,$marker)"/>
+          <xsl:with-param name="marker" select="$marker"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:value-of select="$input" />
+        <xsl:value-of select="$input"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>