Gary,
There is something about namespaces I have missunderstood, and the documentation
for doing this stuff (in java) is practically non-existent (or very well hidden).
Forgive me for my ignorance, but, syntactically, what is the :
namespaceURI
qualifiedName
value
required for setAttributeNS ?
This code produces the right XML file (when printed out)..........
Element xslRoot = (Element) stylesheet.createElementNS("test", "xsl:stylesheet");
xslRoot.setAttributeNS( "test", "version", "1.0");
xslRoot.setAttributeNS( "test", "xmlns:xsl",
"http://www.w3.org/1999/XSL/Transform" );
stylesheet.appendChild( xslRoot );
but still gives me an "attibute: version" is missing error.
etienne.
> Etienne --
>
> This is not correct because you are not putting these elements into a
> namespace. You need to use createElementNS to create an element in the
> namespace.
>
> Gary
>
> Etienne Deleflie wrote:
> >
> > Hi,
> >
> > more on this dynamic XSL DOM document creation. Perhaps I am not creating the
> > DOM document correctly (even though it prints out correctly)
> >
> > ........... I am setting both the attributes of the root node (version and
> > xmlns:xsl)
> >
> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >
> > by doing the following
> >
> > // make a root node for the xml Document
> > Element root = (Element) document.createElement("page");
> > document.appendChild(root);
> >
> > // namespace and version
> > Element xslRoot = (Element) stylesheet.createElement("xsl:stylesheet");
> > xslRoot.setAttribute("version", "1.0");
> > xslRoot.setAttribute("xmlns:xsl", "http://www.w3.org/1999/XSL/Transform");
> >
> > does this seem correct ?
> >
> > etienne