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

Re: Sorting by child element count

Subject: Re: Sorting by child element count
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Wed, 29 Dec 2010 07:39:12 -0800
Re:  Sorting by child element count
Hi Michel,
Good idea if there is no better way. But since there are 400 <Item> elements in the list and hand counting is subject to error, I was hoping to automate the task. However, I can use this solution if no automated method is forthcoming.

-----Original Message----- From: Michel Hendriksen
Sent: Wednesday, December 29, 2010 7:36 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Sorting by child element count

Maybe not the best way but you could copy/preprocess the Item elements
and add an atribute with the number of Data elements. Then sort on the


On Wed, Dec 29, 2010 at 4:21 PM, Mark <mark@xxxxxxxxxxxx> wrote:
Happy new year! Thanks for all the help this list has given me over the past
two years. My question:

I have an XML document that looks like the listing below. I want to sort the
<List> by <Item> so that all the <Items> with one <Data> element are
followed by all the <Items> with two <Data> elements, and so on, until the
last <Items> in the output list have the most <Data> elements. The <Data>
elements have to remain inside their original parent <Item>.

No clue how to begin. Can you point me in the right direction?


          ... <!possibly 1 to 10 or so <Data> elements in each parent
<Item> element.
   ... <!400 <Item> elements in the <List> >

Current Thread


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.
First Name
Last Name
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.