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

How to sort?

Subject: How to sort?
From: Mike G <row.filter@xxxxxxxxx>
Date: Thu, 14 Oct 2004 10:06:35 +0200
i href
Hi, 

I have following XML:

input XML

<?xml version="1.0"?>
<Documents>
       <Document title="1" chapter="i" href="file1.xml" filter="food">
               <Article title="1.1" info="sub" filter="drink" state="1"/>
               <Article title="1.2" info="main" filter="food" state="3"/>
	<Article title="1.3" info="main" filter="drink" state="2"/>
       </Document>
       <Document title="2" chapter="ii" href="file2.xml" filter="drink">
               <Article title="2.1" info="main" filter="drink" state="1"/>
               <Article title="2.1" info="sub" filter="drink" state="3"/>
               <Article title="2.2" info="main" filter="food" state="2"/>
       </Document>
       <Document title="3" chapter="1" href="file2.xml" filter="">
               <Article title="3.1" info="sub" filter="drink" state=""/>
               <Article title="3.2" info="child" filter="" state="8"/>
       </Document>
       <Document title="4" chapter="2" href="file2.xml" filter="">
               <Article title="3.1" info="sub" filter="drink" state=""/>
               <Article title="3.2" info="main" filter="food" state="1"/>
       </Document>
</Documents>


I want pick only Article elements where attribute info="main"

info-attribute is not located on the Document level, only on Article level,
so when info="main" located it should be placed in the same
originating Document node
wheter info-atribute is located on Document level or not.

I need to order output XML by Chapter, chapter-attribute, on
Document-level. (i,ii,1,2 ... n)

Then I need to sort the output on Article level by state, ascending.

the output XML should look like this


<?xml version="1.0"?>

<Document title="1" chapter="i" href="file1.xml" filter="food">
	<Article title="1.3" info="main" filter="drink" state="2"/>
	<Article title="1.2" info="main" filter="food" state="3"/>
</Document>

<Document title="2" chapter="ii" href="file2.xml" filter="drink">
    <Article title="2.1" info="main" filter="drink" state="1"/>
    <Article title="2.2" info="main" filter="food" state="2"/>
</Document>

<Document title="4" chapter="2" href="file2.xml" filter="">
	<Article title="3.2" info="main" filter="food" state="1"/>
</Document>


-Mike

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.