I use XSLT as a "code generator" for various components, including other XSLT. For example, I have a query that produces an XML output of MSSQL sys.columns rows for a table, and wish to produce an XSLT that includes a table with a column for each row.
So I want to produce the following XSLT:
<xsl:stylesheet version="1.0" xmlns:format="urn:qbo3-formatting" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
</xsl:stylesheet>
I generate the XSLT above with something like this 'generator' XSLT:
<xsl:element name="xsl:stylesheet">
<xsl:attribute name="version">1.0</xsl:attribute>
<xsl:attribute name="format" namespace="http://www.w3.org/XML/1998/namespace" >urn:qbo3-formatting</xsl:attribute>
...
</xsl:element>
The problem is that this 'generator' XSLT produces:
<xsl:stylesheet version="1.0" xml:format="urn:qbo3-formatting" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
</xsl:stylesheet>
Note the xml:format instead of the desired xmlns:format.
According to W3C, 'xmlns' is reserved and bound to 'http://www.w3.org/2000/xmlns/'. If I attempt to create the format attribute above using this namespace, I get an error:
Elements and attributes cannot belong to the reserved namespace 'http://www.w3.org/2000/xmlns/'.
Any suggestions on a work-around?
Thanks in advance,
Eric