[jsword-svn] jsword-support/tools/javancss/javancss21.41/xslt/svg s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue Aug 16 11:03:05 MST 2005


Update of /cvs/jsword/jsword-support/tools/javancss/javancss21.41/xslt/svg
In directory www.crosswire.org:/tmp/cvs-serv29457/tools/javancss/javancss21.41/xslt/svg

Added Files:
	javancss_out.html chart_ncss.xsl chart_function_package.svg 
	README.TXT chart_ncss.svg chart_ncss_package.svg 
	chart_function_package.xsl javancss_graph.xsl chart_ccn.xsl 
	chart_ccn.svg chart_ncss_package.xsl 
Log Message:
Upgrading jsword-support/tools

--- NEW FILE: chart_ccn.svg ---
<?xml version="1.0" encoding="utf-8"?>
<svg width="436pt" height="327pt" viewBox="0 0 4360 3270"><rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/><rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/><g style="fill:#FFFFFF; stroke-width:15; stroke:black"><rect x="40" y="40" width="4240" height="3160"/></g><g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;"><text id="Heading" x="4100" y="256">Distribution Cyclomatic</text><text x="4100" y="456">Complexity per Function (CCN)</text></g><g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; "><text>Cyclomatic Complexity</text></g><g style="fill:#008000; font-family:Arial;font-size:100;"><text id="Notes" x="2535" y="1080">Average Cyclomatic Complexity = 
       2.02</text><text x="2535" y="1200">Total Functions = 
      2247</text><text x="2535" y="1320">Total Cyclomatic Complexity = 
      4546</text></g><text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;">Functions</text><g style="font-family:Times New Roman;font-size:80; text-anchor:middle;"><text x="464" y="2970"> 0%</text><text x="814" y="2970">10%</text><text x="1164" y="2970">20%</text><text x="1514" y="2970">30%</text><text x="1864" y="2970">40%</text><text x="2214" y="2970">50%</text><text x="2564" y="2970">60%</text><text x="2914" y="2970">70%</text><text x="3264" y="2970">80%</text><text x="3614" y="2970">90%</text><text x="3964" y="2970">100%</text></g><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,2881 z M 814,2842 L 814,2881 z M 1164,2842 L 1164,2881 z M 1514,2842 L 1514,2881 z M 1864,2842 L 1864,2881 z M 2214,2842 L 2214,2881 z M 2564,2842 L 2564,2881 z M 2914,2842 L 2914,2881 z M 3264,2842 L 3264,2881 z M 3614,2842 L 3614,2881 z M 3964,2842 L 3964,2881 z  M 3964,2842 L 464,2842 z"/><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,300 z"/><path style="stroke:#000000; stroke-width:6" d="M 434,2842 L 463,2842 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2842">0</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2642" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2622 L 463,2622 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2622">1</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2422" width="2731" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2402 L 463,2402 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2402">2</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2202" width="90" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2182 L 463,2182 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2182">3</
text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1982" width="159" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1962 L 463,1962 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1962">4</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1762" width="89" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1742 L 463,1742 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1742">5</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1542" width="107" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1522 L 463,1522 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1522">6</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1322" width="78" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1302 L 463,1302 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1302">7</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1102" width="87" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1082 L 463,1082 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1082">8</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="882" width="53" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,862 L 463,862 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="862">9</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="662" width="31" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,642 L 463,642 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="642">10</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><r
ect x="464" y="442" width="75" height="176"/></g></svg>
--- NEW FILE: chart_function_package.xsl ---
<?xml version="1.0"?>  
<!-- Abstract : Style sheet to present data generated by JavaNCSS as a        -->
<!--            frequency table in a bar chart in SVG format.                 -->
<!--            Range of metric on y-axis is 0 to 4*average.                  -->
<!-- File     : chart_function_package.xsl                                    -->
<!-- Usage    : xt javancss_out.xml chart_function_package.xsl                -->
<!--            chart_function_package.svg                                    -->
<!-- Requires : XT and SVG plugin from www.adobe.com/svg                      -->
<!-- Input    : XML output of JavaNCSS tool.                                  -->
<!-- Output   : Frequency chart METRIC v UNIT in SVG format.                  --> 
<!-- History  : 16/08/02 Y. Coene (yves.coene13 at yucom.be)                     -->
<!--                   Original.  Shows table in SVG format.                  -->

