|
Subject: [xsl] hierarchical sorting problem From: Andy_Freeman@xxxxxx Date: Mon, 6 Oct 2003 15:08:46 -0400 |
I am trying to sort an XML document by a variety of different attributes.
Here is an example of the source document:
<Result>
<Product MaterialNumber="494728" Team="ENJ" ActionCode="C1" />
<Group MaterialNumber="376050" Team="RMT">
<Product MaterialNumber="376050" Team="RMT" ActionCode="A1" />
<Product MaterialNumber="376009" Team="RMT" ActionCode="D4" />
</Group>
<Product MaterialNumber="70133" ActionCode="" />
<Group MaterialNumber="75050" Team="RKL">
<Product MaterialNumber="75050" Team="RKL" ActionCode="J0" />
<Product MaterialNumber="76009" Team="RKL" ActionCode="A0" />
</Group>
<Product MaterialNumber="70309" Team="DDE" ActionCode="A5" />
<Group MaterialNumber="75051" Team="RKP">
<Product MaterialNumber="75051" Team="RKP" ActionCode="J1" />
<Product MaterialNumber="76109" Team="RKP" ActionCode="A4" />
</Group>
</Result>
I need to sort by the Product ActionCode attribute at either level to
produce the following output:
<Result>
<Product MaterialNumber="70133" ActionCode="" />
<Group MaterialNumber="75050" Team="RKL">
<Product MaterialNumber="76009" Team="RKL" ActionCode="A0" />
<Product MaterialNumber="75050" Team="RKL" ActionCode="J0" />
</Group>
<Group MaterialNumber="376050" Team="RMT">
<Product MaterialNumber="376050" Team="RMT" ActionCode="A1" />
<Product MaterialNumber="376009" Team="RMT" ActionCode="D4" />
</Group>
<Group MaterialNumber="75051" Team="RKP">
<Product MaterialNumber="76109" Team="RKP" ActionCode="A4" />
<Product MaterialNumber="75051" Team="RKP" ActionCode="J1" />
</Group>
<Product MaterialNumber="70309" Team="DDE" ActionCode="A5" />
<Product MaterialNumber="494728" Team="ENJ" ActionCode="C1" />
</Result>
I also need to sort by the Product|Group MaterialNumber attribute to
produce the following output:
<Result>
<Product MaterialNumber="70133" ActionCode="" />
<Product MaterialNumber="70309" Team="DDE" ActionCode="A5" />
<Group MaterialNumber="75050" Team="RKL">
<Product MaterialNumber="75050" Team="RKL" ActionCode="J0" />
<Product MaterialNumber="76009" Team="RKL" ActionCode="A0" />
</Group>
<Group MaterialNumber="75051" Team="RKP">
<Product MaterialNumber="75051" Team="RKP" ActionCode="J1" />
<Product MaterialNumber="76109" Team="RKP" ActionCode="A4" />
</Group>
<Group MaterialNumber="376050" Team="RMT">
<Product MaterialNumber="376009" Team="RMT" ActionCode="D4" />
<Product MaterialNumber="376050" Team="RMT" ActionCode="A1" />
</Group>
<Product MaterialNumber="494728" Team="ENJ" ActionCode="C1" />
</Result>
Note: The example I have shown only has two children per group. The live
data for this document can have an unlimited number of children.
TIA,
Andy
**********************************************************************
This message is intended only for the designated recipient(s). It may
contain confidential or proprietary information and may be subject to
the attorney-client privilege or other confidentiality protections.
If you are not a designated recipient, you may not review, use, copy
or distribute this message. If you receive this in error, please
notify the sender by reply e-mail and delete this message. Thank you.
***********************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] gain data from multiple x, Passin, Tom | Thread | Re: [xsl] hierarchical sorting prob, Mukul Gandhi |
| Re: [xsl] xsl Greater than and Less, Benjamin Farrow | Date | Re: XSLT 2.0 dynamically parameteri, Bob Foster |
| Month |