1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cce="http://cce.mitre.org" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cdf="http://checklists.nist.gov/xccdf/1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ds="http://scap.nist.gov/schema/scap/source/1.2">
<!-- This style sheet takes as input a XCCDF file. It outputs each Rule and CCE ident element, in document order.
If provided parameter $ref, this style sheet will display the referenced CCE file side-by-side for comparison -->
<xsl:param name="ref" select="''" />
<xsl:variable name="cce_list" select="document($ref)/cce:cce_list" />
<xsl:template match="/">
<html>
<head>
<title> CCE Identifiers in <xsl:value-of select="ds:data-stream-collection/ds:component/cdf:Benchmark/cdf:title" /><xsl:if test="$ref"> with references common to <xsl:value-of select="$ref"/></xsl:if></title>
</head>
<body>
<br/>
<br/>
<div style="text-align: center; font-size: x-large; font-weight:bold">
CCE Identifiers in <xsl:value-of select="ds:data-stream-collection/ds:component/cdf:Benchmark/cdf:title" /><xsl:if test="$ref"> with references common to <xsl:value-of select="$ref"/></xsl:if>
</div>
<br/>
<br/>
<xsl:apply-templates select="ds:data-stream-collection/ds:component/cdf:Benchmark"/>
</body>
</html>
</xsl:template>
<xsl:template match="cdf:Benchmark">
<xsl:call-template name="table-style" />
<table>
<thead>
<td>CCE ID</td>
<td>Rule Title</td>
<td>Description</td>
<xsl:if test="$ref">
<td>CCE Description</td>
<td>CCE Mechanism</td>
</xsl:if>
</thead>
<xsl:apply-templates select=".//cdf:Rule" />
</table>
</xsl:template>
<xsl:template name="cce-output">
<xsl:param name="idstring"/>
<xsl:for-each select="$cce_list/cce:cces/cce:cce">
<xsl:if test="$idstring=@cce_id">
<td><xsl:value-of select="cce:description" /></td>
<td><xsl:value-of select="cce:technical_mechanisms/cce:technical_mechanism"/> </td>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="cdf:Rule">
<xsl:variable name="cce-id" select="cdf:ident[@system=$cceuri]"/>
<tr>
<td><xsl:value-of select="$cce-id"/></td>
<td><xsl:value-of select="cdf:title" /></td>
<td><xsl:apply-templates select="cdf:description"/> </td>
<xsl:if test="$ref">
<xsl:call-template name="cce-output" >
<xsl:with-param name="idstring" select="$cce-id" />
</xsl:call-template>
</xsl:if>
</tr>
<!--</xsl:if>-->
</xsl:template>
<!-- getting rid of XHTML namespace -->
<xsl:template match="xhtml:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="cdf:description">
<xsl:apply-templates select="@*|node()" />
</xsl:template>
<xsl:template match="cdf:rationale">
<xsl:apply-templates select="@*|node()" />
</xsl:template>
</xsl:stylesheet>
|