<!DOCTYPE BARCHART [
  <!ENTITY UNIT        "javancss/packages/package">
  <!ENTITY METRIC      "javancss/packages/package/functions">
  <!ENTITY SHORTMETRIC "functions">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


<!-- global variables -->

     <xsl:variable name="title1">Distribution Functions</xsl:variable>
     <xsl:variable name="title2">per Package</xsl:variable>
     <xsl:variable name="labelx">Packages</xsl:variable>
     <xsl:variable name="labely">Functions</xsl:variable>

     <xsl:variable name="dx">   <!-- pixels between ticks on x axis = 10*dx -->
        35
     </xsl:variable>
     <xsl:variable name="dy">   <!-- pixels between ticks on y axis = dy    -->
        220
     </xsl:variable>
     <xsl:variable name="x0">   <!-- x offset of origin -->
        464
     </xsl:variable>

     <xsl:variable name="last_value">
        <xsl:value-of select="4 * sum(&METRIC;) div count(&UNIT;)"/>
     </xsl:variable>

     <xsl:variable name="step_value">
        <xsl:value-of select="floor($last_value div 10)+1"/>
     </xsl:variable>


<xsl:template match="/">

 <svg width="436pt" height="327pt" viewBox="0 0 4360 3270">
 <rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/>
 <rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/>
 <g style="fill:#FFFFFF; stroke-width:15; stroke:black">
     <rect x="40" y="40" width="4240" height="3160"/>
 </g>

 <g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;">
     <text id="Heading" x="4100" y="256"><xsl:value-of select="$title1"/></text>
     <text x="4100" y="456"><xsl:value-of select="$title2"/></text>
 </g>

 <g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; ">
     <text><xsl:value-of select="$labely"/></text>
 </g>
 <g style="fill:#008000; font-family:Arial;font-size:100;">
 <text id="Notes" x="2535" y="1080">Average <xsl:value-of select="$labely"/> = 
       <xsl:value-of select="format-number(sum(&METRIC;) div count(&UNIT;),'0.00')"/>
 </text>
 <text x="2535" y="1200">Total <xsl:value-of select="$labelx"/> = 
      <xsl:value-of select="count(&UNIT;)"/>
 </text>
 <text x="2535" y="1320">Total <xsl:value-of select="$labely"/> = 
      <xsl:value-of select="sum(&METRIC;)"/>
 </text>

 </g>
 <text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;"><xsl:value-of select="$labelx"/></text>

 <g style="font-family:Times New Roman;font-size:80; text-anchor:middle;">
  <text x="{($x0)+0}" y="2970"> 0%</text>
  <text x="{$x0+10*$dx}" y="2970">10%</text>
  <text x="{$x0+20*$dx}" y="2970">20%</text>
  <text x="{$x0+30*$dx}" y="2970">30%</text>
  <text x="{$x0+40*$dx}" y="2970">40%</text>
  <text x="{$x0+50*$dx}" y="2970">50%</text>
  <text x="{$x0+60*$dx}" y="2970">60%</text>
  <text x="{$x0+70*$dx}" y="2970">70%</text>
  <text x="{$x0+80*$dx}" y="2970">80%</text>
  <text x="{$x0+90*$dx}" y="2970">90%</text>
  <text x="{$x0+100*$dx}" y="2970">100%</text>
 </g>

 <!-- x-axis with ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},2881 z M {($x0)+10*$dx},2842 L {($x0)+10*$dx},2881 z M {($x0)+20*$dx},2842 L {$x0+20*$dx},2881 z M {$x0+30*$dx},2842 L {$x0+30*$dx},2881 z M {$x0+40*$dx},2842 L {$x0+40*$dx},2881 z M {$x0+50*$dx},2842 L {$x0+50*$dx},2881 z M {$x0+60*$dx},2842 L {$x0+60*$dx},2881 z M {$x0+70*$dx},2842 L {$x0+70*$dx},2881 z M {$x0+80*$dx},2842 L {$x0+80*$dx},2881 z M {$x0+90*$dx},2842 L {$x0+90*$dx},2881 z M {$x0+100*$dx},2842 L {$x0+100*$dx},2881 z  M {$x0+100*$dx},2842 L {$x0+0*$dx},2842 z"/>

 <!-- y-axis without ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},300 z"/>

       <xsl:call-template name="LOOP">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>  <!-- defines number of horizontal bars -->
       </xsl:call-template>

  </svg>
</xsl:template>


<!-- named templates to simplify ...  Use recursion to implement loop  -->

<xsl:template name="ITEM">
   <xsl:param name="i">0</xsl:param>
   <xsl:param name="x">0</xsl:param>
   <xsl:param name="y">0</xsl:param>
   <xsl:param name="p">0</xsl:param>

   <!-- tick on vertical axis -->
   <path style="stroke:#000000; stroke-width:6" d="M {($x0)-30},{2842-$i*$dy} L {($x0)-1},{2842-$i*$dy} z"/>

   <!-- label on vertical axis -->
   <g style="font-family:Times New Roman;font-size:80; text-anchor:end;">
       <text x='{($x0)-40}' y='{2842-$i*$dy}'>
           <xsl:value-of select="$x"/>
       </text>
   </g>

   <!-- rectangle representing frequency (0 to 100)-->
   <g style="fill:#DBDBED;stroke-width:4; stroke:black">
       <rect x="{($x0)+0}" y='{2842-$i*($dy)-176-24}' width="{format-number($p*$dx*100,'0')}" height="{($dy)-44}"/>
   </g>
</xsl:template>


<xsl:template name="LOOP">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n and &SHORTMETRIC; &lt; $step_value*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="i"><xsl:value-of select="$n"/></xsl:with-param>
          <xsl:with-param name="x"><xsl:value-of select="$step_value*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(&UNIT;)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  

</xsl:template>

</xsl:stylesheet> 
--- NEW FILE: chart_ncss.svg ---
<?xml version="1.0" encoding="utf-8"?>
<svg width="436pt" height="327pt" viewBox="0 0 4360 3270"><rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/><rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/><g style="fill:#FFFFFF; stroke-width:15; stroke:black"><rect x="40" y="40" width="4240" height="3160"/></g><g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;"><text id="Heading" x="4100" y="256">Distribution Java Source Statements</text><text x="4100" y="456">per Function (NCSS)</text></g><g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; "><text>Java NCSS</text></g><g style="fill:#008000; font-family:Arial;font-size:100;"><text id="Notes" x="2535" y="1080">Average Java NCSS = 
       5.18</text><text x="2535" y="1200">Total Functions = 
      2247</text><text x="2535" y="1320">Total Java NCSS = 
      11642</text></g><text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;">Functions</text><g style="font-family:Times New Roman;font-size:80; text-anchor:middle;"><text x="464" y="2970"> 0%</text><text x="814" y="2970">10%</text><text x="1164" y="2970">20%</text><text x="1514" y="2970">30%</text><text x="1864" y="2970">40%</text><text x="2214" y="2970">50%</text><text x="2564" y="2970">60%</text><text x="2914" y="2970">70%</text><text x="3264" y="2970">80%</text><text x="3614" y="2970">90%</text><text x="3964" y="2970">100%</text></g><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,2881 z M 814,2842 L 814,2881 z M 1164,2842 L 1164,2881 z M 1514,2842 L 1514,2881 z M 1864,2842 L 1864,2881 z M 2214,2842 L 2214,2881 z M 2564,2842 L 2564,2881 z M 2914,2842 L 2914,2881 z M 3264,2842 L 3264,2881 z M 3614,2842 L 3614,2881 z M 3964,2842 L 3964,2881 z  M 3964,2842 L 464,2842 z"/><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,300 z"/><path style="stroke:#000000; stroke-width:6" d="M 434,2842 L 463,2842 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2842">0</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2642" width="2371" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2622 L 463,2622 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2622">3</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2422" width="330" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2402 L 463,2402 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2402">6</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2202" width="162" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2182 L 463,2182 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2182"
