Signed-off-by: Jeffrey Blank <[email protected]>
---
 RHEL6/transforms/xccdf2table-profileccirefs.xslt  |  133 ++-------------------
 RHEL6/transforms/xccdf2table-profilenistrefs.xslt |   78 ++-----------
 2 files changed, 19 insertions(+), 192 deletions(-)

diff --git a/RHEL6/transforms/xccdf2table-profileccirefs.xslt 
b/RHEL6/transforms/xccdf2table-profileccirefs.xslt
index 8ac17fb..a5ad223 100644
--- a/RHEL6/transforms/xccdf2table-profileccirefs.xslt
+++ b/RHEL6/transforms/xccdf2table-profileccirefs.xslt
@@ -7,10 +7,10 @@
 <xsl:variable name="os_srg" 
select="document('../references/disa-os-srg-v1r1.xml')/cdf:Benchmark" />
 
 <xsl:param name="testinfo" select="''" />
-
 <xsl:param name="format" select="''"/>
 
 <xsl:include href="constants.xslt"/>
+<xsl:include href="table-style.xslt"/>
 
        <xsl:template match="/">
                <html>
@@ -31,27 +31,11 @@
 
 
        <xsl:template match="cdf:Benchmark">
-               <style type="text/css">
-               table
-               {
-                       border-collapse:collapse;
-               }
-               table,th, td
-               {
-                       border: 1px solid black;
-                       vertical-align: top;
-                       padding: 3px;
-               }
-               thead
-               {
-                       display: table-header-group;
-                       font-weight: bold;
-               }
-               </style>
+               <xsl:call-template name="table-style" />
                <table>
                        <thead>
-                               <td>Vuln ID</td>
-                               <td>CAT</td>
+                               <td>ID</td>
+                               <td>Severity</td>
                                <!-- <td>GEN ID</td> -->
                                <td>Title</td>
                                <td>Discussion (Rationale)</td>
@@ -63,67 +47,18 @@
                                <td>800-53 Refs</td>
                        </thead>
 
-               <xsl:call-template name="profileplate">
-                       <xsl:with-param name="profileid" select="$profile" />
-               </xsl:call-template>
-               </table>
-       </xsl:template>
-
-       <!-- recursively-called, to handle Profile "extends" behavior -->
-       <xsl:template match="cdf:Profile" name="profileplate">
-               <xsl:param name="profileid" />
-               <xsl:comment> Entered Profile: <xsl:value-of 
select="$profileid" />      </xsl:comment>
-
-               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profileid]">
-               <xsl:if test="@extends">
-                       <xsl:variable name="extendedprofile" select="@extends" 
/>
-                       <xsl:call-template name="profileplate">
-                               <xsl:with-param name="profileid" 
select="$extendedprofile" />
-                       </xsl:call-template>
-               </xsl:if>
-               </xsl:for-each>
-
-               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profileid]/cdf:select">
+               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profile]/cdf:select">
                        <xsl:variable name="idrefer" select="@idref" />
                        <xsl:variable name="enabletest" select="@selected" />
-                       <xsl:for-each select="/cdf:Benchmark/cdf:Group">
-                               <xsl:call-template name="groupplate">
+                       <xsl:for-each select="//cdf:Rule">
+                               <xsl:call-template name="ruleplate">
                                        <xsl:with-param name="idreference" 
select="$idrefer" />
                                        <xsl:with-param name="enabletest" 
select="$enabletest" />
                                </xsl:call-template>
                        </xsl:for-each>
                </xsl:for-each>
 
