Debian Codegraph @

xsl/oval-results-report.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3
4 ****************************************************************************************
5 Copyright (c) 2002-2012, The MITRE Corporation
6 All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without modification, are
9 permitted provided that the following conditions are met:
10
11 * Redistributions of source code must retain the above copyright notice, this list
12 of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice, this
14 list of conditions and the following disclaimer in the documentation and/or other
15 materials provided with the distribution.
16 * Neither the name of The MITRE Corporation nor the names of its contributors may be
17 used to endorse or promote products derived from this software without specific
18 prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
23 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 ****************************************************************************************
31
32 AUTHOR:Matt Burton, The Mitre Corporation
33 DATE: 02 May 2005
34
35 Modified by Loren Bandiera, MMG Security
36 * Updating for v5 results
37 DATE: 10 May 2006
38
39 Reimplemented by Jon Baker, The Mitre Corporation
40 DATE: 12 October 2006
41
42 Modified by Vladimir Giszpenc, DSCI Contractor Supporting CERDEC S&TCD IAD
43 * Allowing for references other than CVE such as Red Hat patches
44 DATE: 18 May 2007
45
46 Modified by Vladimir Giszpenc, DSCI Contractor Supporting CERDEC S&TCD IAD
47 * Added some aggregate data in the Systems Analysed section
48 DATE: 20 Aug 2007
49
50 Modified by David Rothenberg, The Mitre Corporation
51 * Updated CSS style, updated groupings based on positive/negative implication rather than OVAL result enumeration
52 DATE: 24 September 2012
53
54 Modified by Simon Lukasik, Red Hat, Inc.
55 * Removed overabundant whitespaces
56 DATE: 05 August 2013
57
58 The results_to_html stylesheet converts an OVAL Results document into a more readable html format.
59 General information about the source of the OVAL Definitions being reported on, and the OVAL Results
60 producer is displayed. Next general information about each system analyzed is presented including a
61 table or result information. The table displays true results then all other results sorted in
62 descending order by result. If the OVAL Results document has results for multiple systems a set
63 of links will be generated near the top of the resulting html to allow users to easily jump to the
64 each system's results.
65
66 -->
67 <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5"
68 xmlns:oval-res="http://oval.mitre.org/XMLSchema/oval-results-5" xmlns:oval-sc="http://oval.mitre.org/XMLSchema/oval-system-characteristics-5"
69 xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:apache-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#apache"
70 xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:windows-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows"
71 xmlns:unix-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:linux-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
72 exclude-result-prefixes="oval oval-def oval-res oval-sc ind-def windows-def unix-def linux-def apache-def">
73 <xsl:output method="xml" indent="yes" omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
74 <xsl:key name="definition-index" use="@id" match="//oval-def:oval_definitions/oval-def:definitions/oval-def:definition"/>
75
76 <!-- Style declarations for pretty formatting -->
77 <xsl:template name="oval_res_style">
78 <style type="text/css">
79 table { border: 1px solid #000000; width: 100%; border-spacing: 0px; margin: 2px 0px;}
80 .noborder {border: none;}
81 .nomargin {margin: 0px;}
82 td { padding: 0px 4px 1px 4px;}
83 .SmallLabel { font-family: Geneva, Arial, Helvetica, sans-serif; color: #000000; font-size: 9pt; font-weight: bold; white-space: nowrap;}
84 .SmallText { font-family: Geneva, Arial, Helvetica, sans-serif; color: #000000; font-size: 9pt;}
85 .Label { font-family: Geneva, Arial, Helvetica, sans-serif; color: #000000; font-size: 10pt; font-weight: bold; white-space: nowrap;}
86 .TitleLabel { font-family: Geneva, Arial, Helvetica, sans-serif; color: #ffffff; font-size: 10pt; font-weight: bold; white-space: nowrap;}
87 .Text { font-family: Geneva, Arial, Helvetica, sans-serif; color: #000000; font-size: 10pt;}
88 .Title { color: #FFFFFF; background-color: #706c60; padding: 0px 4px 1px 4px; font-size: 10pt; border-bottom: 1px solid #000000;}
89 .Center { text-align: center;}
90
91 a { color:#676c63;}
92 a.Hover:hover { color:#7b0e0e; text-decoration:underline;}
93
94 .LightRow { background-color: #FFFFFF;}
95 .DarkRow { background-color: #DDDDD8;}
96
97 .resultbadA{background-color: #FFBC8F;}
98 .resultbadB{background-color: #FFE0CC;}
99 .resultgoodA{background-color: #ACD685;}
100 .resultgoodB{background-color: #CBE6B3;}
101 .unknownA{background-color: #AEC8E0;}
102 .unknownB{background-color: #DAE6F1;}
103 .errorA{background-color: #FFDD75;}
104 .errorB{background-color: #FFECB3;}
105 .otherA{background-color: #EEEEEE;}
106 .otherB{background-color: #FFFFFF;}
107
108 .Classcompliance{background-color: #93C572;}
109 .Classinventory{background-color: #AEC6CF;}
110 .Classmiscellaneous{background-color: #9966CC;}
111 .Classpatch{background-color: #FFDD75;}
112 .Classvulnerability{background-color: #FF9966;}
113 .ColorBox{width: 2px;}
114 </style>
115 </xsl:template>
116
117 <!-- Render the legend used to determine what row colors represent -->
118 <xsl:template name="ResultColorTable">
119 <table class="noborder nomargin" style="width:auto;">
120 <tr>
121 <td>
122 <table border="1">
123 <tr class="LightRow">
124 <td class="resultbadA ColorBox"/>
125 <td class="resultbadB ColorBox"/>
126 <td class="Text" title="Non-Compliant/Vulnerable/Unpatched">&#x2715;</td>
127 </tr>
128 </table>
129 </td>
130 <td>
131 <table border="1">
132 <tr class="LightRow">
133 <td class="resultgoodA ColorBox"/>
134 <td class="resultgoodB ColorBox"/>
135 <td class="Text" title="Compliant/Non-Vulnerable/Patched">&#x2713;</td>
136 </tr>
137 </table>
138 </td>
139 <td>
140 <table border="1">
141 <tr class="LightRow">
142 <td class="errorA ColorBox"/>
143 <td class="errorB ColorBox"/>
144 <td class="Text">Error</td>
145 </tr>
146 </table>
147 </td>
148 <td>
149 <table border="1">
150 <tr class="LightRow">
151 <td class="unknownA ColorBox"/>
152 <td class="unknownB ColorBox"/>
153 <td class="Text">Unknown</td>
154 </tr>
155 </table>
156 </td>
157 <td>
158 <table border="1">
159 <tr class="LightRow">
160 <td class="DarkRow ColorBox"/>
161 <td class="LightRow ColorBox"/>
162 <td class="Text" title="Inventory/Miscellaneous class, or Not Applicable/Not Evaluated result">Other</td>
163 </tr>
164 </table>
165 </td>
166 </tr>
167 </table>
168 </xsl:template>
169
170 <!-- Gets the top level node -->
171 <xsl:template match="oval-res:oval_results">
172 <!-- Put a break after the XML encoding declaration, then insert the color chart into the source -->
173 <xsl:text>
174 </xsl:text>
175 <xsl:comment>
176 Color mapping
177 Result enumeration
178 Class |t|f|u|e|na|ne|
179 compliance |G|R|B|Y|- |- |
180 inventory |-|-|B|Y|- |- |
181 misc |-|-|B|Y|- |- |
182 patch |R|G|B|Y|- |- |
183 vuln |R|G|B|Y|- |- |
184
185 R = red
186 G = green
187 B = blue
188 Y = yellow
189 - = grey
190 </xsl:comment>
191 <html>
192 <head>
193 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
194 <title>OVAL Results</title>
195 <!-- Get CSS stylesheet -->
196 <xsl:call-template name="oval_res_style"/>
197 </head>
198 <body>
199 <!-- display results and definition generator information -->
200 <table class="noborder nomargin">
201 <tr>
202 <td width="50%">
203 <xsl:call-template name="ResultGenerator">
204 <xsl:with-param name="generatorElm" select="./oval-res:generator"/>
205 </xsl:call-template>
206 </td>
207 <td width="50%">
208 <xsl:call-template name="DefGenerator">
209 <xsl:with-param name="generatorElm" select="./oval-def:oval_definitions/oval-def:generator"/>
210 </xsl:call-template>
211 </td>
212 </tr>
213 </table>
214 <hr />
215 <!--
216 create anchors to each system in the results file
217 if only one system leave out the anchors
218 -->
219 <!-- 2007-08-20 Added aggregate result detail-->
220 <xsl:if test="not(count(./oval-res:results/oval-res:system) = 1)">
221 <table border="1">
222 <tr class="Title">
223 <td class="TitleLabel" align="center">Systems Analyzed</td>
224 <td class="TitleLabel" align="center" title="Non-Compliant/Vulnerable/Unpatched">&#x2715;</td>
225 <td class="TitleLabel" align="center" title="Compliant/Non-Vulnerable/Patched">&#x2713;</td>
226 <td class="TitleLabel" align="center">Errors</td>
227 <td class="TitleLabel" align="center">Unknown</td>
228 <td class="TitleLabel" align="center" title="Inventory/Miscellaneous class, or Not Applicable/Not Evaluated result">Other</td>
229 </tr>
230 <xsl:for-each select="./oval-res:results/oval-res:system">
231 <xsl:variable name="systemMod2">
232 <xsl:choose>
233 <xsl:when test="position() mod 2 = 1">A</xsl:when>
234 <xsl:otherwise>B</xsl:otherwise>
235 </xsl:choose>
236 </xsl:variable>
237 <tr>
238 <xsl:choose>
239 <xsl:when test="position() mod 2 = 1">
240 <xsl:attribute name="class">DarkRow</xsl:attribute>
241 </xsl:when>
242 <xsl:when test="position() mod 2 = 0">
243 <xsl:attribute name="class">LightRow</xsl:attribute>
244 </xsl:when>
245 </xsl:choose>
246 <td class="Label">
247 <a class="Hover" href="#{concat('a_',position())}">
248 <xsl:value-of select="./oval-sc:oval_system_characteristics/oval-sc:system_info/oval-sc:primary_host_name"/>
249 </a>
250 </td>
251 <td width="10">
252 <xsl:attribute name="class"><xsl:value-of select="concat('resultbad',$systemMod2,' Text')"/></xsl:attribute>
253 <xsl:value-of select="count(oval-res:definitions/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|oval-res:definitions/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='compliance']])"/>
254 </td>
255 <td width="10">
256 <xsl:attribute name="class"><xsl:value-of select="concat('resultgood',$systemMod2,' Text')"/></xsl:attribute>
257 <xsl:value-of select="count(oval-res:definitions/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|oval-res:definitions/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='compliance']])"/>
258 </td>
259 <td width="10">
260 <xsl:attribute name="class"><xsl:value-of select="concat('error',$systemMod2,' Text')"/></xsl:attribute>
261 <xsl:value-of select="count(./oval-res:definitions/oval-res:definition[@result='error'])"/>
262 </td>
263 <td width="10">
264 <xsl:attribute name="class"><xsl:value-of select="concat('unknown',$systemMod2,' Text')"/></xsl:attribute>
265 <xsl:value-of select="count(./oval-res:definitions/oval-res:definition[@result='unknown'])"/>
266 </td>
267 <td width="10">
268 <xsl:attribute name="class"><xsl:value-of select="concat('other',$systemMod2,' Text')"/></xsl:attribute>
269 <xsl:value-of select="count(oval-res:definitions/oval-res:definition[@result='not applicable' or @result='not evaluated']|oval-res:definitions/oval-res:definition[@result='true' or @result='false'][key('definition-index', ./@definition_id)[@class='inventory' or @class='miscellaneous']])"/>
270 </td>
271 </tr>
272 </xsl:for-each>
273 </table>
274 <br/>
275 </xsl:if>
276
277 <!--
278 for each system in the results file
279 - display system info
280 - display the sc generator
281 - display results table
282 -->
283 <xsl:for-each select="./oval-res:results/oval-res:system">
284 <!-- display the system info data -->
285 <xsl:call-template name="SystemInfo">
286 <xsl:with-param name="sysInfoElm" select="./oval-sc:oval_system_characteristics/oval-sc:system_info"/>
287 </xsl:call-template>
288
289 <!-- display the generator info for the sc data -->
290 <xsl:call-template name="SCGenerator">
291 <xsl:with-param name="generatorElm" select="./oval-sc:oval_system_characteristics/oval-sc:generator"/>
292 </xsl:call-template>
293
294 <!-- display definition results -->
295 <xsl:call-template name="DefinitionsResults">
296 <xsl:with-param name="definitionsElm" select="./oval-res:definitions"/>
297 </xsl:call-template>
298 <xsl:if test="not(position() = last())"><hr /></xsl:if>
299 </xsl:for-each>
300 </body>
301 </html>
302 </xsl:template>
303
304 <!-- Get the system_info and put it into a table. -->
305 <xsl:template name="SystemInfo">
306 <xsl:param name="sysInfoElm"/>
307 <!-- Create page anchor to this system, will be used if multiple systems present -->
308 <a class="Hover" name="{concat('a_',position())}" id="{concat('a_',position())}" style="text-decoration:none;"/>
309 <table border="1">
310 <tr class="Title">
311 <td class="TitleLabel" colspan="2">System Information</td>
312 </tr>
313 <tr class="DarkRow">
314 <td class="Label" width="20%">Host Name</td>
315 <td class="Text" width="80%"><xsl:value-of select="$sysInfoElm/child::oval-sc:primary_host_name"/></td>
316 </tr>
317 <tr class="LightRow">
318 <td class="Label" width="20%">Operating System</td>
319 <td class="Text" width="80%"><xsl:value-of select="$sysInfoElm/child::oval-sc:os_name"/></td>
320 </tr>
321 <tr class="DarkRow">
322 <td class="Label" width="20%">Operating System Version</td>
323 <td class="Text" width="80%"><xsl:value-of select="$sysInfoElm/child::oval-sc:os_version"/></td>
324 </tr>
325 <tr class="LightRow">
326 <td class="Label" width="20%">Architecture</td>
327 <td class="Text" width="80%"><xsl:value-of select="$sysInfoElm/child::oval-sc:architecture"/></td>
328 </tr>
329 <tr class="DarkRow">
330 <td class="Label" width="20%">Interfaces</td>
331 <td width="80%">
332 <xsl:call-template name="Interfaces">
333 <xsl:with-param name="iterfacesElm" select="$sysInfoElm/oval-sc:interfaces"/>
334 </xsl:call-template>
335 </td>
336 </tr>
337 </table>
338 </xsl:template>
339
340 <!-- Loop through all possible interfaces and put it into the table -->
341 <xsl:template name="Interfaces">
342 <xsl:param name="iterfacesElm"/>
343 <xsl:for-each select="$iterfacesElm/oval-sc:interface">
344 <xsl:variable name="interfaceMod2">
345 <xsl:choose>
346 <xsl:when test="position() mod 2 = 1">LightRow</xsl:when>
347 <xsl:otherwise>DarkRow</xsl:otherwise>
348 </xsl:choose>
349 </xsl:variable>
350 <table border="1">
351 <tr class="{$interfaceMod2}">
352 <td class="Label" width="20%">Interface Name</td>
353 <td class="Text" width="80%"><xsl:value-of select="./oval-sc:interface_name"/></td>
354 </tr>
355 <tr class="{$interfaceMod2}">
356 <td class="Label" width="20%">IP Address</td>
357 <td class="Text" width="80%"><xsl:value-of select="./oval-sc:ip_address"/></td>
358 </tr>
359 <tr class="{$interfaceMod2}">
360 <td class="Label" width="20%">MAC Address</td>
361 <td class="Text" width="80%"><xsl:value-of select="./oval-sc:mac_address"/></td>
362 </tr>
363 </table>
364 </xsl:for-each>
365 </xsl:template>
366
367 <!-- Create a table for the Result Generator and call its children. -->
368 <xsl:template name="ResultGenerator">
369 <xsl:param name="generatorElm"/>
370 <table border="1">
371 <tr class="Title">
372 <td class="TitleLabel" colspan="5">OVAL Results Generator Information</td>
373 </tr>
374 <xsl:call-template name="Generator">
375 <xsl:with-param name="generatorElm" select="$generatorElm"/>
376 </xsl:call-template>
377 <xsl:call-template name="GeneratorResTotals">
378 <xsl:with-param name="resultsElm" select="/oval-res:oval_results/oval-res:results"/>
379 </xsl:call-template>
380 </table>
381 </xsl:template>
382
383 <!-- Create a table for the System Characteristics Generator and call its children. -->
384 <xsl:template name="SCGenerator">
385 <xsl:param name="generatorElm"/>
386 <table border="1">
387 <tr class="Title">
388 <td class="TitleLabel" colspan="5">OVAL System Characteristics Generator Information</td>
389 </tr>
390 <xsl:call-template name="Generator">
391 <xsl:with-param name="generatorElm" select="$generatorElm"/>
392 </xsl:call-template>
393 </table>
394 </xsl:template>
395
396 <!-- Create a table for the Definitions Generator and call its children. -->
397 <xsl:template name="DefGenerator">
398 <xsl:param name="generatorElm"/>
399 <table border="1">
400 <tr class="Title">
401 <td class="TitleLabel" colspan="5">OVAL Definition Generator Information</td>
402 </tr>
403 <xsl:call-template name="Generator">
404 <xsl:with-param name="generatorElm" select="$generatorElm"/>
405 </xsl:call-template>
406 <xsl:call-template name="GeneratorDefTotals">
407 <xsl:with-param name="definitionsElm" select="/oval-res:oval_results/oval-def:oval_definitions"/>
408 </xsl:call-template>
409 </table>
410 </xsl:template>
411
412 <!-- Each child of Generators (oval, system_characteristics, results) is the same, this template gets their children. -->
413 <xsl:template name="Generator">
414 <xsl:param name="generatorElm"/>
415 <xsl:variable name="MessyNumber" select="string($generatorElm/oval:timestamp)"/>
416 <tr class="DarkRow Center">
417 <td class="SmallLabel">Schema Version</td>
418 <td class="SmallLabel">Product Name</td>
419 <td class="SmallLabel">Product Version</td>
420 <td class="SmallLabel">Date</td>
421 <td class="SmallLabel">Time</td>
422 </tr>
423 <tr class="LightRow">
424 <td class="SmallText"><xsl:value-of select="$generatorElm/oval:schema_version"/></td>
425 <td class="SmallText"><xsl:value-of select="$generatorElm/oval:product_name"/></td>
426 <td class="SmallText"><xsl:value-of select="$generatorElm/oval:product_version"/></td>
427 <td class="SmallText">
428 <!--Create variable "MessyNumber" to make time stamp a string and then print it out in a readable version -->
429 <xsl:value-of select="substring($MessyNumber, 1, 4)"/>
430 <!-- year -->
431 <xsl:text>-</xsl:text>
432 <xsl:value-of select="substring($MessyNumber, 6, 2)"/>
433 <!-- month -->
434 <xsl:text>-</xsl:text>
435 <xsl:value-of select="substring($MessyNumber, 9, 2)"/>
436 <!-- day -->
437 </td>
438 <td class="SmallText">
439 <xsl:value-of select="substring($MessyNumber, 12, 2)"/>
440 <xsl:text>:</xsl:text>
441 <!-- hour -->
442 <xsl:value-of select="substring($MessyNumber, 15, 2)"/>
443 <xsl:text>:</xsl:text>
444 <!-- minute -->
445 <xsl:value-of select="substring($MessyNumber, 18, 2)"/> <!-- second -->
446 </td>
447 </tr>
448 </xsl:template>
449
450 <!-- Add rows to the OVAL Definitions generator to supply aggregate data. -->
451 <xsl:template name="GeneratorDefTotals">
452 <xsl:param name="definitionsElm"/>
453 <tr class="DarkRow Center">
454 <td class="SmallLabel" style="width: 20%;">#Definitions</td>
455 <td class="SmallLabel" style="width: 20%;">#Tests</td>
456 <td class="SmallLabel" style="width: 20%;">#Objects</td>
457 <td class="SmallLabel" style="width: 20%;">#States</td>
458 <td class="SmallLabel" style="width: 20%;">#Variables</td>
459 </tr>
460 <tr class="LightRow Center">
461 <td class="SmallText Center">
462 <xsl:value-of select="concat(count($definitionsElm/oval-def:definitions/oval-def:definition),' Total')"/><br />
463 <xsl:if test="$definitionsElm/oval-def:definitions/oval-def:definition[@class]">
464 <table class="noborder">
465 <tr class="Center">
466 <td class="SmallText Classcompliance" title="compliance" style="width:20%"><xsl:value-of select="count($definitionsElm/oval-def:definitions/oval-def:definition[@class='compliance'])"/></td>
467 <td class="SmallText Classinventory" title="inventory" style="width:20%"><xsl:value-of select="count($definitionsElm/oval-def:definitions/oval-def:definition[@class='inventory'])"/></td>
468 <td class="SmallText Classmiscellaneous" title="miscellaneous" style="width:20%"><xsl:value-of select="count($definitionsElm/oval-def:definitions/oval-def:definition[@class='miscellaneous'])"/></td>
469 <td class="SmallText Classpatch" title="patch" style="width:20%"><xsl:value-of select="count($definitionsElm/oval-def:definitions/oval-def:definition[@class='patch'])"/></td>
470 <td class="SmallText Classvulnerability" title="vulnerability" style="width:20%"><xsl:value-of select="count($definitionsElm/oval-def:definitions/oval-def:definition[@class='vulnerability'])"/></td>
471 </tr>
472 </table>
473 </xsl:if>
474 </td>
475 <td class="SmallText Center">
476 <xsl:value-of select="count($definitionsElm/oval-def:tests/*)"/>
477 </td>
478 <td class="SmallText Center">
479 <xsl:value-of select="count($definitionsElm/oval-def:objects/*)"/>
480 </td>
481 <td class="SmallText Center">
482 <xsl:value-of select="count($definitionsElm/oval-def:states/*)"/>
483 </td>
484 <td class="SmallText Center">
485 <xsl:value-of select="count($definitionsElm/oval-def:variables/*)"/>
486 </td>
487 </tr>
488 </xsl:template>
489
490 <!-- Add rows to the OVAL Results generator to supply aggregate data. -->
491 <xsl:template name="GeneratorResTotals">
492 <xsl:param name="resultsElm"/>
493 <tr class="DarkRow Center">
494 <td class="SmallLabel" style="width: 20%;" title="Non-Compliant/Vulnerable/Unpatched">#&#x2715;</td>
495 <td class="SmallLabel" style="width: 20%;" title="Compliant/Non-Vulnerable/Patched">#&#x2713;</td>
496 <td class="SmallLabel" style="width: 20%;" title="Error">#Error</td>
497 <td class="SmallLabel" style="width: 20%;" title="Unknown">#Unknown</td>
498 <td class="SmallLabel" style="width: 20%;" title="Inventory/Miscellaneous class, or Not Applicable/Not Evaluated result">#Other</td>
499 </tr>
500 <tr class="LightRow Center" style="height:auto;">
501 <td class="SmallText resultbadB" title="Non-Compliant/Vulnerable/Unpatched" style="width:20%"><xsl:value-of select="count($resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|$resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='compliance']])"/></td>
502 <td class="SmallText resultgoodB" title="Compliant/Non-Vulnerable/Patched" style="width:20%"><xsl:value-of select="count($resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|$resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='compliance']])"/></td>
503 <td class="SmallText errorB" title="Error" style="width:20%"><xsl:value-of select="count($resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='error'])"/></td>
504 <td class="SmallText unknownB" title="Unknown" style="width:20%"><xsl:value-of select="count($resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='unknown'])"/></td>
505 <td class="SmallText otherB" title="Inventory/Miscellaneous class, or Not Applicable/Not Evaluated result" style="width:20%"><xsl:value-of select="count($resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='not applicable' or @result='not evaluated']|$resultsElm/oval-res:system/oval-res:definitions/oval-res:definition[@result='true' or @result='false'][key('definition-index', ./@definition_id)[@class='inventory' or @class='miscellaneous']])"/></td>
506 </tr>
507 </xsl:template>
508
509 <!-- Process a system's definition results in the specified order -->
510 <xsl:template name="DefinitionsResults">
511 <xsl:param name="definitionsElm"/>
512 <table border="1">
513 <tr class="Title">
514 <td class="TitleLabel" colspan="5">OVAL Definition Results</td>
515 </tr>
516 <!-- display the result color coding table -->
517 <tr class="DarkRow">
518 <td colspan="5"><xsl:call-template name="ResultColorTable"/></td>
519 </tr>
520
521 <tr class="TitleLabel">
522 <td class="Title" align="center">ID</td>
523 <td class="Title" align="center">Result</td>
524 <td class="Title" align="center">Class</td>
525 <td class="Title" align="center">Reference ID</td>
526 <td class="Title" align="center">Title</td>
527 </tr>
528
529 <!-- process Non-Compliant/Vulnerable/Unpatched results -->
530 <xsl:for-each select="$definitionsElm/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|$definitionsElm/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='compliance']]">
531 <xsl:sort select="@id" data-type="text" order="descending"/>
532 <xsl:call-template name="Definition">
533 <xsl:with-param name="definitionElm" select="."/>
534 </xsl:call-template>
535 </xsl:for-each>
536
537 <!-- process unknown results -->
538 <xsl:for-each select="$definitionsElm/oval-res:definition[@result='unknown']">
539 <xsl:sort select="@id" data-type="text" order="descending"/>
540 <xsl:call-template name="Definition">
541 <xsl:with-param name="definitionElm" select="."/>
542 </xsl:call-template>
543 </xsl:for-each>
544
545 <!-- process error results -->
546 <xsl:for-each select="$definitionsElm/oval-res:definition[@result='error']">
547 <xsl:sort select="@id" data-type="text" order="descending"/>
548 <xsl:call-template name="Definition">
549 <xsl:with-param name="definitionElm" select="."/>
550 </xsl:call-template>
551 </xsl:for-each>
552
553 <!-- process other results -->
554 <xsl:for-each select="$definitionsElm/oval-res:definition[@result='not applicable' or @result='not evaluated']|$definitionsElm/oval-res:definition[@result='true' or @result='false'][key('definition-index', ./@definition_id)[@class='inventory' or @class='miscellaneous']]">
555 <xsl:sort select="@id" data-type="text" order="descending"/>
556 <xsl:call-template name="Definition">
557 <xsl:with-param name="definitionElm" select="."/>
558 </xsl:call-template>
559 </xsl:for-each>
560
561 <!-- process Compliant/Non-Vulnerable/Patched results -->
562 <xsl:for-each select="$definitionsElm/oval-res:definition[@result='false'][key('definition-index', ./@definition_id)[@class='patch' or @class='vulnerability']]|$definitionsElm/oval-res:definition[@result='true'][key('definition-index', ./@definition_id)[@class='compliance']]">
563 <xsl:sort select="@id" data-type="text" order="descending"/>
564 <xsl:call-template name="Definition">
565 <xsl:with-param name="definitionElm" select="."/>
566 </xsl:call-template>
567 </xsl:for-each>
568 </table>
569 </xsl:template>
570
571 <!-- Add information about a single definition to a new row -->
572 <xsl:template name="Definition">
573 <xsl:param name="definitionElm"/>
574 <xsl:variable name="defClass"><xsl:value-of select="key('definition-index', @definition_id)/@class"/></xsl:variable>
575 <xsl:variable name="defResult"><xsl:value-of select="$definitionElm/@result"/></xsl:variable>
576 <tr>
577 <!-- set results to alternating colors -->
578 <xsl:variable name="class_prefix">
579 <xsl:choose>
580 <xsl:when test="(($defResult='true') and (($defClass='patch') or ($defClass='vulnerability'))) or (($defResult='false') and ($defClass='compliance'))">resultbad</xsl:when>
581 <xsl:when test="(($defResult='false') and (($defClass='patch') or ($defClass='vulnerability'))) or (($defResult='true') and ($defClass='compliance'))">resultgood</xsl:when>
582 <xsl:when test="$defResult='unknown'">unknown</xsl:when>
583 <xsl:when test="$defResult='error'">error</xsl:when>
584 <xsl:otherwise>other</xsl:otherwise>
585 </xsl:choose>
586 </xsl:variable>
587 <xsl:variable name="classMod2">
588 <xsl:choose>
589 <xsl:when test="position() mod 2 = 1">A</xsl:when>
590 <xsl:otherwise>B</xsl:otherwise>
591 </xsl:choose>
592 </xsl:variable>
593
594 <xsl:attribute name="class"><xsl:value-of select="concat($class_prefix,$classMod2)"/></xsl:attribute>
595
596 <!-- id -->
597 <td class="Text" align="center">
598 <xsl:choose>
599 <!-- if the id is an oval repository id add a link otherwise don't -->
600 <xsl:when test="starts-with($definitionElm/@definition_id, 'oval:org.mitre.oval:def:')">
601 <xsl:variable name="idUrl" select="concat('http://oval.mitre.org/repository/data/getDef?id=', $definitionElm/@definition_id)"/>
602 <a class="Hover" target="_blank" href="{$idUrl}"><xsl:value-of select="$definitionElm/@definition_id"/></a>
603 </xsl:when>
604 <xsl:otherwise><xsl:value-of select="$definitionElm/@definition_id"/></xsl:otherwise>
605 </xsl:choose>
606 </td>
607
608 <!-- result -->
609 <td class="Text" align="center">
610 <xsl:value-of select="$defResult"/>
611 </td>
612
613 <!-- Class -->
614 <td class="Text" align="center">
615 <xsl:value-of select="$defClass"/>
616 </td>
617
618 <!-- reference id -->
619 <td class="Text" align="center">
620 <xsl:for-each select="key('definition-index', @definition_id)/oval-def:metadata/oval-def:reference">
621 <xsl:text>[</xsl:text>
622 <!-- only display as a link if reference has a URL -->
623 <xsl:choose>
624 <xsl:when test="@ref_url"><a class="Hover" target="_blank" href="{@ref_url}"><xsl:value-of select="@ref_id"/></a></xsl:when>
625 <xsl:otherwise><xsl:value-of select="@ref_id"/></xsl:otherwise>
626 </xsl:choose>
627 <xsl:text>]</xsl:text>
628 <xsl:if test="not(position() = last())"><xsl:text>, </xsl:text></xsl:if>
629 </xsl:for-each>
630 </td>
631
632 <!-- title -->
633 <td class="Text">
634 <xsl:value-of select="key('definition-index', @definition_id)/oval-def:metadata/oval-def:title"/>
635 </td>
636 </tr>
637 </xsl:template>
638 </xsl:stylesheet>