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

cpd.xslt 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Stylesheet to turn the XML output of CPD into a nice-looking HTML page -->
  3. <!-- $Id: cpdhtml.xslt,v 1.1 2006/08/14 14:09:56 tomcopeland Exp $ -->
  4. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  5. <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
  6. doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>
  7. <xsl:template match="pmd-cpd">
  8. <html>
  9. <head>
  10. <script type="text/javascript">
  11. function toggleCodeSection(btn, id)
  12. {
  13. area = document.getElementById(id);
  14. if (area.style.display == 'none')
  15. {
  16. btn.innerHTML = '-';
  17. area.style.display = 'inline';
  18. }
  19. else
  20. {
  21. btn.innerHTML = '+';
  22. area.style.display = 'none';
  23. }
  24. }
  25. </script>
  26. <style>
  27. .SummaryTitle { }
  28. .SummaryNumber { background-color:#DDDDDD; text-align: center; }
  29. .ItemNumber { background-color: #DDDDDD; }
  30. .CodeFragment { background-color: #BBBBBB; display:none; font:normal normal normal 9pt Courier; }
  31. .ExpandButton { background-color: #FFFFFF; font-size: 8pt; width: 20px; height: 20px; margin:0px; }
  32. </style>
  33. </head>
  34. <body>
  35. <table border="1" class="summary" cellpadding="2">
  36. <tr style="background-color:#CCCCCC;">
  37. <th># duplications</th>
  38. <th>Total lines</th>
  39. <th>Total tokens</th>
  40. </tr>
  41. <tr>
  42. <td class="SummaryNumber"><xsl:value-of select="count(//duplication)"/></td>
  43. <td class="SummaryNumber"><xsl:value-of select="sum(//duplication/@lines)"/></td>
  44. <td class="SummaryNumber"><xsl:value-of select="sum(//duplication/@tokens)"/></td>
  45. </tr>
  46. </table>
  47. <br />
  48. <table>
  49. <tr style="background-color: #444444; color: #DDDDDD;"><td>ID</td><td>Files</td><td>Lines</td></tr>
  50. <xsl:for-each select="//duplication">
  51. <xsl:sort data-type="number" order="descending" select="@lines"/>
  52. <tr>
  53. <td class="ItemNumber"><xsl:value-of select="position()"/></td>
  54. <td>
  55. <table>
  56. <xsl:for-each select="file">
  57. <tr>
  58. <td>
  59. <xsl:value-of select="substring-before(substring-after(translate(@path,'/','.'),'src.'), '.java')"/>
  60. </td>
  61. <td> line <xsl:value-of select="@line"/></td></tr>
  62. </xsl:for-each>
  63. </table>
  64. </td>
  65. <td># lines : <xsl:value-of select="@lines"/></td>
  66. </tr>
  67. <tr>
  68. <td> </td>
  69. <td colspan="2" valign="top">
  70. <table><tr>
  71. <td valign="top">
  72. <button class="ExpandButton" ><xsl:attribute name="onclick">blur(); toggleCodeSection(this, 'frag_<xsl:value-of select="position()"/>')</xsl:attribute>+</button>
  73. </td>
  74. <td>
  75. <textarea readonly="readonly" cols="100" rows="30" wrap="off" class='CodeFragment' style='display:none;' >
  76. <xsl:attribute name="id">frag_<xsl:value-of select="position()"/></xsl:attribute>
  77. <xsl:value-of select="codefragment"/>
  78. </textarea>
  79. </td>
  80. </tr></table>
  81. </td>
  82. </tr>
  83. <tr><td colspan="2"><hr/></td></tr>
  84. </xsl:for-each>
  85. </table>
  86. </body>
  87. </html>
  88. </xsl:template>
  89. </xsl:stylesheet>