[PATCH 6/8] updating transform to show STIG-structured XCCDF as a table

Jeffrey Blank blank at eclipse.ncsc.mil
Tue Oct 9 15:09:35 UTC 2012


Signed-off-by: Jeffrey Blank <blank at eclipse.ncsc.mil>
---
 RHEL6/transforms/xccdf2table-profileccirefs.xslt |    4 +-
 RHEL6/transforms/xccdf2table-stig.xslt           |   34 +++++++++++++--------
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/RHEL6/transforms/xccdf2table-profileccirefs.xslt b/RHEL6/transforms/xccdf2table-profileccirefs.xslt
index b769c6b..5f2bc40 100644
--- a/RHEL6/transforms/xccdf2table-profileccirefs.xslt
+++ b/RHEL6/transforms/xccdf2table-profileccirefs.xslt
@@ -48,7 +48,7 @@
 		<table>
 			<thead>
 				<td>Vuln ID</td>
-				<td>GEN ID</td>
+				<!-- <td>GEN ID</td> -->
 				<td>Title</td>
 				<td>Discussion (Rationale)</td>
 				<td>Fix Text (Description)</td>
@@ -116,7 +116,7 @@
 		<xsl:if test="@id=$idreference and $enabletest='true'">
 		<tr>
 			<td> TBD<!--extract value of Vuln-ID (stored as reference or note or ident) when mapping is available --></td>
-			<td> TBD<!--extract value of GEN-ID (stored as reference or note or ident) when mapping is available --></td>
+			<!-- <td> TBD</td> --> <!--extract value of GEN-ID (stored as reference or note or ident) when mapping is available -->
 			<td> <xsl:value-of select="cdf:title" /></td>
 			<!-- call template to grab text and also child nodes (which should all be xhtml)  -->
 			<td> <xsl:apply-templates select="cdf:rationale"/> </td>
diff --git a/RHEL6/transforms/xccdf2table-stig.xslt b/RHEL6/transforms/xccdf2table-stig.xslt
index 3c83b81..af5af9b 100644
--- a/RHEL6/transforms/xccdf2table-stig.xslt
+++ b/RHEL6/transforms/xccdf2table-stig.xslt
@@ -56,14 +56,14 @@
 			<table class="bbl">
 				<tr><td class="bl">Title</td></tr>
 				<tr><td>V-ID</td></tr>
-				<tr><td>GEN-ID</td></tr>
+				<!--<tr><td>GEN-ID</td></tr>-->
 				<tr><td>CAT</td></tr>
 			</table>
 			</td>
 			</xsl:when>
 			<xsl:otherwise>
 				<td>V-ID</td>
-				<td>GEN-ID</td>
+				<!--<td>GEN-ID</td>-->
 				<td>CAT</td>
 				<td>Title</td>
 			</xsl:otherwise>
@@ -90,7 +90,7 @@
 			<table class="bl">
 					<tr><td><xsl:value-of select="cdf:Rule/cdf:title" /></td></tr>
 					<tr><td><xsl:value-of select="@id"/></td></tr>
-					<tr><td><xsl:value-of select="cdf:title" /></td></tr>
+					<!--<tr><td><xsl:value-of select="cdf:title" /></td></tr>-->
 					<tr><td><xsl:value-of select="cdf:Rule/@severity" /></td></tr>
 			</table>
 			</td>
@@ -98,14 +98,14 @@
 			<xsl:otherwise>
 				<td><xsl:value-of select="@id"/></td> 
 				<!--<td> <xsl:value-of select="cdf:ident" /></td>-->
-				<td> <xsl:value-of select="cdf:title" /></td>
+				<!--<td> <xsl:value-of select="cdf:title" /></td>-->
 				<td> <xsl:value-of select="cdf:Rule/@severity" /></td>
 				<td> <xsl:value-of select="cdf:Rule/cdf:title" /></td>
 			</xsl:otherwise>
 			</xsl:choose>
 			<td> <xsl:call-template name="extract-vulndiscussion"><xsl:with-param name="desc" select="cdf:Rule/cdf:description"/></xsl:call-template> </td>
-			<td> <xsl:value-of select="cdf:Rule/cdf:check/cdf:check-content"/> </td>
-			<td> <xsl:value-of select="cdf:Rule/cdf:fixtext"/> </td>
+			<td> <xsl:apply-templates select="cdf:Rule/cdf:check/cdf:check-content/node()"/> </td>
+			<td> <xsl:apply-templates select="cdf:Rule/cdf:fixtext/node()"/> </td>
 			<xsl:if test='$notes'>
 				<td> <xsl:call-template name="print-notes"><xsl:with-param name="vulnid" select="@id"/></xsl:call-template> </td>
 			</xsl:if>
@@ -176,13 +176,21 @@
  </xsl:template>
 
 
-    <!-- return only the text between the "VulnDiscussion" (non-XCCDF) tags -->
-    <!-- this should be removed as soon as SRGs include only a description instead of odd tags -->
-    <xsl:template name="extract-vulndiscussion">
-            <xsl:param name="desc"/>
-          <xsl:variable name="desc_info" select="substring-before($desc, '&lt;/VulnDiscussion&gt;')"/>
-          <xsl:value-of select="substring-after($desc_info, '&lt;VulnDiscussion&gt;')"/>
-    </xsl:template>
+    <!-- remove any encoded non-XCCDF tags. -->
+    <!-- continue to wonder: -->
+    <!-- 1) why this is not in the XCCDF spec, if it's needed by one of its major users, or -->
+    <!-- 2) why this garbage is ever exported by VMS -->
+    <!-- this should be removed as soon as SRGs don't include this detritus -->
+  <xsl:template name="extract-vulndiscussion">
+	<xsl:param name="desc"/>
+	<xsl:if test="contains($desc, '&lt;VulnDiscussion&gt;')">
+		<xsl:variable name="desc_info" select="substring-before($desc, '&lt;/VulnDiscussion&gt;')"/>
+		<xsl:value-of select="substring-after($desc_info, '&lt;VulnDiscussion&gt;')"/>
+	</xsl:if>
+	<xsl:if test="not(contains($desc, '&lt;VulnDiscussion&gt;'))">
+		<xsl:apply-templates select="$desc"/>
+	</xsl:if>
+  </xsl:template>
 
 
 
-- 
1.7.1



More information about the scap-security-guide mailing list