This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: XSl, sorting, namespaces and data-types, a problem?


In XML the order of attribute is defined as immaterial. According to the
XML specification (http://www.w3.org/TR/REC-xml#sec-starttags), "Note
that the order of attribute specifications in a start-tag or
empty-element tag is not significant."

That means that you would be ill-advised to depend on attribute order
for any XML processing, either in an XSLT transform or whatever consumes
the resulting document. Where order is important you need to use
elements not attributes. This is fundamental to XML, upon which XSLT is
built.

So even if you found a way to control attribute order in an XSLT
processor, you would not want to rely on such a mechanism.

Cheers,
Stuart

-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Ernst
Wolthaus
Sent: Monday, May 06, 2002 06:02
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] XSl, sorting, namespaces and data-types, a problem?

Addition to my previous post:

I think I discovered the problem:
When the XSL transforms my XML, the type-info gets reversed like this:

<intNumber dt:dt="i4"
xmlns:dt="urn:schemas-microsoft-com:datatypes">4</intNumber>

But how can I change the XSL so that the attribute order doesn't get
changed?

Thanks,
Ernst Wolthaus

-----Original Message-----
From: Ernst Wolthaus [mailto:ernst.wolthaus@cmg.nl] 
Sent: maandag 6 mei 2002 14:39
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] XSl, sorting, namespaces and data-types, a problem?


Hi there,

I'm using the following xsl:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:param name="sortorder" select="'descending'"/>
<xsl:param name="sortfield" select="'xxx'"/>

<xsl:template match="*|text()|@*">
	<xsl:copy>
		<xsl:apply-templates select="*|text()|@*"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="root">
	<xsl:copy>
		<xsl:apply-templates select="@*"/>
		<xsl:apply-templates select="data">
			<xsl:sort select="*[name()=$sortfield]"
order="{$sortorder}" />
		</xsl:apply-templates>
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>

And I'm using the following XML:

<?xml version="1.0"?>
<root>
 <data>
  <intNumber xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="i4">0</intNumber>
  <strName/>
 </data>
 <data>
  <intNumber xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="i4">1</intNumber>
  <strName>strName 1</strName>
 </data>
 <data>
  <intNumber xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="i4">2</intNumber>
  <strName>strName 2</strName>
 </data>
 <data>
  <intNumber xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="i4">3</intNumber>
  <strName>strName 3</strName>
 </data>
</root>

Now here's my problem:
When I strip away the type info, the XSL sorting works fine. When I add
the
type-info, I seem to "loose" the content. I've added this XML to a
HTML-table as a data island. intNumber is not displayed, the cells stay
empty, strName is displayed as should be. What's happening?

Greetz,
Ernst Wolthaus


__________________________ 
CMG Trade, Transport & Industry B.V.
Microsoft Web Development
Kralingseweg 241-249, 3062 CE ROTTERDAM
Postbus 8566, 3009 AN  ROTTERDAM
Phone:   (010) 253 7000
Fax:       (010) 253 7021
E-mail:   mailto:ernst.wolthaus@cmg.nl
 
The Information contained in this E-mail and its attachments is
confidential
and may be legally privileged. It is intended solely for the use of the
individual or entity to whom it is addressed and others authorised to
receive it. If you are not the intended recipient you are hereby
notified
that any disclosure, copying, distribution or taking any actions in
reliance
of the contents of this E-mail and any attachments is strictly
prohibited
and may be unlawful. CMG is neither liable for the proper and complete
transmission of the information contained in this E-mail and any
attachments
nor for any delay in its receipt. If received in error, please contact
CMG
on +31 (0)20 50 33 000 quoting the name of the sender and the addressee
and
then delete it from your system. Please note that CMG does not accept
any
responsibility for viruses and it is your responsibility to scan the
Email
and attachments (if any). No contracts may be concluded on behalf of CMG
by
means of E-mail communications. 

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

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]