forked from phoedos/pmd
Fix cpd xslt sample templates
This commit is contained in:
parent
33f9268cf7
commit
40bd882f3e
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="https://pmd-code.org/schema/cpd-report">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:cpd="https://pmd-code.org/schema/cpd-report"
|
||||||
|
exclude-result-prefixes="cpd">
|
||||||
<!--
|
<!--
|
||||||
PMD CPD (Copy and Paste Detector) XML to HTML transformer
|
PMD CPD (Copy and Paste Detector) XML to HTML transformer
|
||||||
-->
|
-->
|
||||||
@ -68,10 +70,10 @@
|
|||||||
<th>Approximate number of bytes</th>
|
<th>Approximate number of bytes</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="count(//duplication)"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="count(//cpd:duplication)"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication/@lines)"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication/@lines)"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication/@tokens)"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication/@tokens)"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication/@tokens) * 4"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication/@tokens) * 4"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -91,7 +93,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<xsl:apply-templates select="pmd-cpd/duplication" />
|
<xsl:apply-templates select="cpd:pmd-cpd/cpd:duplication" />
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -133,7 +135,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- templates -->
|
<!-- templates -->
|
||||||
<xsl:template match="pmd-cpd/duplication">
|
<xsl:template match="cpd:pmd-cpd/cpd:duplication">
|
||||||
<xsl:for-each select=".">
|
<xsl:for-each select=".">
|
||||||
<tr>
|
<tr>
|
||||||
<td><xsl:value-of select="@lines"/></td>
|
<td><xsl:value-of select="@lines"/></td>
|
||||||
@ -141,7 +143,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<table class="table table-light table-bordered table-striped table-hover">
|
<table class="table table-light table-bordered table-striped table-hover">
|
||||||
<tr><th>column</th><th>endcolumn</th><th>line</th><th>endline</th><th>path</th></tr>
|
<tr><th>column</th><th>endcolumn</th><th>line</th><th>endline</th><th>path</th></tr>
|
||||||
<xsl:for-each select="file">
|
<xsl:for-each select="cpd:file">
|
||||||
<tr>
|
<tr>
|
||||||
<td><xsl:value-of select="@column"/></td>
|
<td><xsl:value-of select="@column"/></td>
|
||||||
<td><xsl:value-of select="@endcolumn"/></td>
|
<td><xsl:value-of select="@endcolumn"/></td>
|
||||||
@ -152,7 +154,7 @@
|
|||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td><pre><xsl:value-of select="codefragment"/></pre></td>
|
<td><pre><xsl:value-of select="cpd:codefragment"/></pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Stylesheet to turn the XML output of CPD into a nice-looking HTML page -->
|
<!-- Stylesheet to turn the XML output of CPD into a nice-looking HTML page -->
|
||||||
<!-- $Id$ -->
|
<!-- $Id$ -->
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="https://pmd-code.org/schema/cpd-report" version="2.0">
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:cpd="https://pmd-code.org/schema/cpd-report"
|
||||||
|
exclude-result-prefixes="cpd" version="2.0">
|
||||||
<xsl:output method="html" encoding="utf-8" doctype-system="about:legacy-compat"/>
|
<xsl:output method="html" encoding="utf-8" doctype-system="about:legacy-compat"/>
|
||||||
<xsl:param name="lines" required="yes">30</xsl:param>
|
<xsl:param name="lines" required="yes">30</xsl:param>
|
||||||
|
|
||||||
<xsl:template match="pmd-cpd">
|
<xsl:template match="cpd:pmd-cpd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
@ -46,10 +48,10 @@
|
|||||||
<th>Approx # bytes</th>
|
<th>Approx # bytes</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="count(//duplication[@lines>$lines])"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="count(//cpd:duplication[@lines>$lines])"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>$lines]/@lines)"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication[@lines>$lines]/@lines)"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>$lines]/@tokens)"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication[@lines>$lines]/@tokens)"/></td>
|
||||||
<td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>$lines]/@tokens) * 4"/></td>
|
<td class="SummaryNumber"><xsl:value-of select="sum(//cpd:duplication[@lines>$lines]/@tokens) * 4"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p/>
|
<p/>
|
||||||
@ -58,13 +60,13 @@
|
|||||||
<p/>
|
<p/>
|
||||||
<table>
|
<table>
|
||||||
<tr style="background-color: #444444; color: #DDDDDD;"><td>ID</td><td>Files</td><td>Lines</td></tr>
|
<tr style="background-color: #444444; color: #DDDDDD;"><td>ID</td><td>Files</td><td>Lines</td></tr>
|
||||||
<xsl:for-each select="//duplication[@lines>$lines]">
|
<xsl:for-each select="//cpd:duplication[@lines>$lines]">
|
||||||
<xsl:sort data-type="number" order="descending" select="@lines"/>
|
<xsl:sort data-type="number" order="descending" select="@lines"/>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ItemNumber"><xsl:value-of select="position()"/></td>
|
<td class="ItemNumber"><xsl:value-of select="position()"/></td>
|
||||||
<td>
|
<td>
|
||||||
<table>
|
<table>
|
||||||
<xsl:for-each select="file">
|
<xsl:for-each select="cpd:file">
|
||||||
<tr><td><a><xsl:attribute name="href">../src/<xsl:value-of select="@path"/>.html#<xsl:value-of select="@line"/></xsl:attribute><xsl:value-of select="@path"/></a></td><td> line <xsl:value-of select="@line"/></td></tr>
|
<tr><td><a><xsl:attribute name="href">../src/<xsl:value-of select="@path"/>.html#<xsl:value-of select="@line"/></xsl:attribute><xsl:value-of select="@path"/></a></td><td> line <xsl:value-of select="@line"/></td></tr>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</table>
|
</table>
|
||||||
@ -82,7 +84,7 @@
|
|||||||
<textarea cols="100" wrap="off" class='CodeFragment' style='display:none;'>
|
<textarea cols="100" wrap="off" class='CodeFragment' style='display:none;'>
|
||||||
<xsl:attribute name="rows"><xsl:value-of select="$lines"/></xsl:attribute>
|
<xsl:attribute name="rows"><xsl:value-of select="$lines"/></xsl:attribute>
|
||||||
<xsl:attribute name="id">frag_<xsl:value-of select="position()"/></xsl:attribute>
|
<xsl:attribute name="id">frag_<xsl:value-of select="position()"/></xsl:attribute>
|
||||||
<xsl:value-of select="codefragment"/>
|
<xsl:value-of select="cpd:codefragment"/>
|
||||||
</textarea>
|
</textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<pmd-cpd>
|
<pmd-cpd xmlns="https://pmd-code.org/schema/cpd-report"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
pmdVersion="7.3.0"
|
||||||
|
timestamp="2024-06-23T09:00:00+02:00"
|
||||||
|
version="1.0.0"
|
||||||
|
xsi:schemaLocation="https://pmd-code.org/schema/cpd-report https://pmd.github.io/schema/cpd-report_1_0_0.xsd">
|
||||||
<duplication lines="60" tokens="75">
|
<duplication lines="60" tokens="75">
|
||||||
<file column="2" endcolumn="3" endline="6" line="1" path="/var/Foo.java"/>
|
<file column="2" endcolumn="3" endline="6" line="1" begintoken="0" endtoken="1" path="/var/Foo.java"/>
|
||||||
<file column="4" endcolumn="5" endline="78" line="73" path="/var/Foo.java"/>
|
<file column="4" endcolumn="5" endline="78" line="73" begintoken="0" endtoken="1" path="/var/Foo.java"/>
|
||||||
<codefragment><![CDATA[code
|
<codefragment><![CDATA[code
|
||||||
fragment]]></codefragment>
|
fragment]]></codefragment>
|
||||||
</duplication>
|
</duplication>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user