alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (jdepend.xsl)

This example Ant source code file (jdepend.xsl) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

classes, classes, couplings, couplings, jdepend, license, license, nvcycles, nvcycles, nvexplanations, nvpackages, nvsummary, packages/package, pk

The jdepend.xsl source code

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<xsl:output method="html" indent="yes"  encoding="US-ASCII"/>

<xsl:template match="JDepend">
    <html>
    <head>
        <title>JDepend Analysis
        
    <style type="text/css">
      body {
        font:normal 68% verdana,arial,helvetica;
        color:#000000;
      }
      table tr td, tr th {
          font-size: 68%;
      }
      table.details tr th{
        font-weight: bold;
        text-align:left;
        background:#a6caf0;
      }
      table.details tr td{
        background:#eeeee0;
      }
      
      p {
        line-height:1.5em;
        margin-top:0.5em; margin-bottom:1.0em;
        margin-left:2em;
        margin-right:2em;
      }
      h1 {
        margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
      }
      h2 {
        margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
      }
      h3 {
        margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
      }
      h4 {
        margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
      }
      h5 {
        margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
      }
      h6 {
        margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
      }
      .Error {
        font-weight:bold; color:red;
      }
      .Failure {
        font-weight:bold; color:purple;
      }
      .Properties {
        text-align:right;
      }
      </style>
        
        
    </head>
    <body>
    <!--h1>JDepend Report
    <ul>
    <xsl:for-each select="./Packages/Package">
                <xsl:sort select="@name"/>
        <li>
    </xsl:for-each>
    </ul-->
    
    <h1>JDepend Analysis
    <p align="right">Designed for use with JDepend and Ant.

<hr size="2" /> <table width="100%">
<a name="NVsummary">

Summary

</td>
[<a href="#NVsummary">summary] [<a href="#NVpackages">packages] [<a href="#NVcycles">cycles] [<a href="#NVexplanations">explanations] </td>
<table width="100%" class="details"> <tr> <th>Package <th>Total Classes <th>Abstract Classes <th>Concrete Classes <th>Afferent Couplings <th>Efferent Couplings <th>Abstractness <th>Instability <th>Distance </tr> <xsl:for-each select="./Packages/Package"> <xsl:if test="count(error) = 0"> <tr> <td align="left"> <a> <xsl:attribute name="href">#PK </xsl:attribute> <xsl:value-of select="@name"/> </a> </td> <td align="right"> <td align="right"> <td align="right"> <td align="right"> <td align="right"> <td align="right"> <td align="right"> <td align="right"> </tr> </xsl:if> </xsl:for-each> <xsl:for-each select="./Packages/Package"> <xsl:if test="count(error) > 0"> <tr> <td align="left"> <xsl:value-of select="@name"/> </td> <td align="left" colspan="8"> </tr> </xsl:if> </xsl:for-each> </table> <table width="100%"> <a name="NVpackages">

Packages

</td> [<a href="#NVsummary">summary] [<a href="#NVpackages">packages] [<a href="#NVcycles">cycles] [<a href="#NVexplanations">explanations] </td> <xsl:for-each select="./Packages/Package"> <xsl:if test="count(error) = 0"> <h3>PK <xsl:value-of select="@name"/> <table width="100%"> <td>Afferent Couplings: <td>Efferent Couplings: <td>Abstractness: <td>Instability: <td>Distance: </tr> <table width="100%" class="details"> <tr> <th>Abstract Classes <th>Concrete Classes <th>Used by Packages <th>Uses Packages </tr> <tr> <td valign="top" width="25%"> <xsl:if test="count(AbstractClasses/Class)=0"> <i>None </xsl:if> <xsl:for-each select="AbstractClasses/Class"> <xsl:value-of select="node()"/>
</xsl:for-each> </td> <td valign="top" width="25%"> <xsl:if test="count(ConcreteClasses/Class)=0"> <i>None </xsl:if> <xsl:for-each select="ConcreteClasses/Class"> <xsl:value-of select="node()"/>
</xsl:for-each> </td> <td valign="top" width="25%"> <xsl:if test="count(UsedBy/Package)=0"> <i>None </xsl:if> <xsl:for-each select="UsedBy/Package"> <a> <xsl:attribute name="href">#PK <xsl:value-of select="node()"/> </a>
</xsl:for-each> </td> <td valign="top" width="25%"> <xsl:if test="count(DependsUpon/Package)=0"> <i>None </xsl:if> <xsl:for-each select="DependsUpon/Package"> <a> <xsl:attribute name="href">#PK <xsl:value-of select="node()"/> </a>
</xsl:for-each> </td> </tr> </table> </xsl:if> </xsl:for-each> <table width="100%"> <a name="NVcycles">

Cycles

</td> [<a href="#NVsummary">summary] [<a href="#NVpackages">packages] [<a href="#NVcycles">cycles] [<a href="#NVexplanations">explanations] </td> <xsl:if test="count(Cycles/Package) = 0"> <p>There are no cyclic dependancies.

</xsl:if> <xsl:for-each select="Cycles/Package"> <h3>

<xsl:for-each select="Package"> <xsl:value-of select="."/>
</xsl:for-each>

</xsl:for-each> <table width="100%"> <a name="NVexplanations">

Explanations

</td> [<a href="#NVsummary">summary] [<a href="#NVpackages">packages] [<a href="#NVcycles">cycles] [<a href="#NVexplanations">explanations] </td> <p>The following explanations are for quick reference and are lifted directly from the original JDepend documentation.

<h3>Number of Classes <p>The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.

<h3>Afferent Couplings <p>The number of other packages that depend upon classes within the package is an indicator of the package's responsibility.

<h3>Efferent Couplings <p>The number of other packages that the classes in the package depend upon is an indicator of the package's independence.

<h3>Abstractness <p>The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package.

<p>The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package.

<h3>Instability <p>The ratio of efferent coupling (Ce) to total coupling (Ce / (Ce + Ca)). This metric is an indicator of the package's resilience to change.

<p>The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package.

<h3>Distance <p>The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability.

<p>A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0).

<p>The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible.

</body> </html> </xsl:template> </xsl:stylesheet>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant jdepend.xsl source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.