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]

RE: sorting by date


btw, applying the following stylesheet to the Daniel's xml source I got
some bizarre output in msxml3:

xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:template match="Items">
		<Items>
			<xsl:for-each select="Item">
				<xsl:sort select="concat(substring(Date, 5, 4), substring(Date, 3, 2),
substring(Date, 1, 2))" order="descending"/>
				<xsl:copy-of select="."/>
			</xsl:for-each>
		</Items>
	</xsl:template>
	<xsl:template match="text()"/>
</xsl:stylesheet>

output:
<Items>
	<Item id="8">
		<Date>17042000</Date>
	</Item>
	<Item id="3">
		<Date>22121999</Date>
	</Item>
	<Item id="2">
		<Date>07071999</Date>
	</Item>
	<Item id="9">
		<Date>11011999</Date>
	</Item>
	<Item id="7">
		<Date>02111998</Date>
	</Item>
	<Item id="6">
		<Date>02111998</Date>
	</Item>
	<Item id="5">
		<Date>02111998</Date>
	</Item>
	<Item id="4">
		<Date>02111998</Date>
	</Item>
	<Item id="1">
		<Date>02111998</Date>
	</Item>
	<Item id="10">
		<Date>10071998</Date>
	</Item>
</Items>

It seems to me that all Item elements with identical Date's value are sorted
in reverse document order despite of XSLT spec. Is it my fault or just
another
msxml feature ?

---
Oleg Tkachenko
Multiconn International


 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]