Signed-off-by: Jeffrey Blank <blank(a)eclipse.ncsc.mil>
---
RHEL6/transforms/xccdf-create-ocil.xslt | 67 +++++++++++++++++++++++++++++
RHEL6/transforms/xccdf-ocilcheck2ref.xslt | 35 +++++++++++++++
2 files changed, 102 insertions(+), 0 deletions(-)
create mode 100644 RHEL6/transforms/xccdf-create-ocil.xslt
create mode 100644 RHEL6/transforms/xccdf-ocilcheck2ref.xslt
diff --git a/RHEL6/transforms/xccdf-create-ocil.xslt
b/RHEL6/transforms/xccdf-create-ocil.xslt
new file mode 100644
index 0000000..77a8d05
--- /dev/null
+++ b/RHEL6/transforms/xccdf-create-ocil.xslt
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cdf="http://checklists.nist.gov/xccdf/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="cdf">
+
+<!-- This transform expects checks with system "ocil-transitional" and that
these contain check-content
+ that can transformed into OCIL questionnaires.
+ -->
+
+
+ <xsl:template match="/">
+ <ocil
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://scap.nist.gov/schema/ocil/2.0" >
+ <generator>
+ <schema_version>2.0</schema_version>
+ <timestamp>2009-05-20T12:06:31</timestamp>
+ </generator>
+
+ <questionnaires>
+ <xsl:for-each select=".//cdf:Rule">
+ <xsl:if
test="cdf:check[@system='ocil-transitional']/cdf:check-content">
+ <questionnaire id="{@id}_ocil">
+ <title><xsl:value-of select="cdf:title"/></title>
+ <actions>
+ <test_action_ref><xsl:value-of
select="@id"/>_action</test_action_ref>
+ </actions>
+ </questionnaire>
+ </xsl:if>
+ </xsl:for-each>
+ </questionnaires>
+
+ <test_actions>
+ <xsl:for-each select=".//cdf:Rule">
+ <xsl:if
test="cdf:check[@system='ocil-transitional']/cdf:check-content">
+ <boolean_question_test_action id="{@id}_action"
question_ref="{@id}_question">
+ <when_true>
+ <result>PASS</result>
+ </when_true>
+ <when_false>
+ <result>FAIL</result>
+ </when_false>
+ </boolean_question_test_action>
+ </xsl:if>
+ </xsl:for-each>
+ </test_actions>
+
+ <questions>
+ <xsl:for-each select=".//cdf:Rule">
+ <xsl:if
test="cdf:check[@system='ocil-transitional']/cdf:check-content">
+ <boolean_question id="{@id}_question">
+ <question_text>
+ <xsl:apply-templates
select="cdf:check[@system='ocil-transitional']/cdf:check-content"/>
+ </question_text>
+ </boolean_question>
+ </xsl:if>
+ </xsl:for-each>
+ </questions>
+
+ </ocil>
+ </xsl:template>
+
+ <xsl:template match="xhtml:*">
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:template>
+
+ <xsl:template match="cdf:check-content">
+ <xsl:apply-templates select="node()"/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
b/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
new file mode 100644
index 0000000..396cab1
--- /dev/null
+++ b/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xccdf="http://checklists.nist.gov/xccdf/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xccdf">
+
+<xsl:include href="constants.xslt"/>
+
+<!-- This transform replaces check-content with a check-content-ref, using the
enclosing Rule id to create
+ an id for the check (by appending "_ocil") -->
+
+ <!-- replace check system attribute with the real OCIL one -->
+ <xsl:template
match="xccdf:check[@system='ocil-transitional']">
+ <xsl:copy>
+ <xsl:apply-templates select="@*" />
+ <xsl:attribute name="system"><xsl:value-of
select="$ocil_cs" /></xsl:attribute>
+ <xsl:apply-templates select="node()" />
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- remove check-content nodes and replace them with a check-content-ref node,
using the Rule id
+ to create a reference name -->
+ <xsl:template match="xccdf:check-content">
+ <xsl:element name="check-content-ref"
namespace="http://checklists.nist.gov/xccdf/1.1">
+ <xsl:attribute name="href">rhel6-ocil.xml</xsl:attribute>
+ <xsl:attribute name="name"><xsl:value-of
select="../../@id"/>_ocil</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- copy everything else through to final output -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
--
1.7.1