Please push this too.  

Someday we will attempt to have some discipline and straighten this duplication out.


On Wed, Jun 5, 2013 at 7:19 AM, Simon Lukasik <isimluk@fedoraproject.org> wrote:
From: Simon Lukasik <slukasik@redhat.com>

---
 OpenStack/Makefile                            |  3 ++-
 OpenStack/transforms/add_xccdf_namespace.xslt | 15 +++++++++++++++
 OpenStack/transforms/shorthand2xccdf.xslt     |  3 ---
 RHEVM3/Makefile                               |  3 ++-
 RHEVM3/transforms/add_xccdf_namespace.xslt    | 15 +++++++++++++++
 RHEVM3/transforms/shorthand2xccdf.xslt        |  3 ---
 6 files changed, 34 insertions(+), 8 deletions(-)
 create mode 100644 OpenStack/transforms/add_xccdf_namespace.xslt
 create mode 100644 RHEVM3/transforms/add_xccdf_namespace.xslt

diff --git a/OpenStack/Makefile b/OpenStack/Makefile
index f1c49b2..69280a1 100644
--- a/OpenStack/Makefile
+++ b/OpenStack/Makefile
@@ -14,7 +14,8 @@ shorthand-guide:
        xmllint --format --output $(OUT)/openstack-shorthand.xml $(OUT)/openstack-shorthand.xml

 shorthand2xccdf: shorthand-guide
-       xsltproc -o $(OUT)/unlinked-noprofiles-openstack-xccdf.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/openstack-shorthand.xml
+       xsltproc -o $(OUT)/unlinked-noprofiles-openstack-shorthand.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/openstack-shorthand.xml
+       xsltproc -o $(OUT)/unlinked-noprofiles-openstack-xccdf.xml $(TRANS)/add_xccdf_namespace.xslt $(OUT)/unlinked-noprofiles-openstack-shorthand.xml
        xsltproc -stringparam profile "allprofiles" -o $(OUT)/unlinked-openstack-xccdf-prerefs.xml \
                $(TRANS)/xccdf-addprofiles.xslt $(OUT)/unlinked-noprofiles-openstack-xccdf.xml
        xsltproc -stringparam profile "stig-openstack-server" -o $(OUT)/unlinked-openstack-xccdf.xml \
diff --git a/OpenStack/transforms/add_xccdf_namespace.xslt b/OpenStack/transforms/add_xccdf_namespace.xslt
new file mode 100644
index 0000000..3acd511
--- /dev/null
+++ b/OpenStack/transforms/add_xccdf_namespace.xslt
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+       <!-- Add the XCCDF 1.1 namespace to all elements without namespace. -->
+       <xsl:template match="node()|@*">
+               <xsl:copy>
+                       <xsl:apply-templates select="node()|@*"/>
+               </xsl:copy>
+       </xsl:template>
+
+       <xsl:template match="*[namespace-uri()='']">
+               <xsl:element name="{local-name()}" namespace="http://checklists.nist.gov/xccdf/1.1">
+                       <xsl:apply-templates select="node()|@*" />
+               </xsl:element>
+       </xsl:template>
+</xsl:stylesheet>
diff --git a/OpenStack/transforms/shorthand2xccdf.xslt b/OpenStack/transforms/shorthand2xccdf.xslt
index c25323d..ef6be4b 100644
--- a/OpenStack/transforms/shorthand2xccdf.xslt
+++ b/OpenStack/transforms/shorthand2xccdf.xslt
@@ -16,9 +16,6 @@ exclude-result-prefixes="xccdf xhtml dc">
   <!-- Content:template -->
   <xsl:template match="Benchmark">
     <xsl:copy>
-      <xsl:attribute name="xmlns">
-        <xsl:text>http://checklists.nist.gov/xccdf/1.1</xsl:text>
-      </xsl:attribute>
       <xsl:apply-templates select="@*|node()" />
     </xsl:copy>
   </xsl:template>
diff --git a/RHEVM3/Makefile b/RHEVM3/Makefile
index c5d1c29..9f523ed 100644
--- a/RHEVM3/Makefile
+++ b/RHEVM3/Makefile
@@ -14,7 +14,8 @@ shorthand-guide:
        xmllint --format --output $(OUT)/rhevm3-shorthand.xml $(OUT)/rhevm3-shorthand.xml

 shorthand2xccdf: shorthand-guide
-       xsltproc -o $(OUT)/unlinked-noprofiles-rhevm3-xccdf.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/rhevm3-shorthand.xml
+       xsltproc -o $(OUT)/unlinked-noprofiles-rhevm3-shorthand.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/rhevm3-shorthand.xml
+       xsltproc -o $(OUT)/unlinked-noprofiles-rhevm3-xccdf.xml $(TRANS)/add_xccdf_namespace.xslt $(OUT)/unlinked-noprofiles-rhevm3-shorthand.xml
        xsltproc -stringparam profile "allprofiles" -o $(OUT)/unlinked-rhevm3-xccdf-prerefs.xml \
                $(TRANS)/xccdf-addprofiles.xslt $(OUT)/unlinked-noprofiles-rhevm3-xccdf.xml
        xsltproc -stringparam profile "stig-rhevm3-server" -o $(OUT)/unlinked-rhevm3-xccdf.xml \
diff --git a/RHEVM3/transforms/add_xccdf_namespace.xslt b/RHEVM3/transforms/add_xccdf_namespace.xslt
new file mode 100644
index 0000000..3acd511
--- /dev/null
+++ b/RHEVM3/transforms/add_xccdf_namespace.xslt
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+       <!-- Add the XCCDF 1.1 namespace to all elements without namespace. -->
+       <xsl:template match="node()|@*">
+               <xsl:copy>
+                       <xsl:apply-templates select="node()|@*"/>
+               </xsl:copy>
+       </xsl:template>
+
+       <xsl:template match="*[namespace-uri()='']">
+               <xsl:element name="{local-name()}" namespace="http://checklists.nist.gov/xccdf/1.1">
+                       <xsl:apply-templates select="node()|@*" />
+               </xsl:element>
+       </xsl:template>
+</xsl:stylesheet>
diff --git a/RHEVM3/transforms/shorthand2xccdf.xslt b/RHEVM3/transforms/shorthand2xccdf.xslt
index aa50713..54a0d68 100644
--- a/RHEVM3/transforms/shorthand2xccdf.xslt
+++ b/RHEVM3/transforms/shorthand2xccdf.xslt
@@ -16,9 +16,6 @@ exclude-result-prefixes="xccdf xhtml dc">
   <!-- Content:template -->
   <xsl:template match="Benchmark">
     <xsl:copy>
-      <xsl:attribute name="xmlns">
-        <xsl:text>http://checklists.nist.gov/xccdf/1.1</xsl:text>
-      </xsl:attribute>
       <xsl:apply-templates select="@*|node()" />
     </xsl:copy>
   </xsl:template>
--
1.8.2.1

_______________________________________________
scap-security-guide mailing list
scap-security-guide@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide