You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jdepend-frames.xsl 21 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  2. xmlns:lxslt="http://xml.apache.org/xslt"
  3. xmlns:redirect="org.apache.xalan.lib.Redirect"
  4. extension-element-prefixes="redirect">
  5. <xsl:output method="html" indent="yes" encoding="US-ASCII"/>
  6. <!--
  7. The Apache Software License, Version 1.1
  8. Copyright (c) 2002-2003 The Apache Software Foundation. All rights
  9. reserved.
  10. Redistribution and use in source and binary forms, with or without
  11. modification, are permitted provided that the following conditions
  12. are met:
  13. 1. Redistributions of source code must retain the above copyright
  14. notice, this list of conditions and the following disclaimer.
  15. 2. Redistributions in binary form must reproduce the above copyright
  16. notice, this list of conditions and the following disclaimer in
  17. the documentation and/or other materials provided with the
  18. distribution.
  19. 3. The end-user documentation included with the redistribution, if
  20. any, must include the following acknowlegement:
  21. "This product includes software developed by the
  22. Apache Software Foundation (http://www.apache.org/)."
  23. Alternately, this acknowlegement may appear in the software itself,
  24. if and wherever such third-party acknowlegements normally appear.
  25. 4. The names "Ant" and "Apache Software
  26. Foundation" must not be used to endorse or promote products derived
  27. from this software without prior written permission. For written
  28. permission, please contact apache@apache.org.
  29. 5. Products derived from this software may not be called "Apache"
  30. nor may "Apache" appear in their names without prior written
  31. permission of the Apache Group.
  32. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  33. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  34. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  35. DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  36. ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  37. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  38. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  39. USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  40. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  41. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  42. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  43. SUCH DAMAGE.
  44. ====================================================================
  45. This software consists of voluntary contributions made by many
  46. individuals on behalf of the Apache Software Foundation. For more
  47. information on the Apache Software Foundation, please see
  48. <http://www.apache.org/>.
  49. -->
  50. <!--
  51. Sample stylesheet to be used with JDepend XML output.
  52. It creates a set of HTML files a la javadoc where you can browse easily
  53. through all packages and classes.
  54. @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a>
  55. -->
  56. <xsl:param name="output.dir" select="'.'"/>
  57. <xsl:template match="JDepend">
  58. <!-- create the index.html -->
  59. <redirect:write file="{$output.dir}/index.html">
  60. <xsl:call-template name="index.html"/>
  61. </redirect:write>
  62. <!-- create the stylesheet.css -->
  63. <redirect:write file="{$output.dir}/stylesheet.css">
  64. <xsl:call-template name="stylesheet.css"/>
  65. </redirect:write>
  66. <!-- create the overview-packages.html at the root -->
  67. <redirect:write file="{$output.dir}/overview-summary.html">
  68. <xsl:apply-templates select="." mode="overview.packages"/>
  69. </redirect:write>
  70. <!-- create the overview-packages.html at the root -->
  71. <redirect:write file="{$output.dir}/overview-packages.html">
  72. <xsl:apply-templates select="." mode="packages.details"/>
  73. </redirect:write>
  74. <!-- create the overview-cycles.html at the root -->
  75. <redirect:write file="{$output.dir}/overview-cycles.html">
  76. <xsl:apply-templates select="." mode="cycles.details"/>
  77. </redirect:write>
  78. <!-- create the overview-cycles.html at the root -->
  79. <redirect:write file="{$output.dir}/overview-explanations.html">
  80. <xsl:apply-templates select="." mode="explanations"/>
  81. </redirect:write>
  82. <!-- create the all-packages.html at the root -->
  83. <redirect:write file="{$output.dir}/all-packages.html">
  84. <xsl:apply-templates select="Packages" mode="all.packages"/>
  85. </redirect:write>
  86. <!-- create the all-cycles.html at the root -->
  87. <redirect:write file="{$output.dir}/all-cycles.html">
  88. <xsl:apply-templates select="Cycles" mode="all.cycles"/>
  89. </redirect:write>
  90. </xsl:template>
  91. <xsl:template name="index.html">
  92. <html>
  93. <head>
  94. <title>JDepend Analysis</title>
  95. </head>
  96. <frameset cols="20%,80%">
  97. <frameset rows="30%,70%">
  98. <frame src="all-packages.html" name="packageListFrame"/>
  99. <frame src="all-cycles.html" name="classListFrame"/>
  100. </frameset>
  101. <frame src="overview-summary.html" name="classFrame"/>
  102. </frameset>
  103. <noframes>
  104. <h2>Frame Alert</h2>
  105. <p>
  106. This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
  107. </p>
  108. </noframes>
  109. </html>
  110. </xsl:template>
  111. <!-- this is the stylesheet css to use for nearly everything -->
  112. <xsl:template name="stylesheet.css">
  113. <style type="text/css">
  114. body {
  115. font:normal 68% verdana,arial,helvetica;
  116. color:#000000;
  117. }
  118. table tr td, tr th {
  119. font-size: 68%;
  120. }
  121. table.details tr th{
  122. font-weight: bold;
  123. text-align:left;
  124. background:#a6caf0;
  125. }
  126. table.details tr td{
  127. background:#eeeee0;
  128. }
  129. p {
  130. line-height:1.5em;
  131. margin-top:0.5em; margin-bottom:1.0em;
  132. margin-left:2em;
  133. margin-right:2em;
  134. }
  135. h1 {
  136. margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
  137. }
  138. h2 {
  139. margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
  140. }
  141. h3 {
  142. margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
  143. }
  144. h4 {
  145. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  146. }
  147. h5 {
  148. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  149. }
  150. h6 {
  151. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  152. }
  153. .Error {
  154. font-weight:bold; color:red;
  155. }
  156. .Failure {
  157. font-weight:bold; color:purple;
  158. }
  159. .Properties {
  160. text-align:right;
  161. }
  162. </style>
  163. </xsl:template>
  164. <xsl:template match="JDepend" mode="overview.packages">
  165. <html>
  166. <head>
  167. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  168. </head>
  169. <body>
  170. <xsl:call-template name="pageHeader"/>
  171. <table width="100%"><tr align="left"><h2>Summary</h2><td>
  172. </td><td align="right">
  173. [summary]
  174. [<a href="overview-packages.html">packages</a>]
  175. [<a href="overview-cycles.html">cycles</a>]
  176. [<a href="overview-explanations.html">explanations</a>]
  177. </td></tr></table>
  178. <table width="100%" class="details">
  179. <tr>
  180. <th>Package</th>
  181. <th>Total Classes</th>
  182. <th><a href="overview-explanations.html#EXnumber">Abstract Classes</a></th>
  183. <th><a href="overview-explanations.html#EXnumber">Concrete Classes</a></th>
  184. <th><a href="overview-explanations.html#EXafferent">Afferent Couplings</a></th>
  185. <th><a href="overview-explanations.html#EXefferent">Efferent Couplings</a></th>
  186. <th><a href="overview-explanations.html#EXabstractness">Abstractness</a></th>
  187. <th><a href="overview-explanations.html#EXinstability">Instability</a></th>
  188. <th><a href="overview-explanations.html#EXdistance">Distance</a></th>
  189. </tr>
  190. <xsl:for-each select="./Packages/Package">
  191. <xsl:if test="count(error) = 0">
  192. <tr>
  193. <td align="left">
  194. <a>
  195. <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="@name"/>
  196. </xsl:attribute>
  197. <xsl:value-of select="@name"/>
  198. </a>
  199. </td>
  200. <td align="right"><xsl:value-of select="Stats/TotalClasses"/></td>
  201. <td align="right"><xsl:value-of select="Stats/AbstractClasses"/></td>
  202. <td align="right"><xsl:value-of select="Stats/ConcreteClasses"/></td>
  203. <td align="right"><xsl:value-of select="Stats/Ca"/></td>
  204. <td align="right"><xsl:value-of select="Stats/Ce"/></td>
  205. <td align="right"><xsl:value-of select="Stats/A"/></td>
  206. <td align="right"><xsl:value-of select="Stats/I"/></td>
  207. <td align="right"><xsl:value-of select="Stats/D"/></td>
  208. </tr>
  209. </xsl:if>
  210. </xsl:for-each>
  211. <xsl:for-each select="./Packages/Package">
  212. <xsl:if test="count(error) &gt; 0">
  213. <tr>
  214. <td align="left">
  215. <xsl:value-of select="@name"/>
  216. </td>
  217. <td align="left" colspan="8"><xsl:value-of select="error"/></td>
  218. </tr>
  219. </xsl:if>
  220. </xsl:for-each>
  221. </table>
  222. </body>
  223. </html>
  224. </xsl:template>
  225. <xsl:template match="JDepend" mode="packages.details">
  226. <html>
  227. <head>
  228. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  229. </head>
  230. <body>
  231. <xsl:call-template name="pageHeader"/>
  232. <table width="100%"><tr align="left"><h2>Packages</h2><td>
  233. </td><td align="right">
  234. [<a href="overview-summary.html">summary</a>]
  235. [packages]
  236. [<a href="overview-cycles.html">cycles</a>]
  237. [<a href="overview-explanations.html">explanations</a>]
  238. </td></tr></table>
  239. <xsl:for-each select="./Packages/Package">
  240. <xsl:if test="count(error) = 0">
  241. <h3><a><xsl:attribute name="name">PK<xsl:value-of select="@name"/></xsl:attribute>
  242. <xsl:value-of select="@name"/></a></h3>
  243. <table width="100%"><tr>
  244. <td><a href="overview-explanations.html#EXafferent">Afferent Couplings</a>: <xsl:value-of select="Stats/Ca"/></td>
  245. <td><a href="overview-explanations.html#EXefferent">Efferent Couplings</a>: <xsl:value-of select="Stats/Ce"/></td>
  246. <td><a href="overview-explanations.html#EXabstractness">Abstractness</a>: <xsl:value-of select="Stats/A"/></td>
  247. <td><a href="overview-explanations.html#EXinstability">Instability</a>: <xsl:value-of select="Stats/I"/></td>
  248. <td><a href="overview-explanations.html#EXdistance">Distance</a>: <xsl:value-of select="Stats/D"/></td>
  249. </tr></table>
  250. <table width="100%" class="details">
  251. <tr>
  252. <th>Abstract Classes</th>
  253. <th>Concrete Classes</th>
  254. <th>Used by Packages</th>
  255. <th>Uses Packages</th>
  256. </tr>
  257. <tr>
  258. <td valign="top" width="25%">
  259. <xsl:if test="count(AbstractClasses/Class)=0">
  260. <i>None</i>
  261. </xsl:if>
  262. <xsl:for-each select="AbstractClasses/Class">
  263. <xsl:value-of select="node()"/><br/>
  264. </xsl:for-each>
  265. </td>
  266. <td valign="top" width="25%">
  267. <xsl:if test="count(ConcreteClasses/Class)=0">
  268. <i>None</i>
  269. </xsl:if>
  270. <xsl:for-each select="ConcreteClasses/Class">
  271. <xsl:value-of select="node()"/><br/>
  272. </xsl:for-each>
  273. </td>
  274. <td valign="top" width="25%">
  275. <xsl:if test="count(UsedBy/Package)=0">
  276. <i>None</i>
  277. </xsl:if>
  278. <xsl:for-each select="UsedBy/Package">
  279. <a>
  280. <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="node()"/></xsl:attribute>
  281. <xsl:value-of select="node()"/>
  282. </a><br/>
  283. </xsl:for-each>
  284. </td>
  285. <td valign="top" width="25%">
  286. <xsl:if test="count(DependsUpon/Package)=0">
  287. <i>None</i>
  288. </xsl:if>
  289. <xsl:for-each select="DependsUpon/Package">
  290. <a>
  291. <xsl:attribute name="href">overview-packages.html#PK<xsl:value-of select="node()"/></xsl:attribute>
  292. <xsl:value-of select="node()"/>
  293. </a><br/>
  294. </xsl:for-each>
  295. </td>
  296. </tr>
  297. </table>
  298. </xsl:if>
  299. </xsl:for-each>
  300. <!-- this is often a long listing; provide a lower navigation table also -->
  301. <table width="100%"><tr align="left"><td></td><td align="right">
  302. [<a href="overview-summary.html">summary</a>]
  303. [packages]
  304. [<a href="overview-cycles.html">cycles</a>]
  305. [<a href="overview-explanations.html">explanations</a>]
  306. </td></tr></table>
  307. </body>
  308. </html>
  309. </xsl:template>
  310. <xsl:template match="JDepend" mode="cycles.details">
  311. <html>
  312. <head>
  313. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  314. </head>
  315. <body>
  316. <xsl:call-template name="pageHeader"/>
  317. <table width="100%"><tr align="left"><h2>Cycles</h2><td>
  318. </td><td align="right">
  319. [<a href="overview-summary.html">summary</a>]
  320. [<a href="overview-packages.html">packages</a>]
  321. [cycles]
  322. [<a href="overview-explanations.html">explanations</a>]
  323. </td></tr></table>
  324. <!--<table width="100%"><tr><td>
  325. </td><td align="right">
  326. [<a href="#NVsummary">summary</a>]
  327. [<a href="#NVpackages">packages</a>]
  328. [<a href="#NVcycles">cycles</a>]
  329. [<a href="#NVexplanations">explanations</a>]
  330. </td></tr></table> -->
  331. <xsl:if test="count(Cycles/Package) = 0">
  332. <p>There are no cyclic dependancies.</p>
  333. </xsl:if>
  334. <xsl:for-each select="Cycles/Package">
  335. <h3><a><xsl:attribute name="name">#CY<xsl:value-of select="@Name"/></xsl:attribute><xsl:value-of select="@Name"/></a></h3><p>
  336. <xsl:for-each select="Package">
  337. <xsl:value-of select="."/><br/>
  338. </xsl:for-each></p>
  339. </xsl:for-each>
  340. <!-- this is often a long listing; provide a lower navigation table also -->
  341. <table width="100%"><tr align="left"><td></td><td align="right">
  342. [<a href="overview-summary.html">summary</a>]
  343. [<a href="overview-packages.html">packages</a>]
  344. [cycles]
  345. [<a href="overview-explanations.html">explanations</a>]
  346. </td></tr></table>
  347. </body>
  348. </html>
  349. </xsl:template>
  350. <xsl:template match="JDepend" mode="explanations">
  351. <html>
  352. <head>
  353. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  354. </head>
  355. <body>
  356. <xsl:call-template name="pageHeader"/>
  357. <table width="100%"><tr align="left"><h2>Explanations</h2><td>
  358. </td><td align="right">
  359. [<a href="overview-summary.html">summary</a>]
  360. [<a href="overview-packages.html">packages</a>]
  361. [<a href="overview-cycles.html">cycles</a>]
  362. [explanations]
  363. </td></tr></table>
  364. <p>The following explanations are for quick reference and are lifted directly from the original <a href="http://www.clarkware.com/software/JDepend.html">JDepend documentation</a>.</p>
  365. <h3><a name="EXnumber">Number of Classes</a></h3>
  366. <p>The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.</p>
  367. <h3><a name="EXafferent">Afferent Couplings</a></h3>
  368. <p>The number of other packages that depend upon classes within the package is an indicator of the package's responsibility. </p>
  369. <h3><a name="EXefferent">Efferent Couplings</a></h3>
  370. <p>The number of other packages that the classes in the package depend upon is an indicator of the package's independence. </p>
  371. <h3><a name="EXabstractness">Abstractness</a></h3>
  372. <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>
  373. <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. </p>
  374. <h3><a name="EXinstability">Instability</a></h3>
  375. <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>
  376. <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. </p>
  377. <h3><a name="EXdistance">Distance</a></h3>
  378. <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>
  379. <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>
  380. <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. </p>
  381. </body>
  382. </html>
  383. </xsl:template>
  384. <!--
  385. Creates an html file that contains a link to all package links in overview-packages.html.
  386. @bug there will be a problem here, I don't know yet how to handle unnamed package :(
  387. -->
  388. <xsl:template match="JDepend/Packages" mode="all.packages">
  389. <html>
  390. <head>
  391. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  392. </head>
  393. <body>
  394. <table width="100%"><tr align="left"><td></td><td nowrap="nowrap" align="right">
  395. [<a href="overview-summary.html" target="classFrame">summary</a>]
  396. [<a href="overview-packages.html" target="classFrame">packages</a>]
  397. [<a href="overview-cycles.html" target="classFrame">cycles</a>]
  398. [<a href="overview-explanations.html" target="classFrame">explanations</a>]
  399. </td></tr></table>
  400. <h2>Packages</h2>
  401. <table width="100%">
  402. <xsl:apply-templates select="Package[count(error)=0]" mode="all.packages.link">
  403. <xsl:sort select="@name"/>
  404. </xsl:apply-templates>
  405. <xsl:apply-templates select="Package[count(error) &gt; 0]" mode="all.packages.nolink">
  406. <xsl:sort select="@name"/>
  407. </xsl:apply-templates>
  408. </table>
  409. </body>
  410. </html>
  411. </xsl:template>
  412. <xsl:template match="JDepend/Packages/Package" mode="all.packages.link">
  413. <tr>
  414. <td nowrap="nowrap">
  415. <a href="overview-packages.html#PK{@name}" target="classFrame">
  416. <xsl:value-of select="@name"/>
  417. </a>
  418. </td>
  419. </tr>
  420. </xsl:template>
  421. <!--
  422. I do not know JDepend enough to know if every error results in a non-analyzed package,
  423. but that is how I am presenting it to the viewer. This may need to change.
  424. @bug there will be a problem here, I don't know yet how to handle unnamed package :(
  425. -->
  426. <xsl:template match="JDepend/Packages/Package" mode="all.packages.nolink">
  427. <tr>
  428. <td nowrap="nowrap">
  429. Not Analyzed: <xsl:value-of select="@name"/>
  430. </td>
  431. </tr>
  432. </xsl:template>
  433. <!--
  434. Creates an html file that contains a link to all package links in overview-cycles.html.
  435. @bug there will be a problem here, I don't know yet how to handle unnamed package :(
  436. -->
  437. <xsl:template match="JDepend/Cycles" mode="all.cycles">
  438. <html>
  439. <head>
  440. <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
  441. </head>
  442. <body>
  443. <table width="100%"><tr align="left"><td></td><td nowrap="nowrap" align="right">
  444. [<a href="overview-summary.html" target="classFrame">summary</a>]
  445. [<a href="overview-packages.html" target="classFrame">packages</a>]
  446. [<a href="overview-cycles.html" target="classFrame">cycles</a>]
  447. [<a href="overview-explanations.html" target="classFrame">explanations</a>]
  448. </td></tr></table>
  449. <h2>Cycles</h2>
  450. <table width="100%">
  451. <xsl:apply-templates select="Package" mode="all.cycles">
  452. <xsl:sort select="@Name"/>
  453. </xsl:apply-templates>
  454. </table>
  455. </body>
  456. </html>
  457. </xsl:template>
  458. <xsl:template match="JDepend/Cycles/Package" mode="all.cycles">
  459. <tr>
  460. <td nowrap="nowrap">
  461. <a href="overview-cycles.html#CY{@Name}" target="classFrame"><xsl:value-of select="@Name"/></a>
  462. </td>
  463. </tr>
  464. </xsl:template>
  465. <!-- Page HEADER -->
  466. <xsl:template name="pageHeader">
  467. <h1>JDepend Analysis</h1>
  468. <table width="100%">
  469. <tr>
  470. <td align="left"></td>
  471. <td align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="http://jakarta.apache.org">Ant</a>.</td>
  472. </tr>
  473. </table>
  474. <hr size="1"/>
  475. </xsl:template>
  476. </xsl:stylesheet>