-       </xsl:template>
-
-       <xsl:template match="cdf:Group" name="groupplate">
-               <xsl:param name="idreference" />
-               <xsl:param name="enabletest" />
-               <!-- Group cdf:title -->
-               <xsl:for-each select="cdf:Group">
-                       <xsl:call-template name="groupplate">
-                               <xsl:with-param name="idreference" 
select="$idreference" />
-                               <xsl:with-param name="enabletest" 
select="$enabletest" />
-                       </xsl:call-template>
-               </xsl:for-each>
-
-               <xsl:for-each select="cdf:Rule">
-                       <xsl:choose>
-                       <xsl:when test="$format='flat'">
-                               <xsl:call-template name="ruleplate-flat">
-                                       <xsl:with-param name="idreference" 
select="$idreference" />
-                                       <xsl:with-param name="enabletest" 
select="$enabletest" />
-                               </xsl:call-template>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:call-template name="ruleplate">
-                                       <xsl:with-param name="idreference" 
select="$idreference" />
-                                       <xsl:with-param name="enabletest" 
select="$enabletest" />
-                               </xsl:call-template>
-                       </xsl:otherwise>
-
-                       </xsl:choose>
-               </xsl:for-each>
+               </table>
        </xsl:template>
 
 
@@ -139,7 +74,6 @@
                        <td> <xsl:apply-templates select="cdf:rationale"/> </td>
                        <td> <xsl:apply-templates select="cdf:description"/> 
</td>
 
-
                        <td>
                        <!-- print pretty visual indication of testing data -->
                        <xsl:if test="$testinfo and 
cdf:reference[@href='test_attestation']">
@@ -201,57 +135,6 @@
        </xsl:template>
 
 
-       <xsl:template match="cdf:Rule" name="ruleplate-flat">
-               <xsl:param name="idreference" />
-               <xsl:param name="enabletest" />
-               <xsl:if test="@id=$idreference and $enabletest='true'">
-
-               <xsl:variable name="rule" select="."  />
-
-               <xsl:for-each select="cdf:reference[@href=$disa-cciuri]">
-               <xsl:variable name="cci_formatted" 
select='format-number(self::node()[text()], "000000")' />
-                       <xsl:variable name="cci_expanded" 
select="concat('CCI-', $cci_formatted)"  />
-
-                       <tr>
-                       <td>TBD<!-- insert proper Vuln-ID if available --></td>
-                       <td> <xsl:value-of select="../@severity" /></td>
-                       <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>
-                       <td> <xsl:apply-templates select="../cdf:description"/> 
</td>
-                       <td> <xsl:apply-templates select="../cdf:check" /> </td>
-
-                       <td> 
-                       <xsl:for-each select="$os_srg/cdf:Group/cdf:Rule" >
-                               <xsl:if test="cdf:ident=$cci_expanded">
-                                       <!-- output the SRG ID -->
-                                       <xsl:value-of select="cdf:version"/>
-                                       <br/>
-                               </xsl:if>
-                       </xsl:for-each>
-                       </td> 
-
-                       <td> <xsl:value-of select="$cci_expanded"/> </td> 
-
-                       <td> 
-                               <xsl:for-each 
select="$cci_list/cci:cci_items/cci:cci_item">
-                                       <xsl:if test="@id=$cci_expanded">
-                                               <xsl:for-each 
select="cci:references/cci:reference">
-                                                       <xsl:if 
test="@title='NIST SP 800-53'">
-                                                               <xsl:value-of 
select="@index"/>
-                                                               <br/>
-                                                       </xsl:if>
-                                               </xsl:for-each>
-                                       </xsl:if>
-                               </xsl:for-each>
-                       </td> 
-
-                       </tr>
-
-               </xsl:for-each>
-               </xsl:if>
-       </xsl:template>
-
        <xsl:template match="cdf:check">
            <xsl:if test="@system=$ociltransitional">
                        <xsl:apply-templates select="cdf:check-content" />
diff --git a/RHEL6/transforms/xccdf2table-profilenistrefs.xslt 
b/RHEL6/transforms/xccdf2table-profilenistrefs.xslt
index 3dace53..c26ba84 100644
--- a/RHEL6/transforms/xccdf2table-profilenistrefs.xslt
+++ b/RHEL6/transforms/xccdf2table-profilenistrefs.xslt
@@ -4,6 +4,7 @@
 <!-- this style sheet expects parameter $profile, which is the id of the 
Profile to be shown -->
 
 <xsl:include href="constants.xslt"/>
+<xsl:include href="table-style.xslt"/>
 
        <xsl:template match="/">
                <html>
@@ -23,23 +24,8 @@
 
 
        <xsl:template match="cdf:Benchmark">
