Re: [xsl] Selecting namespaces

Subject: Re: [xsl] Selecting namespaces
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2003 13:16:43 +0000

> The result that i wrote was:
> <xsd:schema xmlns:xsd="";
> targetNamespace="currentDocument" xmlns:cd="currentDocument"
> elementFormDefault="qualified">
> But i got (using XSLT):
> <xsd:schema xmlns:xsd="";
> targetNamespace="currentDocument" elementFormDefault="qualified"
> xmlns:cd="currentDocument">
> I want the attribute (elementFormDefault) to appear at last position
> of the schema attributes.
> what should i have to do?

If you definitely, absolutely, uncomprimisingly *have* to have the
elementFormDefault attribute appear last in the <xsd:schema> element's
start tag, then you should start using a language that constructs
serialized XML rather than one that constructs logical XML.

In XML, the order of attributes within a tag makes absolutely no
difference to any application that reads the tag. As far as any XML
parser is concerned, the two start tags that you give above are
exactly the same. So from an XML application's point of view,
insisting on a particular ordering for attributes is completely

XSLT is an XML application, and assumes that the XML it generates will
be read by XML applications. So there's nothing in XSLT that will
allow you to create an element whose attributes appear in a particular

Thus, if you want the attributes to appear in a particular order, you
have to construct the serialized XML document that you want as a
string. You *could* do this with XSLT, but only by setting the output
method to 'text', and doing away with all the nice XML-generating
features that XSLT gives you (for example, ensuring that the XML you
generate is well-formed). I really wouldn't recommend doing it.



Jeni Tennison

 XSL-List info and archive:

Current Thread