[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: hierarchical sorting problem

Subject: RE: hierarchical sorting problem
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Wed, 8 Oct 2003 00:46:12 +0100
hierarchical sort
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.