xsl-list
[Top] [All Lists]

Re: Selecting namespaces

2003-10-30 06:16:43
Hi,

The result that i wrote was:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
targetNamespace="currentDocument" xmlns:cd="currentDocument"
elementFormDefault="qualified">

But i got (using XSLT):
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
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
unnecessary.

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
order.

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.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>