>9</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1982" width="154" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1962 L 463,1962 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1962">12</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1762" width="139" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1742 L 463,1742 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1742">15</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1542" width="129" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1522 L 463,1522 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1522">18</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1322" width="45" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1302 L 463,1302 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1302">21</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1102" width="25" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1082 L 463,1082 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1082">24</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="882" width="34" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,862 L 463,862 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="862">27</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="662" width="23" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,642 L 463,642 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="642">30</text></g><g style="fill:#DBDBED;stroke-width:4; strok
e:black"><rect x="464" y="442" width="87" height="176"/></g></svg>
--- NEW FILE: chart_ncss_package.xsl ---
<?xml version="1.0"?>  
<!-- Abstract : Style sheet to present data generated by JavaNCSS as a        -->
<!--            frequency table in a bar chart in SVG format.                 -->
<!--            Range of metric on y-axis is 0 to 4*average.                  -->
<!-- File     : chart_ncss_package.xsl                                        -->
<!-- Usage    : xt javancss_out.xml chart_ncss_package.xsl                    -->
<!--            chart_ncss_package.svg                                        -->
<!-- Requires : XT and SVG plugin from www.adobe.com/svg                      -->
<!-- Input    : XML output of JavaNCSS tool.                                  -->
<!-- Output   : Frequency chart METRIC v UNIT in SVG format.                  --> 
<!-- History  : 16/08/02 Y. Coene (yves.coene13 at yucom.be)                     -->
<!--                   Original.  Shows table in SVG format.                  -->

<!DOCTYPE BARCHART [
  <!ENTITY UNIT        "javancss/packages/package">
  <!ENTITY METRIC      "javancss/packages/package/ncss">
  <!ENTITY SHORTMETRIC "ncss">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


<!-- global variables -->

     <xsl:variable name="title1">Distribution Java Source Statements</xsl:variable>
     <xsl:variable name="title2">per Package (NCSS)</xsl:variable>
     <xsl:variable name="labelx">Packages</xsl:variable>
     <xsl:variable name="labely">Java NCSS</xsl:variable>

     <xsl:variable name="dx">   <!-- pixels between ticks on x axis = 10*dx -->
        35
     </xsl:variable>
     <xsl:variable name="dy">   <!-- pixels between ticks on y axis = dy    -->
        220
     </xsl:variable>
     <xsl:variable name="x0">   <!-- x offset of origin -->
        464
     </xsl:variable>

     <xsl:variable name="last_value">
        <xsl:value-of select="4 * sum(&METRIC;) div count(&UNIT;)"/>
     </xsl:variable>

     <xsl:variable name="step_value">
        <xsl:value-of select="floor($last_value div 10)+1"/>
     </xsl:variable>


<xsl:template match="/">

 <svg width="436pt" height="327pt" viewBox="0 0 4360 3270">
 <rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/>
 <rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/>
 <g style="fill:#FFFFFF; stroke-width:15; stroke:black">
     <rect x="40" y="40" width="4240" height="3160"/>
 </g>

 <g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;">
     <text id="Heading" x="4100" y="256"><xsl:value-of select="$title1"/></text>
     <text x="4100" y="456"><xsl:value-of select="$title2"/></text>
 </g>

 <g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; ">
     <text><xsl:value-of select="$labely"/></text>
 </g>
 <g style="fill:#008000; font-family:Arial;font-size:100;">
 <text id="Notes" x="2535" y="1080">Average <xsl:value-of select="$labely"/> = 
       <xsl:value-of select="format-number(sum(&METRIC;) div count(&UNIT;),'0.00')"/>
 </text>
 <text x="2535" y="1200">Total <xsl:value-of select="$labelx"/> = 
      <xsl:value-of select="count(&UNIT;)"/>
 </text>
 <text x="2535" y="1320">Total <xsl:value-of select="$labely"/> = 
      <xsl:value-of select="sum(&METRIC;)"/>
 </text>

 </g>
 <text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;"><xsl:value-of select="$labelx"/></text>

 <g style="font-family:Times New Roman;font-size:80; text-anchor:middle;">
  <text x="{($x0)+0}" y="2970"> 0%</text>
  <text x="{$x0+10*$dx}" y="2970">10%</text>
  <text x="{$x0+20*$dx}" y="2970">20%</text>
  <text x="{$x0+30*$dx}" y="2970">30%</text>
  <text x="{$x0+40*$dx}" y="2970">40%</text>
  <text x="{$x0+50*$dx}" y="2970">50%</text>
  <text x="{$x0+60*$dx}" y="2970">60%</text>
  <text x="{$x0+70*$dx}" y="2970">70%</text>
  <text x="{$x0+80*$dx}" y="2970">80%</text>
  <text x="{$x0+90*$dx}" y="2970">90%</text>
  <text x="{$x0+100*$dx}" y="2970">100%</text>
 </g>

 <!-- x-axis with ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},2881 z M {($x0)+10*$dx},2842 L {($x0)+10*$dx},2881 z M {($x0)+20*$dx},2842 L {$x0+20*$dx},2881 z M {$x0+30*$dx},2842 L {$x0+30*$dx},2881 z M {$x0+40*$dx},2842 L {$x0+40*$dx},2881 z M {$x0+50*$dx},2842 L {$x0+50*$dx},2881 z M {$x0+60*$dx},2842 L {$x0+60*$dx},2881 z M {$x0+70*$dx},2842 L {$x0+70*$dx},2881 z M {$x0+80*$dx},2842 L {$x0+80*$dx},2881 z M {$x0+90*$dx},2842 L {$x0+90*$dx},2881 z M {$x0+100*$dx},2842 L {$x0+100*$dx},2881 z  M {$x0+100*$dx},2842 L {$x0+0*$dx},2842 z"/>

 <!-- y-axis without ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},300 z"/>

       <xsl:call-template name="LOOP">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>  <!-- defines number of horizontal bars -->
       </xsl:call-template>

  </svg>
</xsl:template>


<!-- named templates to simplify ...  Use recursion to implement loop  -->

