<div dir="ltr">Please push -- thanks!<div><br></div><div style>We could only get away with such abuses of XML for so long :)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 3:27 AM, Simon Lukasik <span dir="ltr">&lt;<a href="mailto:isimluk@fedoraproject.org" target="_blank">isimluk@fedoraproject.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Simon Lukasik &lt;<a href="mailto:slukasik@redhat.com">slukasik@redhat.com</a>&gt;<br>
<br>
Previously, the xccdf namespace has been added to the shorthand<br>
document by &lt;xsl:attribute&gt;. Newer libxml releases are more strict<br>
and do not allow attributes named &quot;xmlns&quot;. Which is explicitly<br>
forbiden by XSLT specification.<br>
<br>
    <a href="http://www.w3.org/TR/xslt#creating-attributes" target="_blank">http://www.w3.org/TR/xslt#creating-attributes</a><br>
<br>
Addressing:<br>
xsltproc -o output/unlinked-noprofiles-rhel6-xccdf.xml transforms/shorthand2xccdf.xslt output/rhel6-shorthand.xml<br>
compilation error: file transforms/shorthand2xccdf.xslt line 19 element attribute<br>
xsl:attribute: The attribute name &#39;xmlns&#39; is not allowed.<br>
make: *** [shorthand2xccdf] Error<br>
---<br>
 RHEL6/Makefile                            |  3 ++-<br>
 RHEL6/transforms/add_xccdf_namespace.xslt | 15 +++++++++++++++<br>
 RHEL6/transforms/shorthand2xccdf.xslt     |  3 ---<br>
 3 files changed, 17 insertions(+), 4 deletions(-)<br>
 create mode 100644 RHEL6/transforms/add_xccdf_namespace.xslt<br>
<br>
diff --git a/RHEL6/Makefile b/RHEL6/Makefile<br>
index 9214ce9..d34b127 100644<br>
--- a/RHEL6/Makefile<br>
+++ b/RHEL6/Makefile<br>
@@ -14,7 +14,8 @@ shorthand-guide:<br>
        xmllint --format --output $(OUT)/rhel6-shorthand.xml $(OUT)/rhel6-shorthand.xml<br>
<br>
 shorthand2xccdf: shorthand-guide<br>
-       xsltproc -o $(OUT)/unlinked-unresolved-noprofiles-rhel6-xccdf.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/rhel6-shorthand.xml<br>
+       xsltproc -o $(OUT)/unlinked-unresolved-noprofiles-rhel6-shorthand.xml $(TRANS)/shorthand2xccdf.xslt $(OUT)/rhel6-shorthand.xml<br>
+       xsltproc -o $(OUT)/unlinked-unresolved-noprofiles-rhel6-xccdf.xml $(TRANS)/add_xccdf_namespace.xslt $(OUT)/unlinked-unresolved-noprofiles-rhel6-shorthand.xml<br>
        xsltproc -stringparam profile &quot;allprofiles&quot; -o $(OUT)/unlinked-unresolved-rhel6-xccdf.xml \<br>
                $(TRANS)/xccdf-addprofiles.xslt $(OUT)/unlinked-unresolved-noprofiles-rhel6-xccdf.xml<br>
        oscap xccdf resolve -o $(OUT)/unlinked-rhel6-xccdf.xml $(OUT)/unlinked-unresolved-rhel6-xccdf.xml<br>
diff --git a/RHEL6/transforms/add_xccdf_namespace.xslt b/RHEL6/transforms/add_xccdf_namespace.xslt<br>
new file mode 100644<br>
index 0000000..3acd511<br>
--- /dev/null<br>
+++ b/RHEL6/transforms/add_xccdf_namespace.xslt<br>
@@ -0,0 +1,15 @@<br>
+&lt;?xml version=&quot;1.0&quot;?&gt;<br>
+&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;<a href="http://www.w3.org/1999/XSL/Transform" target="_blank">http://www.w3.org/1999/XSL/Transform</a>&quot;&gt;<br>
+       &lt;!-- Add the XCCDF 1.1 namespace to all elements without namespace. --&gt;<br>
+       &lt;xsl:template match=&quot;node()|@*&quot;&gt;<br>
+               &lt;xsl:copy&gt;<br>
+                       &lt;xsl:apply-templates select=&quot;node()|@*&quot;/&gt;<br>
+               &lt;/xsl:copy&gt;<br>
+       &lt;/xsl:template&gt;<br>
+<br>
+       &lt;xsl:template match=&quot;*[namespace-uri()=&#39;&#39;]&quot;&gt;<br>
+               &lt;xsl:element name=&quot;{local-name()}&quot; namespace=&quot;<a href="http://checklists.nist.gov/xccdf/1.1" target="_blank">http://checklists.nist.gov/xccdf/1.1</a>&quot;&gt;<br>
+                       &lt;xsl:apply-templates select=&quot;node()|@*&quot; /&gt;<br>
+               &lt;/xsl:element&gt;<br>
+       &lt;/xsl:template&gt;<br>
+&lt;/xsl:stylesheet&gt;<br>
diff --git a/RHEL6/transforms/shorthand2xccdf.xslt b/RHEL6/transforms/shorthand2xccdf.xslt<br>
index 1a849e2..39f6741 100644<br>
--- a/RHEL6/transforms/shorthand2xccdf.xslt<br>
+++ b/RHEL6/transforms/shorthand2xccdf.xslt<br>
@@ -16,9 +16,6 @@ exclude-result-prefixes=&quot;xccdf xhtml dc&quot;&gt;<br>
   &lt;!-- Content:template --&gt;<br>
   &lt;xsl:template match=&quot;Benchmark&quot;&gt;<br>
     &lt;xsl:copy&gt;<br>
-      &lt;xsl:attribute name=&quot;xmlns&quot;&gt;<br>
-        &lt;xsl:text&gt;<a href="http://checklists.nist.gov/xccdf/1.1" target="_blank">http://checklists.nist.gov/xccdf/1.1</a>&lt;/xsl:text&gt;<br>
-      &lt;/xsl:attribute&gt;<br>
       &lt;xsl:apply-templates select=&quot;@*|node()&quot; /&gt;<br>
     &lt;/xsl:copy&gt;<br>
   &lt;/xsl:template&gt;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.2.1<br>
<br>
_______________________________________________<br>
scap-security-guide mailing list<br>
<a href="mailto:scap-security-guide@lists.fedorahosted.org">scap-security-guide@lists.fedorahosted.org</a><br>
<a href="https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide" target="_blank">https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide</a><br>
</font></span></blockquote></div><br></div>