-               <style type="text/css">
-               table
-               {
-                       border-collapse:collapse;
-               }
-               table,th, td
-               {
-                       border: 1px solid black;
-                       vertical-align: top;
-                       padding: 3px;
-               }
-               thead
-               {
-                       display: table-header-group;
-                       font-weight: bold;
-               }
-               </style>
+               <xsl:call-template name="table-style" />
+
                <table>
                        <thead>
                                <td>CCE ID</td>
@@ -49,57 +35,18 @@
                                <td>Variable Setting</td>
                                <td>NIST 800-53 Mapping</td>
                        </thead>
-
-               <xsl:call-template name="profileplate">
-                       <xsl:with-param name="profileid" select="$profile" />
-               </xsl:call-template>
-               </table>
-       </xsl:template>
-
-       <!-- recursively-called, to handle Profile "extends" behavior -->
-       <xsl:template match="cdf:Profile" name="profileplate">
-               <xsl:param name="profileid" />
-               <xsl:comment> Entered Profile: <xsl:value-of 
select="$profileid" />      </xsl:comment>
-
-               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profileid]">
-               <xsl:if test="@extends">
-                       <xsl:variable name="extendedprofile" select="@extends" 
/>
-                       <xsl:call-template name="profileplate">
-                               <xsl:with-param name="profileid" 
select="$extendedprofile" />
-                       </xsl:call-template>
-               </xsl:if>
-               </xsl:for-each>
-
-               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profileid]/cdf:select">
+               <xsl:for-each 
select="/cdf:Benchmark/cdf:Profile[@id=$profile]/cdf:select">
                        <xsl:variable name="idrefer" select="@idref" />
                        <xsl:variable name="enabletest" select="@selected" />
-                       <xsl:for-each select="/cdf:Benchmark/cdf:Group">
-                               <xsl:call-template name="groupplate">
+                       <xsl:for-each select="//cdf:Rule">
+                               <xsl:call-template name="ruleplate">
                                        <xsl:with-param name="idreference" 
select="$idrefer" />
                                        <xsl:with-param name="enabletest" 
select="$enabletest" />
                                </xsl:call-template>
                        </xsl:for-each>
                </xsl:for-each>
 
-       </xsl:template>
-
-       <xsl:template match="cdf:Group" name="groupplate">
-               <xsl:param name="idreference" />
-               <xsl:param name="enabletest" />
-               <!-- Group cdf:title -->
-               <xsl:for-each select="cdf:Group">
-                       <xsl:call-template name="groupplate">
-                               <xsl:with-param name="idreference" 
select="$idreference" />
-                               <xsl:with-param name="enabletest" 
select="$enabletest" />
-                       </xsl:call-template>
-               </xsl:for-each>
-
-               <xsl:for-each select="cdf:Rule">
-                       <xsl:call-template name="ruleplate">
-                               <xsl:with-param name="idreference" 
select="$idreference" />
-                               <xsl:with-param name="enabletest" 
select="$enabletest" />
-                       </xsl:call-template>
-               </xsl:for-each>
+               </table>
        </xsl:template>
 
 
@@ -116,7 +63,10 @@
                        <!-- need to resolve <sub idref=""> here  -->
                        <td> <!-- TODO: print refine-value from profile 
associated with rule --> </td>
                        <td> 
-                       <xsl:apply-templates select="cdf:reference"/>
+                               <xsl:for-each 
select="cdf:reference[@href=$nist800-53uri]">
+                                       <xsl:value-of select="text()"/>
+                                       <br/>
+                               </xsl:for-each>
                        </td> 
                </tr>
                </xsl:if>
@@ -135,12 +85,6 @@
                </xsl:for-each>
        </xsl:template>
 
-       <xsl:template match="cdf:reference">
-               <!-- adjust for the desired reference here -->
-               <xsl:if test="@href=$nist800-53uri">
-                       <xsl:value-of select="." />
-               </xsl:if>
-       </xsl:template>
 
     <!-- getting rid of XHTML namespace -->
        <xsl:template match="xhtml:*">
-- 
1.7.1

_______________________________________________
scap-security-guide mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide

Reply via email to