Subject: RE: hierarchical sorting problem
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Wed, 8 Oct 2003 00:46:12 +0100
|
Hi
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Andy_Freeman@xxxxxx
> Sent: Monday, October 06, 2003 8:09 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: hierarchical sorting problem
>
>
> I am trying to sort an XML document by a variety of different
> attributes. Here is an example of the source document:
>
(...)
>
> I need to sort by the Product ActionCode attribute at either
> level to produce the following output:
>
(...)
>
> I also need to sort by the Product|Group MaterialNumber
> attribute to produce the following output:
>
Try this:
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates>
<xsl:sort select="@ActionCode"/>
<xsl:sort select="@MaterialNumber" data-type="number"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
This it's a version of the identity transform. You copy the current
element and apply-templates in sorted order
Regards,
Americo Albuquerque
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|