On 01/30/2013 07:36 PM, Gary Gapinski wrote: > On 01/30/2013 12:49 PM, Gary Gapinski wrote: >> I agree. There is nothing wrong with the usage. >> > > I was wrong. > > See https://mail.gnome.org/archives/xslt/2012-September/msg00002.html > and > https://mail.gnome.org/archives/commits-list/2012-September/msg02486.html. > > http://www.w3.org/TR/xslt#creating-attributes prohibits this. > > http://www.w3.org/TR/xslt20/#creating-attributes says the same thing (I > think), though with a lot more words. > > Saxon 9 throws the same error. > > The following avoids the error (however, the resulting file does not > validate, but I think that's the case anyway).
It does not validate because it pushes only the <Benchmark> element to the XCCDF namespace. All other elements remain in an empty namespace. There seems to be no simple (XSLT) way how to put all the elements to a given namespace. Basically, each element needs to be refined with the XCCDF namespace. I prefer to do this in a separate XSL transformation (see the last patch, or ticket 202). > > gapinski@gr2186815:~/Projects/scap-security-guide/RHEL6$ git diff > diff --git a/RHEL6/transforms/shorthand2xccdf.xslt > b/RHEL6/transforms/shorthand2xccdf.xslt > index 507238e..59a0b53 100644 > --- a/RHEL6/transforms/shorthand2xccdf.xslt > +++ b/RHEL6/transforms/shorthand2xccdf.xslt > @@ -15,12 +15,9 @@ 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:element name="Benchmark" > namespace="http://checklists.nist.gov/xccdf/1.1"> > <xsl:apply-templates select="@*|node()" /> > - </xsl:copy> > + </xsl:element> > </xsl:template> > > <!-- insert current date --> > gapinski@gr2186815:~/Projects/scap-security-guide/RHEL6$ > > The template becomes just > > <!-- Content:template --> > <xsl:template match="Benchmark"> > <xsl:element name="Benchmark" > namespace="http://checklists.nist.gov/xccdf/1.1"> > <xsl:apply-templates select="@*|node()" /> > </xsl:element> > </xsl:template> > > > > _______________________________________________ > scap-security-guide mailing list > [email protected] > https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide > _______________________________________________ scap-security-guide mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide
