Skip to content

Commit 8bc18a7

Browse files
authored
Merge pull request #2265 from Arden97/inverted_report_fields
Fixing inverted fields in HTML report
2 parents a02d3d1 + 6621a6c commit 8bc18a7

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

xsl/xccdf-report-oval-details.xsl

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,10 @@ Authors:
146146
</thead>
147147
<tbody>
148148
<tr>
149-
<xsl:variable name='variable_id' select='$object_info/*/@var_ref'/>
150-
<xsl:if test='$variable_id'>
151-
<td>
152-
<xsl:choose>
153-
<xsl:when test='count(ovalres:tested_variable)>1'>
154-
<table>
155-
<xsl:apply-templates mode='tableintable' select='ovalres:tested_variable'/>
156-
</table>
157-
</xsl:when>
158-
<xsl:when test='count(ovalres:tested_variable)=1'>
159-
<xsl:apply-templates mode='normal' select='ovalres:tested_variable'/>
160-
</xsl:when>
161-
</xsl:choose>
162-
<xsl:apply-templates mode='message' select='key("ovalsys-object",$object_id)'/>
163-
</td>
164-
</xsl:if>
165-
<xsl:apply-templates mode='object' select='$object_info[1]'/>
149+
<xsl:apply-templates mode='object' select='$object_info[1]'>
150+
<xsl:with-param name="tested_var" select="ovalres:tested_variable"/>
151+
<xsl:with-param name="object_id" select="$object_id"/>
152+
</xsl:apply-templates>
166153
</tr>
167154
</tbody>
168155
</table>
@@ -188,13 +175,32 @@ Authors:
188175
</xsl:template>
189176

190177
<xsl:template mode='object' match='*[starts-with(namespace-uri(), "http://oval.mitre.org/XMLSchema/oval-definitions") and contains(local-name(), "_object")]'>
178+
<xsl:param name="tested_var"/>
179+
<xsl:param name="object_id"/>
180+
191181
<xsl:for-each select='*'>
192-
<xsl:if test='not(*) and not(normalize-space()) and not(@var_ref)'><td>no value</td></xsl:if>
193-
<xsl:if test='* or normalize-space()'>
194-
<td>
195-
<xsl:value-of select='.'/>
196-
</td>
197-
</xsl:if>
182+
<td>
183+
<xsl:choose>
184+
<xsl:when test="@var_ref">
185+
<xsl:variable name="matching_var" select="$tested_var[@variable_id = current()/@var_ref]"/>
186+
<xsl:choose>
187+
<xsl:when test="count($matching_var) > 1">
188+
<table>
189+
<xsl:apply-templates mode='tableintable' select="$matching_var"/>
190+
</table>
191+
</xsl:when>
192+
<xsl:otherwise>
193+
<xsl:apply-templates mode='normal' select="$matching_var"/>
194+
</xsl:otherwise>
195+
</xsl:choose>
196+
<xsl:apply-templates mode='message' select='key("ovalsys-object", $object_id)'/>
197+
</xsl:when>
198+
199+
<xsl:otherwise>
200+
<xsl:value-of select="."/>
201+
</xsl:otherwise>
202+
</xsl:choose>
203+
</td>
198204
</xsl:for-each>
199205
</xsl:template>
200206

0 commit comments

Comments
 (0)