<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"><<a href="mailto:isimluk@fedoraproject.org" target="_blank">isimluk@fedoraproject.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Simon Lukasik <<a href="mailto:slukasik@redhat.com">slukasik@redhat.com</a>><br>
<br>
Previously, the xccdf namespace has been added to the shorthand<br>
document by <xsl:attribute>. Newer libxml releases are more strict<br>
and do not allow attributes named "xmlns". 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 'xmlns' 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 "allprofiles" -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>
+<?xml version="1.0"?><br>
+<xsl:stylesheet version="1.0" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" target="_blank">http://www.w3.org/1999/XSL/Transform</a>"><br>
+ <!-- Add the XCCDF 1.1 namespace to all elements without namespace. --><br>
+ <xsl:template match="node()|@*"><br>
+ <xsl:copy><br>
+ <xsl:apply-templates select="node()|@*"/><br>
+ </xsl:copy><br>
+ </xsl:template><br>
+<br>
+ <xsl:template match="*[namespace-uri()='']"><br>
+ <xsl:element name="{local-name()}" namespace="<a href="http://checklists.nist.gov/xccdf/1.1" target="_blank">http://checklists.nist.gov/xccdf/1.1</a>"><br>
+ <xsl:apply-templates select="node()|@*" /><br>
+ </xsl:element><br>
+ </xsl:template><br>
+</xsl:stylesheet><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="xccdf xhtml dc"><br>
<!-- Content:template --><br>
<xsl:template match="Benchmark"><br>
<xsl:copy><br>
- <xsl:attribute name="xmlns"><br>
- <xsl:text><a href="http://checklists.nist.gov/xccdf/1.1" target="_blank">http://checklists.nist.gov/xccdf/1.1</a></xsl:text><br>
- </xsl:attribute><br>
<xsl:apply-templates select="@*|node()" /><br>
</xsl:copy><br>
</xsl:template><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>