xsl-list
[Top] [All Lists]

RE: hierarchical sorting problem

2003-10-07 16:46:12
Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Andy_Freeman(_at_)bd(_dot_)com
Sent: Monday, October 06, 2003 8:09 PM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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



<Prev in Thread] Current Thread [Next in Thread>