Hi Folks -
I'm trying to get my head around sorting in XSL but I'm obviously doing something wrong. I've looked at a BUNCH of examples in books as well as on the web to no avail. I have the following sample XML document with 3 identifiers that need to be sorted in descending order as though they were numeric:
Code:
<OrderResponse xmlns="urn:cidx:names:specification:ces:schema:all:5:0" Version="5.0">
<ResponseStatus>
<ResponseStatusReasonIdentifier Agency="RAPIDResponseRejectionTable">091</ResponseStatusReasonIdentifier>
<ResponseStatusReasonDescription></ResponseStatusReasonDescription>
</ResponseStatus>
<ResponseStatus>
<ResponseStatusReasonIdentifier Agency="RAPIDResponseRejectionTable">092</ResponseStatusReasonIdentifier>
<ResponseStatusReasonDescription></ResponseStatusReasonDescription>
</ResponseStatus>
<ResponseStatus>
<ResponseStatusReasonIdentifier Agency="RAPIDResponseRejectionTable">099</ResponseStatusReasonIdentifier>
<ResponseStatusReasonDescription></ResponseStatusReasonDescription>
</ResponseStatus>
</OrderResponse>
My stylesheet is the following:
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="OrderResponse">
<xsl:for-each select="ResponseStatus">
<xsl:sort select="ResponseStatusReasonIdentifier" data-type="number" order="descending"/>
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
What I expected to happen was for the transformation to output 099,092,091 - what I get is 091,092,099 which is document order. What have I screwed up?
Thanks!