Skip to content

Commit a930dc7

Browse files
authored
Merge pull request #2055 from Xeicker/update_html_report
Update html report with oval details
2 parents 826eeb7 + 22e0b72 commit a930dc7

File tree

1 file changed

+59
-5
lines changed

1 file changed

+59
-5
lines changed

xsl/xccdf-report-oval-details.xsl

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,21 @@ Authors:
9999
<table class="table table-striped table-bordered">
100100
<!-- table head (possibly item-type-specific) -->
101101
<thead>
102-
<xsl:apply-templates mode='item-head' select='key("oval-items", $items[1]/@item_id)'/>
102+
<xsl:apply-templates mode='item-head' select='key("oval-items", $items[1]/@item_id)'>
103+
<xsl:with-param name='resultColumn' select='"true"'/>
104+
</xsl:apply-templates>
103105
</thead>
104106

105107
<!-- table body (possibly item-type-specific) -->
106108
<!-- limited to 100 lines -->
107109
<tbody>
108110
<xsl:for-each select='$items'>
109111
<xsl:if test="not(position() > 100)">
112+
<xsl:variable name="currentResult" select="@result" />
110113
<xsl:for-each select='key("oval-items", @item_id)'>
111-
<xsl:apply-templates select='.' mode='item-body'/>
114+
<xsl:apply-templates select='.' mode='item-body'>
115+
<xsl:with-param name="result" select="$currentResult"/>
116+
</xsl:apply-templates>
112117
</xsl:for-each>
113118
</xsl:if>
114119
</xsl:for-each>
@@ -217,7 +222,9 @@ Authors:
217222
<!-- generic item visualisation -->
218223

219224
<xsl:template mode='item-head' match='*'>
225+
<xsl:param name="resultColumn" select="false"/>
220226
<tr>
227+
<xsl:if test='$resultColumn="true"'><th>Result of item-state comparison</th></xsl:if>
221228
<xsl:for-each select='*'>
222229
<xsl:variable name='label' select='translate(local-name(), "_", " ")'/>
223230
<xsl:variable name='first_letter' select='translate(substring($label,1,1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")'/>
@@ -228,7 +235,22 @@ Authors:
228235
</xsl:template>
229236

230237
<xsl:template mode='item-body' match='*'>
238+
<xsl:param name="result"/>
231239
<tr>
240+
<td>
241+
<xsl:choose>
242+
<xsl:when test="$result='true'">
243+
<span class="label label-success">
244+
<xsl:value-of select="$result"/>
245+
</span>
246+
</xsl:when>
247+
<xsl:otherwise>
248+
<span class="label label-danger">
249+
<xsl:value-of select="$result"/>
250+
</span>
251+
</xsl:otherwise>
252+
</xsl:choose>
253+
</td>
232254
<xsl:for-each select='*'>
233255
<td>
234256
<xsl:if test='@datatype="int" or @datatype="boolean"'><xsl:attribute name='role'>num</xsl:attribute></xsl:if>
@@ -241,12 +263,27 @@ Authors:
241263
<!-- UNIX file item visualisation -->
242264

243265
<xsl:template mode='item-head' match='ovalunixsc:file_item'>
244-
<tr><th>Path</th><th>Type</th><th>UID</th><th>GID</th><th>Size (B)</th><th>Permissions</th></tr>
266+
<tr><th>Result of item-state comparison</th><th>Path</th><th>Type</th><th>UID</th><th>GID</th><th>Size (B)</th><th>Permissions</th></tr>
245267
</xsl:template>
246268

247269
<xsl:template mode='item-body' match='ovalunixsc:file_item'>
270+
<xsl:param name="result"/>
248271
<xsl:variable name='path' select='concat(ovalunixsc:path, "/", ovalunixsc:filename)'/>
249272
<tr>
273+
<td>
274+
<xsl:choose>
275+
<xsl:when test="$result='true'">
276+
<span class="label label-success">
277+
<xsl:value-of select="$result"/>
278+
</span>
279+
</xsl:when>
280+
<xsl:otherwise>
281+
<span class="label label-danger">
282+
<xsl:value-of select="$result"/>
283+
</span>
284+
</xsl:otherwise>
285+
</xsl:choose>
286+
</td>
250287
<td><xsl:value-of select='$path'/></td>
251288
<td><xsl:value-of select='ovalunixsc:type'/></td>
252289
<td><xsl:value-of select='ovalunixsc:user_id'/></td>
@@ -289,12 +326,29 @@ Authors:
289326
<!-- textfilecontent visualisation -->
290327

291328
<xsl:template mode='item-head' match='ovalindsc:textfilecontent_item'>
292-
<tr><th>Path</th><th>Content</th></tr>
329+
<tr><th>Result of item-state comparison</th><th>Path</th><th>Content</th></tr>
293330
</xsl:template>
294331

295332
<xsl:template mode='item-body' match='ovalindsc:textfilecontent_item'>
333+
<xsl:param name="result"/>
296334
<xsl:variable name='path' select='concat(ovalindsc:path, "/", ovalindsc:filename)'/>
297-
<tr><td><xsl:value-of select='$path'/></td><td><xsl:value-of select='ovalindsc:text'/></td></tr>
335+
<tr>
336+
<td>
337+
<xsl:choose>
338+
<xsl:when test="$result='true'">
339+
<span class="label label-success">
340+
<xsl:value-of select="$result"/>
341+
</span>
342+
</xsl:when>
343+
<xsl:otherwise>
344+
<span class="label label-danger">
345+
<xsl:value-of select="$result"/>
346+
</span>
347+
</xsl:otherwise>
348+
</xsl:choose>
349+
</td>
350+
<td><xsl:value-of select='$path'/></td><td><xsl:value-of select='ovalindsc:text'/></td>
351+
</tr>
298352
</xsl:template>
299353

300354
</xsl:stylesheet>

0 commit comments

Comments
 (0)