<xsl:template name="ITEM">
   <xsl:param name="i">0</xsl:param>
   <xsl:param name="x">0</xsl:param>
   <xsl:param name="y">0</xsl:param>
   <xsl:param name="p">0</xsl:param>

   <!-- tick on vertical axis -->
   <path style="stroke:#000000; stroke-width:6" d="M {($x0)-30},{2842-$i*$dy} L {($x0)-1},{2842-$i*$dy} z"/>

   <!-- label on vertical axis -->
   <g style="font-family:Times New Roman;font-size:80; text-anchor:end;">
       <text x='{($x0)-40}' y='{2842-$i*$dy}'>
           <xsl:value-of select="$x"/>
       </text>
   </g>

   <!-- rectangle representing frequency (0 to 100)-->
   <g style="fill:#DBDBED;stroke-width:4; stroke:black">
       <rect x="{($x0)+0}" y='{2842-$i*($dy)-176-24}' width="{format-number($p*$dx*100,'0')}" height="{($dy)-44}"/>
   </g>
</xsl:template>


<xsl:template name="LOOP">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n and &SHORTMETRIC; &lt; $step_value*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="i"><xsl:value-of select="$n"/></xsl:with-param>
          <xsl:with-param name="x"><xsl:value-of select="$step_value*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(&UNIT;)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  

</xsl:template>

</xsl:stylesheet> 
--- NEW FILE: chart_ccn.xsl ---
<?xml version="1.0"?>  
<!-- Abstract : Style sheet to present data generated by JavaNCSS as a        -->
<!--            frequency table in a bar chart in SVG format.                 -->
<!--            Range of metric on y-axis is 0 to 4*average.                  -->
<!-- File     : chart_ccn.xsl                                                 -->
<!-- Usage    : xt javancss_out.xml chart_ccn.xsl chart_ccn.svg               -->
<!-- Requires : XT and SVG plugin from www.adobe.com/svg                      -->
<!-- Input    : XML output of JavaNCSS tool.                                  -->
<!-- Output   : Frequency chart METRIC v UNIT in SVG format.                  --> 
<!-- History  : 16/08/02 Y. Coene (yves.coene13 at yucom.be)                     -->
<!--                   Original.  Shows table in SVG format.                  -->

<!DOCTYPE BARCHART [
  <!ENTITY UNIT        "javancss/functions/function">
  <!ENTITY METRIC      "javancss/functions/function/ccn">
  <!ENTITY SHORTMETRIC "ccn">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


<!-- global variables -->

     <xsl:variable name="title1">Distribution Cyclomatic</xsl:variable>
     <xsl:variable name="title2">Complexity per Function (CCN)</xsl:variable>
     <xsl:variable name="labelx">Functions</xsl:variable>
     <xsl:variable name="labely">Cyclomatic Complexity</xsl:variable>

     <xsl:variable name="dx">   <!-- pixels between ticks on x axis = 10*dx -->
        35
     </xsl:variable>
     <xsl:variable name="dy">   <!-- pixels between ticks on y axis = dy    -->
        220
     </xsl:variable>
     <xsl:variable name="x0">   <!-- x offset of origin -->
        464
     </xsl:variable>

     <xsl:variable name="last_value">
        <xsl:value-of select="4 * sum(&METRIC;) div count(&UNIT;)"/>
     </xsl:variable>

     <xsl:variable name="step_value">
        <xsl:value-of select="floor($last_value div 10)+1"/>
     </xsl:variable>


<xsl:template match="/">

 <svg width="436pt" height="327pt" viewBox="0 0 4360 3270">
 <rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/>
 <rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/>
 <g style="fill:#FFFFFF; stroke-width:15; stroke:black">
     <rect x="40" y="40" width="4240" height="3160"/>
 </g>

 <g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;">
     <text id="Heading" x="4100" y="256"><xsl:value-of select="$title1"/></text>
     <text x="4100" y="456"><xsl:value-of select="$title2"/></text>
 </g>

 <g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; ">
     <text><xsl:value-of select="$labely"/></text>
 </g>
 <g style="fill:#008000; font-family:Arial;font-size:100;">
 <text id="Notes" x="2535" y="1080">Average <xsl:value-of select="$labely"/> = 
       <xsl:value-of select="format-number(sum(&METRIC;) div count(&UNIT;),'0.00')"/>
 </text>
 <text x="2535" y="1200">Total <xsl:value-of select="$labelx"/> = 
      <xsl:value-of select="count(&UNIT;)"/>
 </text>
 <text x="2535" y="1320">Total <xsl:value-of select="$labely"/> = 
      <xsl:value-of select="sum(&METRIC;)"/>
 </text>

 </g>
 <text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;"><xsl:value-of select="$labelx"/></text>

 <g style="font-family:Times New Roman;font-size:80; text-anchor:middle;">
  <text x="{($x0)+0}" y="2970"> 0%</text>
  <text x="{$x0+10*$dx}" y="2970">10%</text>
  <text x="{$x0+20*$dx}" y="2970">20%</text>
  <text x="{$x0+30*$dx}" y="2970">30%</text>
  <text x="{$x0+40*$dx}" y="2970">40%</text>
  <text x="{$x0+50*$dx}" y="2970">50%</text>
  <text x="{$x0+60*$dx}" y="2970">60%</text>
  <text x="{$x0+70*$dx}" y="2970">70%</text>
  <text x="{$x0+80*$dx}" y="2970">80%</text>
  <text x="{$x0+90*$dx}" y="2970">90%</text>
  <text x="{$x0+100*$dx}" y="2970">100%</text>
 </g>

 <!-- x-axis with ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},2881 z M {($x0)+10*$dx},2842 L {($x0)+10*$dx},2881 z M {($x0)+20*$dx},2842 L {$x0+20*$dx},2881 z M {$x0+30*$dx},2842 L {$x0+30*$dx},2881 z M {$x0+40*$dx},2842 L {$x0+40*$dx},2881 z M {$x0+50*$dx},2842 L {$x0+50*$dx},2881 z M {$x0+60*$dx},2842 L {$x0+60*$dx},2881 z M {$x0+70*$dx},2842 L {$x0+70*$dx},2881 z M {$x0+80*$dx},2842 L {$x0+80*$dx},2881 z M {$x0+90*$dx},2842 L {$x0+90*$dx},2881 z M {$x0+100*$dx},2842 L {$x0+100*$dx},2881 z  M {$x0+100*$dx},2842 L {$x0+0*$dx},2842 z"/>

 <!-- y-axis without ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},300 z"/>

       <xsl:call-template name="LOOP">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>  <!-- defines number of horizontal bars -->
       </xsl:call-template>

  </svg>
