Skip to content

Commit 9e53b26

Browse files
authored
Merge pull request #1350 from jan-cerny/html2
OVAL details in HTML report improvements
2 parents 6f3972d + 6745c5c commit 9e53b26

File tree

3 files changed

+40
-54
lines changed

3 files changed

+40
-54
lines changed

tests/bz2/test_bz2_datastream.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ $OSCAP xccdf generate report --output $report "${arf}.bz2" 2> $stderr
6666
[ -f $report ]
6767
bash $builddir/run ./test_bz2_memory_source "${arf}.bz2" | grep 'ARF Result Datastream'
6868

69-
grep 'OVAL details' $report
69+
grep 'OVAL test results details' $report
7070
rm $stderr
7171
rm -rf $dir

xsl/xccdf-report-impl.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ Authors:
635635
<xsl:otherwise>arf:report with id='<xsl:value-of select="$arf_results/parent::arf:content/parent::arf:report/@id"/>'</xsl:otherwise>
636636
</xsl:choose>
637637
</xsl:variable>
638-
<span class="label label-default"><abbr title="OVAL details taken from {$details_origin}">OVAL details</abbr></span>
638+
<span class="label label-default"><abbr title="OVAL details taken from {$details_origin}">OVAL test results details</abbr></span>
639639
<div class="panel panel-default">
640640
<div class="panel-body">
641641
<xsl:copy-of select="$details"/>

xsl/xccdf-report-oval-details.xsl

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -44,44 +44,58 @@ 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' />
48+
</xsl:template>
49+
50+
<xsl:template mode='brief' match='ovalres:extend_definition'>
51+
<xsl:apply-templates select='key("oval-definition", @definition_ref)' mode='brief' />
5152
</xsl:template>
5253

53-
<xsl:template mode='brief' match='ovalres:definition|ovalres:criteria|ovalres:criterion|ovalres:extend_definition'>
54-
<xsl:param name='result'/>
54+
<xsl:template mode='brief' match='ovalres:criterion'>
5555
<xsl:apply-templates select='key("oval-test", @test_ref)' mode='brief'>
5656
<xsl:with-param name='title' select='key("oval-testdef", @test_ref)/@comment'/>
57-
<xsl:with-param name='result' select='$result'/>
5857
</xsl:apply-templates>
58+
</xsl:template>
59+
60+
<xsl:template mode='brief' match='ovalres:criteria'>
5961
<!-- descend deeper into the logic formula -->
60-
<xsl:apply-templates mode='brief'>
61-
<xsl:with-param name='result' select='$result'/>
62-
</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" />
6367
</xsl:template>
6468

6569
<!-- OVAL items dump -->
6670
<xsl:template mode='brief' match='ovalres:test'>
6771
<xsl:param name='title'/>
68-
<xsl:param name='result'/>
6972
<xsl:variable name='items' select='ovalres:tested_item'/>
73+
<h4>
74+
<xsl:if test='$title'>
75+
<span class="label label-primary">
76+
<xsl:value-of select='$title'/>
77+
</span><!-- #160 is nbsp -->&#160;
78+
</xsl:if>
79+
<span class="label label-default">
80+
<xsl:value-of select='@test_id'/>
81+
</span><!-- #160 is nbsp -->&#160;
82+
<xsl:choose>
83+
<xsl:when test="@result='true'">
84+
<span class="label label-success">
85+
<xsl:value-of select="@result"/>
86+
</span>
87+
</xsl:when>
88+
<xsl:otherwise>
89+
<span class="label label-danger">
90+
<xsl:value-of select="@result"/>
91+
</span>
92+
</xsl:otherwise>
93+
</xsl:choose>
94+
</h4>
7095
<xsl:choose>
7196
<!-- if there are items to display, go ahead -->
7297
<xsl:when test='$items'>
73-
<h4>
74-
<span class="label label-primary">
75-
<xsl:choose>
76-
<xsl:when test='$title'><xsl:value-of select='$title'/></xsl:when>
77-
<xsl:otherwise>OVAL test <xsl:value-of select='@test_id'/></xsl:otherwise>
78-
</xsl:choose>
79-
</span><!-- #160 is nbsp -->&#160;
80-
<xsl:choose>
81-
<xsl:when test='$result="pass"'><span class="label label-success">passed</span> because of these items:</xsl:when>
82-
<xsl:otherwise><span class="label label-danger">failed</span> because of these items:</xsl:otherwise>
83-
</xsl:choose>
84-
</h4>
98+
<h5>Following items have been found on the system:</h5>
8599

86100
<table class="table table-striped table-bordered">
87101
<!-- table head (possibly item-type-specific) -->
@@ -111,16 +125,9 @@ Authors:
111125
<xsl:variable name='object_id' select='key("oval-testdef", @test_id)/*[local-name()="object"]/@object_ref'/>
112126
<xsl:variable name='object_info' select='key("oval-objectdef",$object_id)'/>
113127
<xsl:variable name='state_id' select='key("oval-testdef", @test_id)/*[local-name()="state"]/@state_ref'/>
114-
<xsl:variable name='state_info' select='key("oval-statedef",$state_id)'/>
115128
<xsl:variable name='comment' select='$object_info[1]/@comment'/>
116129
<xsl:if test="$object_info">
117-
<h4>
118-
<span class="label label-primary"><xsl:value-of select="$title"/></span><!-- #160 is nbsp -->&#160;
119-
<xsl:choose>
120-
<xsl:when test='$result="pass"'><span class="label label-success">passed</span> because these items were not found:</xsl:when>
121-
<xsl:otherwise><span class="label label-danger">failed</span> because these items were missing:</xsl:otherwise>
122-
</xsl:choose>
123-
</h4>
130+
<h5>No items have been found conforming to the following objects:</h5>
124131
<h5>Object <strong><abbr>
125132
<xsl:if test='$comment'>
126133
<xsl:attribute name='title'>
@@ -155,27 +162,6 @@ Authors:
155162
</tr>
156163
</tbody>
157164
</table>
158-
<xsl:if test="$state_info">
159-
<h5>State <strong><xsl:value-of select='$state_id'/></strong> of type
160-
<strong><xsl:value-of select='local-name($state_info)'/></strong></h5>
161-
<table class="table table-striped table-bordered">
162-
<thead>
163-
<xsl:apply-templates mode='item-head' select='$state_info[1]'/>
164-
</thead>
165-
<tbody>
166-
<tr>
167-
<xsl:variable name='variable_id' select='$state_info/*/@var_ref'/>
168-
<xsl:if test='$variable_id'>
169-
<td>
170-
<xsl:apply-templates mode='normal' select='ovalres:tested_variable'/>
171-
<xsl:apply-templates mode='message' select='key("ovalsys-object",$object_id)'/>
172-
</td>
173-
</xsl:if>
174-
<xsl:apply-templates mode='state' select='$state_info[1]'/>
175-
</tr>
176-
</tbody>
177-
</table>
178-
</xsl:if>
179165
</xsl:if>
180166
</xsl:otherwise>
181167
</xsl:choose>

0 commit comments

Comments
 (0)