<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#cccccc" text="#000000">
Martijn,<br>
I'm not as expert in XML as those who usually answer this list, but
since it's been several hours, I'll take a shot. Someone please correct
me if I'm wrong.<br>
<br>
1) IIRC, identifiers starting with the letters "xml" are reserved...
including namespace prefixes. (See
<a class="moz-txt-link-freetext" href="http://www.w3.org/TR/REC-xml/#sec-common-syn">http://www.w3.org/TR/REC-xml/#sec-common-syn</a>). Thus XML tools may be
(silently?) rejecting your requested namespace prefix "xml". The good
news is that the problem should disappear if you choose a namespace
prefix that doesn't start with "xml".<br>
<br>
2) Traditionally, order of attributes in XML is not significant.
Generally, XML tools do not recognize or preserve an ordering. If there
is an option in XSLT 2.0 to specify the ordering of attributes on
output, I don't know about it. Sorry this is not good news. But the
bright side is that whatever processes are downstream should not care
about the order of attributes in the output of the stylesheet. Unless
they're humans.<br>
<br>
Lars<br>
<br>
<br>
<br>
On 5/25/2010 8:58 AM, Martijn Van der Graaff wrote:
<blockquote
 cite="mid:09086DB775E8EA4FB324AED852B397E8FCA84701@PSCMAIL03.bedford.progress.com"
 type="cite">
  <pre wrap="">Hi 

I need to generate a root element in a output file that contains some attributes and namespaces.

It should like this:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;enfinity xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impexcatalog.xsdhttp://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dtdt.xsd">"http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt dt.xsd"</a>
          xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
          xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex">"http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex"</a>
          xmlns:xml=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/XML/1998/namespace">"http://www.w3.org/XML/1998/namespace"</a>
          xmlns:dt=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt">"http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt"</a>
          major="6"
          minor="1"
          family="enfinity"
          branch="enterprise"
          build="6.3.1.2.5"&gt;

what I get is this:

&lt;enfinity xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
          xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex">"http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex"</a>
          xmlns:dt=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt">"http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt"</a>
          xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impexcatalog.xsdhttp://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dtdt.xsd">"http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt dt.xsd"</a>
          major="6"
          minor="1"
          family="enfinity"
          branch="enterprise"
          build="6.3.1.2.5"&gt;

How can I force in XSLT that (xmlns:xml=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/XML/1998/namespace">"http://www.w3.org/XML/1998/namespace"</a>) is always added to the root element and how can I force on where the attributes are sorted. 

My xslt snippet is:

&lt;xsl:template match="/"...
  &lt;xsl:element name="enfinity" namespace=<a class="moz-txt-link-rfc2396E" href="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex">"http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex"</a>&gt;
            &lt;xsl:attribute name="xsi:schemaLocation"&gt;<a class="moz-txt-link-freetext" href="http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impex">http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impex</a> catalog.xsd <a class="moz-txt-link-freetext" href="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt">http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt</a> dt.xsd&lt;/xsl:attribute&gt;
            &lt;xsl:namespace name="xsi"&gt;<a class="moz-txt-link-freetext" href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&lt;/xsl:namespace&gt;
            &lt;xsl:namespace name=""&gt;<a class="moz-txt-link-freetext" href="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex">http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex</a>&lt;/xsl:namespace&gt;
            &lt;xsl:namespace name="xml"&gt;<a class="moz-txt-link-freetext" href="http://www.w3.org/XML/1998/namespace">http://www.w3.org/XML/1998/namespace</a>&lt;/xsl:namespace&gt;
            &lt;xsl:namespace name="dt"&gt;<a class="moz-txt-link-freetext" href="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt">http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt</a>&lt;/xsl:namespace&gt;
            &lt;xsl:attribute name="major" select="$major"/&gt;
            &lt;xsl:attribute name="minor" select="$minor"/&gt;
            &lt;xsl:attribute name="family" select="$family"/&gt;
            &lt;xsl:attribute name="branch" select="$branch"/&gt;
            &lt;xsl:attribute name="build" select="$build"/&gt;


Yours,

Martijn
_______________________________________________
oXygen-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:oXygen-user@oxygenxml.com">oXygen-user@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com/mailman/listinfo/oxygen-user">http://www.oxygenxml.com/mailman/listinfo/oxygen-user</a>

  </pre>
</blockquote>
<br>
</body>
</html>