</xsl:template>


<!-- named templates to simplify ...  Use recursion to implement loop  -->

<xsl:template name="ITEM">
   <xsl:param name="i">0</xsl:param>
   <xsl:param name="x">0</xsl:param>
   <xsl:param name="y">0</xsl:param>
   <xsl:param name="p">0</xsl:param>

   <!-- tick on vertical axis -->
   <path style="stroke:#000000; stroke-width:6" d="M {($x0)-30},{2842-$i*$dy} L {($x0)-1},{2842-$i*$dy} z"/>

   <!-- label on vertical axis -->
   <g style="font-family:Times New Roman;font-size:80; text-anchor:end;">
       <text x='{($x0)-40}' y='{2842-$i*$dy}'>
           <xsl:value-of select="$x"/>
       </text>
   </g>

   <!-- rectangle representing frequency (0 to 100)-->
   <g style="fill:#DBDBED;stroke-width:4; stroke:black">
       <rect x="{($x0)+0}" y='{2842-$i*($dy)-176-24}' width="{format-number($p*$dx*100,'0')}" height="{($dy)-44}"/>
   </g>
</xsl:template>


<xsl:template name="LOOP">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n and &SHORTMETRIC; &lt; $step_value*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="i"><xsl:value-of select="$n"/></xsl:with-param>
          <xsl:with-param name="x"><xsl:value-of select="$step_value*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(&UNIT;)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  

</xsl:template>

</xsl:stylesheet> 
--- NEW FILE: chart_ncss.xsl ---
<?xml version="1.0"?>  
<!-- Abstract : Style sheet to present data generated by JavaNCSS as a        -->
<!--            frequency table in a bar chart in SVG format.                 -->
<!--            Range of metric on y-axis is 0 to 4*average.                  -->
<!-- File     : chart_ncss.xsl                                                -->
<!-- Usage    : xt javancss_out.xml chart_ncss.xsl chart_ncss.svg             -->
<!-- Requires : XT and SVG plugin from www.adobe.com/svg                      -->
<!-- Input    : XML output of JavaNCSS tool.                                  -->
<!-- Output   : Frequency chart METRIC v UNIT in SVG format.                  --> 
<!-- History  : 16/08/02 Y. Coene (yves.coene13 at yucom.be)                     -->
<!--                   Original.  Shows table in SVG format.                  -->

<!DOCTYPE BARCHART [
  <!ENTITY UNIT        "javancss/functions/function">
  <!ENTITY METRIC      "javancss/functions/function/ncss">
  <!ENTITY SHORTMETRIC "ncss">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


<!-- global variables -->

     <xsl:variable name="title1">Distribution Java Source Statements</xsl:variable>
     <xsl:variable name="title2">per Function (NCSS)</xsl:variable>
     <xsl:variable name="labelx">Functions</xsl:variable>
     <xsl:variable name="labely">Java NCSS</xsl:variable>

     <xsl:variable name="dx">   <!-- pixels between ticks on x axis = 10*dx -->
        35
     </xsl:variable>
     <xsl:variable name="dy">   <!-- pixels between ticks on y axis = dy    -->
        220
     </xsl:variable>
     <xsl:variable name="x0">   <!-- x offset of origin -->
        464
     </xsl:variable>

     <xsl:variable name="last_value">
        <xsl:value-of select="4 * sum(&METRIC;) div count(&UNIT;)"/>
     </xsl:variable>

     <xsl:variable name="step_value">
        <xsl:value-of select="floor($last_value div 10)+1"/>
     </xsl:variable>


<xsl:template match="/">

 <svg width="436pt" height="327pt" viewBox="0 0 4360 3270">
 <rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/>
 <rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/>
 <g style="fill:#FFFFFF; stroke-width:15; stroke:black">
     <rect x="40" y="40" width="4240" height="3160"/>
 </g>

 <g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;">
     <text id="Heading" x="4100" y="256"><xsl:value-of select="$title1"/></text>
     <text x="4100" y="456"><xsl:value-of select="$title2"/></text>
 </g>

 <g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; ">
     <text><xsl:value-of select="$labely"/></text>
 </g>
 <g style="fill:#008000; font-family:Arial;font-size:100;">
 <text id="Notes" x="2535" y="1080">Average <xsl:value-of select="$labely"/> = 
       <xsl:value-of select="format-number(sum(&METRIC;) div count(&UNIT;),'0.00')"/>
 </text>
 <text x="2535" y="1200">Total <xsl:value-of select="$labelx"/> = 
      <xsl:value-of select="count(&UNIT;)"/>
 </text>
 <text x="2535" y="1320">Total <xsl:value-of select="$labely"/> = 
      <xsl:value-of select="sum(&METRIC;)"/>
 </text>

 </g>
 <text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;"><xsl:value-of select="$labelx"/></text>

 <g style="font-family:Times New Roman;font-size:80; text-anchor:middle;">
  <text x="{($x0)+0}" y="2970"> 0%</text>
  <text x="{$x0+10*$dx}" y="2970">10%</text>
  <text x="{$x0+20*$dx}" y="2970">20%</text>
  <text x="{$x0+30*$dx}" y="2970">30%</text>
  <text x="{$x0+40*$dx}" y="2970">40%</text>
  <text x="{$x0+50*$dx}" y="2970">50%</text>
  <text x="{$x0+60*$dx}" y="2970">60%</text>
  <text x="{$x0+70*$dx}" y="2970">70%</text>
  <text x="{$x0+80*$dx}" y="2970">80%</text>
  <text x="{$x0+90*$dx}" y="2970">90%</text>
  <text x="{$x0+100*$dx}" y="2970">100%</text>
 </g>

 <!-- x-axis with ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},2881 z M {($x0)+10*$dx},2842 L {($x0)+10*$dx},2881 z M {($x0)+20*$dx},2842 L {$x0+20*$dx},2881 z M {$x0+30*$dx},2842 L {$x0+30*$dx},2881 z M {$x0+40*$dx},2842 L {$x0+40*$dx},2881 z M {$x0+50*$dx},2842 L {$x0+50*$dx},2881 z M {$x0+60*$dx},2842 L {$x0+60*$dx},2881 z M {$x0+70*$dx},2842 L {$x0+70*$dx},2881 z M {$x0+80*$dx},2842 L {$x0+80*$dx},2881 z M {$x0+90*$dx},2842 L {$x0+90*$dx},2881 z M {$x0+100*$dx},2842 L {$x0+100*$dx},2881 z  M {$x0+100*$dx},2842 L {$x0+0*$dx},2842 z"/>

 <!-- y-axis without ticks -->
 <path style="stroke:#000000; stroke-width:6" d="M {($x0)+0},2842 L {($x0)+0},300 z"/>

       <xsl:call-template name="LOOP">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>  <!-- defines number of horizontal bars -->
       </xsl:call-template>

  </svg>
