Skip to content

Commit 0bc3740

Browse files
committed
Do not show misleading "pass" or "fail" in HTML report
The report showed "pass"/"fail" in section "OVAL details". But in OVAL "pass"/"fail" doesn't exist. Instead, in OVAL we have "true"/"false"/"unknown"/"error"/"not evaluated"/"not applicable". It showed "pass" when the definition was "true" and "fail" elsewhere. Also, it didn't show the results of the tests, but it showed the results of the whole definition at each test - the test results was shown as pass when the whole definition was true even if the specific test wasn't evaluated as true. Also fixes the misleading "because ..." prose, instead shows a header based on the condition we use in XSLT template (whether OVAL items were or were not collected for the given test).
1 parent 3ac047e commit 0bc3740

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed

xsl/xccdf-report-oval-details.xsl

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,31 @@ Authors:
4444

4545
<xsl:template mode='brief' match='ovalres:oval_results'>
4646
<xsl:param name='definition-id' />
47-
<xsl:param name='result'/>
48-
<xsl:apply-templates select='key("oval-definition", $definition-id)' mode='brief'>
49-
<xsl:with-param name='result' select='$result'/>
50-
</xsl:apply-templates>
47+
<xsl:apply-templates select='key("oval-definition", $definition-id)' mode='brief' />
5148
</xsl:template>
5249

5350
<xsl:template mode='brief' match='ovalres:extend_definition'>
54-
<xsl:param name='result'/>
55-
<xsl:apply-templates select='key("oval-definition", @definition_ref)' mode='brief'>
56-
<xsl:with-param name='result' select='$result'/>
57-
</xsl:apply-templates>
51+
<xsl:apply-templates select='key("oval-definition", @definition_ref)' mode='brief' />
5852
</xsl:template>
5953

60-
<xsl:template mode='brief' match='ovalres:definition|ovalres:criteria|ovalres:criterion'>
61-
<xsl:param name='result'/>
54+
<xsl:template mode='brief' match='ovalres:criterion'>
6255
<xsl:apply-templates select='key("oval-test", @test_ref)' mode='brief'>
6356
<xsl:with-param name='title' select='key("oval-testdef", @test_ref)/@comment'/>
64-
<xsl:with-param name='result' select='$result'/>
6557
</xsl:apply-templates>
58+
</xsl:template>
59+
60+
<xsl:template mode='brief' match='ovalres:criteria'>
6661
<!-- descend deeper into the logic formula -->
67-
<xsl:apply-templates mode='brief'>
68-
<xsl:with-param name='result' select='$result'/>
69-
</xsl:apply-templates>
62+
<xsl:apply-templates mode='brief' />
63+
</xsl:template>
64+
65+
<xsl:template mode='brief' match='ovalres:definition'>
66+
<xsl:apply-templates mode='brief' select="ovalres:criteria" />
7067
</xsl:template>
7168

7269
<!-- OVAL items dump -->
7370
<xsl:template mode='brief' match='ovalres:test'>
7471
<xsl:param name='title'/>
75-
<xsl:param name='result'/>
7672
<xsl:variable name='items' select='ovalres:tested_item'/>
7773
<xsl:choose>
7874
<!-- if there are items to display, go ahead -->
@@ -85,10 +81,19 @@ Authors:
8581
</xsl:choose>
8682
</span><!-- #160 is nbsp -->&#160;
8783
<xsl:choose>
88-
<xsl:when test='$result="pass"'><span class="label label-success">passed</span> because of these items:</xsl:when>
89-
<xsl:otherwise><span class="label label-danger">failed</span> because of these items:</xsl:otherwise>
84+
<xsl:when test="@result='true'">
85+
<span class="label label-success">
86+
<xsl:value-of select="@result"/>
87+
</span>
88+
</xsl:when>
89+
<xsl:otherwise>
90+
<span class="label label-danger">
91+
<xsl:value-of select="@result"/>
92+
</span>
93+
</xsl:otherwise>
9094
</xsl:choose>
9195
</h4>
96+
<h5>Following items have been found on the system:</h5>
9297

9398
<table class="table table-striped table-bordered">
9499
<!-- table head (possibly item-type-specific) -->
@@ -124,10 +129,19 @@ Authors:
124129
<h4>
125130
<span class="label label-primary"><xsl:value-of select="$title"/></span><!-- #160 is nbsp -->&#160;
126131
<xsl:choose>
127-
<xsl:when test='$result="pass"'><span class="label label-success">passed</span> because these items were not found:</xsl:when>
128-
<xsl:otherwise><span class="label label-danger">failed</span> because these items were missing:</xsl:otherwise>
132+
<xsl:when test="@result='true'">
133+
<span class="label label-success">
134+
<xsl:value-of select="@result"/>
135+
</span>
136+
</xsl:when>
137+
<xsl:otherwise>
138+
<span class="label label-danger">
139+
<xsl:value-of select="@result"/>
140+
</span>
141+
</xsl:otherwise>
129142
</xsl:choose>
130143
</h4>
144+
<h5>No items have been found conforming to the following objects:</h5>
131145
<h5>Object <strong><abbr>
132146
<xsl:if test='$comment'>
133147
<xsl:attribute name='title'>

0 commit comments

Comments
 (0)