</xsl:template>


<!-- named templates to simplify ...  Use recursion to implement loop  -->

<xsl:template name="ITEM">
   <xsl:param name="i">0</xsl:param>
   <xsl:param name="x">0</xsl:param>
   <xsl:param name="y">0</xsl:param>
   <xsl:param name="p">0</xsl:param>

   <!-- tick on vertical axis -->
   <path style="stroke:#000000; stroke-width:6" d="M {($x0)-30},{2842-$i*$dy} L {($x0)-1},{2842-$i*$dy} z"/>

   <!-- label on vertical axis -->
   <g style="font-family:Times New Roman;font-size:80; text-anchor:end;">
       <text x='{($x0)-40}' y='{2842-$i*$dy}'>
           <xsl:value-of select="$x"/>
       </text>
   </g>

   <!-- rectangle representing frequency (0 to 100)-->
   <g style="fill:#DBDBED;stroke-width:4; stroke:black">
       <rect x="{($x0)+0}" y='{2842-$i*($dy)-176-24}' width="{format-number($p*$dx*100,'0')}" height="{($dy)-44}"/>
   </g>
</xsl:template>


<xsl:template name="LOOP">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n and &SHORTMETRIC; &lt; $step_value*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(&UNIT;[&SHORTMETRIC; >= $step_value*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="i"><xsl:value-of select="$n"/></xsl:with-param>
          <xsl:with-param name="x"><xsl:value-of select="$step_value*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(&UNIT;)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  

</xsl:template>

</xsl:stylesheet> 
--- NEW FILE: chart_ncss_package.svg ---
<?xml version="1.0" encoding="utf-8"?>
<svg width="436pt" height="327pt" viewBox="0 0 4360 3270"><rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/><rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/><g style="fill:#FFFFFF; stroke-width:15; stroke:black"><rect x="40" y="40" width="4240" height="3160"/></g><g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;"><text id="Heading" x="4100" y="256">Distribution Java Source Statements</text><text x="4100" y="456">per Package (NCSS)</text></g><g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; "><text>Java NCSS</text></g><g style="fill:#008000; font-family:Arial;font-size:100;"><text id="Notes" x="2535" y="1080">Average Java NCSS = 
       740.40</text><text x="2535" y="1200">Total Packages = 
      20</text><text x="2535" y="1320">Total Java NCSS = 
      14808</text></g><text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;">Packages</text><g style="font-family:Times New Roman;font-size:80; text-anchor:middle;"><text x="464" y="2970"> 0%</text><text x="814" y="2970">10%</text><text x="1164" y="2970">20%</text><text x="1514" y="2970">30%</text><text x="1864" y="2970">40%</text><text x="2214" y="2970">50%</text><text x="2564" y="2970">60%</text><text x="2914" y="2970">70%</text><text x="3264" y="2970">80%</text><text x="3614" y="2970">90%</text><text x="3964" y="2970">100%</text></g><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,2881 z M 814,2842 L 814,2881 z M 1164,2842 L 1164,2881 z M 1514,2842 L 1514,2881 z M 1864,2842 L 1864,2881 z M 2214,2842 L 2214,2881 z M 2564,2842 L 2564,2881 z M 2914,2842 L 2914,2881 z M 3264,2842 L 3264,2881 z M 3614,2842 L 3614,2881 z M 3964,2842 L 3964,2881 z  M 3964,2842 L 464,2842 z"/><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,300 z"/><path style="stroke:#000000; stroke-width:6" d="M 434,2842 L 463,2842 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2842">0</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2642" width="1575" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2622 L 463,2622 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2622">297</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2422" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2402 L 463,2402 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2402">594</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2202" width="525" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2182 L 463,2182 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="21
82">891</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1982" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1962 L 463,1962 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1962">1188</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1762" width="525" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1742 L 463,1742 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1742">1485</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1542" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1522 L 463,1522 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1522">1782</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1322" width="350" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1302 L 463,1302 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1302">2079</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1102" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1082 L 463,1082 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1082">2376</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="882" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,862 L 463,862 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="862">2673</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="662" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,642 L 463,642 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="642">2970</text></g><g style="fill:#DBDBED;stro
ke-width:4; stroke:black"><rect x="464" y="442" width="0" height="176"/></g></svg>
--- NEW FILE: javancss_out.html ---
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns="http://www.w3.org/TR/REC-html40"><head>
    <!--[if !mso]> 
  <style>
  v\:* {behavior:url(#default#VML);}
  o\:* {behavior:url(#default#VML);}
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
  
  <title>JavaNCSS Analysis</title></head><body><table width="100%"><tr><td><h3>JavaNCSS Analysis</h3></td><td><p align="right">Designed for use with <a href="http://www.kclee.com/clemens/java/javancss/">JavaNCSS</a>.</p></td></tr></table><hr size="2"/><p><table><tr><td><b>NCSS</b></td><td><b>Functions</b></td><td><b>Percent</b></td></tr><tr xmlns=""><td>0</td><td><p align="right">1522</p></td><td><p align="right">67.73%</p></td><td>
        <v:rect style='width:
   271
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>3</td><td><p align="right">212</p></td><td><p align="right">9.43%</p></td><td>
        <v:rect style='width:
   38
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>6</td><td><p align="right">104</p></td><td><p align="right">4.63%</p></td><td>
        <v:rect style='width:
   19
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>9</td><td><p align="right">99</p></td><td><p align="right">4.41%</p></td><td>
        <v:rect style='width:
   18
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>12</td><td><p align="right">89</p></td><td><p align="right">3.96%</p></td><td>
        <v:rect style='width:
   16
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>15</td><td><p align="right">83</p></td><td><p align="right">3.69%</p></td><td>
        <v:rect style='width:
   15
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>18</td><td><p align="right">29</p></td><td><p align="right">1.29%</p></td><td>
        <v:rect style='width:
   5
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>21</td><td><p align="right">16</p></td><td><p align="right">0.71%</p></td><td>
        <v:rect style='width:
   3
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>24</td><td><p align="right">22</p></td><td><p align="right">0.98%</p></td><td>
        <v:rect style='width:
   4
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>27</td><td><p align="right">15</p></td><td><p align="right">0.67%</p></td><td>
        <v:rect style='width:
   3
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>30</td><td><p align="right">56</p></td><td><p align="right">2.49%</p></td><td>
        <v:rect style='width:
   10
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr></table><table><tr><td><b>CCN</b></td><td><b>Functions</b></td><td><b>Percent</b></td></tr><tr xmlns=""><td>0</td><td><p align="right">0</p></td><td><p align="right">0.00%</p></td><td>
        <v:rect style='width:
   0
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>1</td><td><p align="right">1753</p></td><td><p align="right">78.02%</p></td><td>
        <v:rect style='width:
   312
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>2</td><td><p align="right">58</p></td><td><p align="right">2.58%</p></td><td>
        <v:rect style='width:
   10
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>3</td><td><p align="right">102</p></td><td><p align="right">4.54%</p></td><td>
        <v:rect style='width:
   18
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>4</td><td><p align="right">57</p></td><td><p align="right">2.54%</p></td><td>
        <v:rect style='width:
   10
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>5</td><td><p align="right">69</p></td><td><p align="right">3.07%</p></td><td>
        <v:rect style='width:
   12
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>6</td><td><p align="right">50</p></td><td><p align="right">2.23%</p></td><td>
        <v:rect style='width:
   9
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>7</td><td><p align="right">56</p></td><td><p align="right">2.49%</p></td><td>
        <v:rect style='width:
   10
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>8</td><td><p align="right">34</p></td><td><p align="right">1.51%</p></td><td>
        <v:rect style='width:
   6
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>9</td><td><p align="right">20</p></td><td><p align="right">0.89%</p></td><td>
        <v:rect style='width:
   4
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr><tr xmlns=""><td>10</td><td><p align="right">48</p></td><td><p align="right">2.14%</p></td><td>
        <v:rect style='width:
   9
        pt;height:8pt'fillcolor="red" ></v:rect>
    </td></tr></table></p></body></html>
--- NEW FILE: javancss_graph.xsl ---
<?xml version="1.0"?>  
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- Abstract : Style sheet to format JavaNCSS XML output as frequency tables -->
<!-- Requires : XT or IE5 + MSXML 3.0                                         -->
<!-- History  : 10/08/02 Y. Coene                                             -->
<!--                   Original.  Shows tables in IE5 and NS4, and VML bar    -->
<!--                   chart with IE5 only.                                   -->

<!-- to do: add for-each and sort to know max value .... -->


<!-- global variables -->

     <xsl:variable name="metric">
        ncss
     </xsl:variable>

     <xsl:variable name="last_value_ncss">
        <xsl:value-of select="4 * sum(javancss/functions/function/ncss) div count(javancss/functions/function)"/>
     </xsl:variable>

     <xsl:variable name="step_value_ncss">
        <xsl:value-of select="floor($last_value_ncss div 10)+1"/>
     </xsl:variable>

     <xsl:variable name="last_value_ccn">
        <xsl:value-of select="4 * sum(javancss/functions/function/ccn) div count(javancss/functions/function)"/>
     </xsl:variable>

     <xsl:variable name="step_value_ccn">
        <xsl:value-of select="floor($last_value_ccn div 10)+1"/>
     </xsl:variable>


<xsl:template match="/">
  <html xmlns:v="urn:schemas-microsoft-com:vml"
        xmlns:o="urn:schemas-microsoft-com:office:office"
        xmlns="http://www.w3.org/TR/REC-html40">

  <head>
  <xsl:text disable-output-escaping="yes">
    &lt;!--[if !mso]&gt; 
  &lt;style&gt;
  v\:* {behavior:url(#default#VML);}
  o\:* {behavior:url(#default#VML);}
  .shape {behavior:url(#default#VML);}
  &lt;/style&gt;
  &lt;![endif]--&gt;
  
  </xsl:text>


    <title>JavaNCSS Analysis</title>
    </head>
    <body>
    <table width="100%">
        <tr>
        <td><h3>JavaNCSS Analysis</h3></td>
        <td>
        <p align="right">Designed for use with <a href="http://www.kclee.com/clemens/java/javancss/">JavaNCSS</a>.</p>
        </td>
        </tr>        
    </table>
    <hr size="2"/><p>

    <!-- table with distribution of ncss metric -->
    <table>
       <tr><td><b>NCSS</b></td><td><b>Functions</b></td><td><b>Percent</b></td></tr>
       <xsl:call-template name="LOOP_NCSS">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>
       </xsl:call-template>

    </table>

    <!-- table with distribution of ccn metric -->
    <table>
       <tr><td><b>CCN</b></td><td><b>Functions</b></td><td><b>Percent</b></td></tr>
       <xsl:call-template name="LOOP_CCN">
          <xsl:with-param name="n">0</xsl:with-param>
          <xsl:with-param name="last">10</xsl:with-param>
       </xsl:call-template>
    </table>

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


<!-- named templates to simplify ...  Use recursion to implement loop  -->

<xsl:template name="ITEM">
   <xsl:param name="x">0</xsl:param>
   <xsl:param name="y">0</xsl:param>
   <xsl:param name="p">0</xsl:param>

   <tr><td><xsl:value-of select="$x"/></td>
   <td><p align="right"><xsl:value-of select="$y"/></p></td>
   <td><p align="right"><xsl:value-of select="format-number($p,'0.00%')"/></p></td>
   <td>
   <xsl:text disable-output-escaping="yes">
        &lt;v:rect style='width:
   </xsl:text>

    <xsl:value-of select="format-number($p*400,'0')"/>
    <xsl:text disable-output-escaping="yes">
        pt;height:8pt'fillcolor="red" &gt;&lt;/v:rect&gt;
    </xsl:text>
   </td>
   </tr>
</xsl:template>


<xsl:template name="LOOP_NCSS">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(javancss/functions/function[ncss >= $step_value_ncss*$n and ncss &lt; $step_value_ncss*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(javancss/functions/function[ncss >= $step_value_ncss*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="x"><xsl:value-of select="$step_value_ncss*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(javancss/functions/function)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP_NCSS">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  

</xsl:template>


<xsl:template name="LOOP_CCN">
    <xsl:param name="n">0</xsl:param>
    <xsl:param name="last">0</xsl:param>

    <xsl:variable name="cnt">
        <xsl:choose>
        <xsl:when test="$n &lt; $last">
            <xsl:value-of select="count(javancss/functions/function[ccn >= $step_value_ccn*$n and ccn &lt; $step_value_ccn*($n+1) ])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="count(javancss/functions/function[ccn >= $step_value_ccn*$n])"/>
        </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>

     <xsl:call-template name="ITEM">
          <xsl:with-param name="x"><xsl:value-of select="$step_value_ccn*$n"/></xsl:with-param>
          <xsl:with-param name="y"><xsl:value-of select="$cnt"/></xsl:with-param>
          <xsl:with-param name="p"><xsl:value-of select="$cnt div count(javancss/functions/function)"/></xsl:with-param>
     </xsl:call-template>

     <xsl:if test="$n &lt; $last">
        <xsl:call-template name="LOOP_CCN">
            <xsl:with-param name="n">
              <xsl:value-of select="$n+1"/>
            </xsl:with-param>
            <xsl:with-param name="last">
              <xsl:value-of select="$last"/>
            </xsl:with-param>
        </xsl:call-template>
     </xsl:if>  
</xsl:template>

</xsl:stylesheet> 
--- NEW FILE: chart_function_package.svg ---
<?xml version="1.0" encoding="utf-8"?>
<svg width="436pt" height="327pt" viewBox="0 0 4360 3270"><rect x="40" y="30" width="4320" height="3240" style="fill:silver;"/><rect x="3" y="3" width="4314" height="3234" style="fill:white; stroke-width:6; stroke:black"/><g style="fill:#FFFFFF; stroke-width:15; stroke:black"><rect x="40" y="40" width="4240" height="3160"/></g><g style="fill:#000080; font-family:Times New Roman;font-style:italic; font-size:180; text-anchor:end;"><text id="Heading" x="4100" y="256">Distribution Functions</text><text x="4100" y="456">per Package</text></g><g transform="translate(190 640) rotate(-90)" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end; "><text>Functions</text></g><g style="fill:#008000; font-family:Arial;font-size:100;"><text id="Notes" x="2535" y="1080">Average Functions = 
       112.20</text><text x="2535" y="1200">Total Packages = 
      20</text><text x="2535" y="1320">Total Functions = 
      2244</text></g><text x="4100" y="3110" style="fill:#008080; font-family:Times New Roman;font-size:100; text-anchor:end;">Packages</text><g style="font-family:Times New Roman;font-size:80; text-anchor:middle;"><text x="464" y="2970"> 0%</text><text x="814" y="2970">10%</text><text x="1164" y="2970">20%</text><text x="1514" y="2970">30%</text><text x="1864" y="2970">40%</text><text x="2214" y="2970">50%</text><text x="2564" y="2970">60%</text><text x="2914" y="2970">70%</text><text x="3264" y="2970">80%</text><text x="3614" y="2970">90%</text><text x="3964" y="2970">100%</text></g><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,2881 z M 814,2842 L 814,2881 z M 1164,2842 L 1164,2881 z M 1514,2842 L 1514,2881 z M 1864,2842 L 1864,2881 z M 2214,2842 L 2214,2881 z M 2564,2842 L 2564,2881 z M 2914,2842 L 2914,2881 z M 3264,2842 L 3264,2881 z M 3614,2842 L 3614,2881 z M 3964,2842 L 3964,2881 z  M 3964,2842 L 464,2842 z"/><path style="stroke:#000000; stroke-width:6" d="M 464,2842 L 464,300 z"/><path style="stroke:#000000; stroke-width:6" d="M 434,2842 L 463,2842 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2842">0</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2642" width="1750" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2622 L 463,2622 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2622">45</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2422" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2402 L 463,2402 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2402">90</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="2202" width="350" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,2182 L 463,2182 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="2182"
>135</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1982" width="350" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1962 L 463,1962 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1962">180</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1762" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1742 L 463,1742 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1742">225</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1542" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1522 L 463,1522 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1522">270</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1322" width="525" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1302 L 463,1302 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1302">315</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="1102" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,1082 L 463,1082 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="1082">360</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="882" width="175" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,862 L 463,862 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="862">405</text></g><g style="fill:#DBDBED;stroke-width:4; stroke:black"><rect x="464" y="662" width="0" height="176"/></g><path style="stroke:#000000; stroke-width:6" d="M 434,642 L 463,642 z"/><g style="font-family:Times New Roman;font-size:80; text-anchor:end;"><text x="424" y="642">450</text></g><g style="fill:#DBDBED;stroke-width:4
; stroke:black"><rect x="464" y="442" width="0" height="176"/></g></svg>
--- NEW FILE: README.TXT ---
Thanks to Yves Coene <Yves.Coene at spacebel.be>
for these xslt stylesheets to produce svg diagrams out of javancss xml output.
I like them very much.
The svg files in this directory are example files.

Use e.g. batik as an svg viewer to see the content.

Generate your own with your favorite xslt transformer like:
javancss -xml -all -recursively java_source_dir > temp.xml
xslt -in temp.xml -xsl chart_XY.xsl > temp.svg
batik temp.svg

Chr. Clemens Lee, 2002-09-03.



More information about the jsword-svn mailing list