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

flat tree to expanded tree

Subject: flat tree to expanded tree
From: "bix xslt" <bix_xslt@xxxxxxxxxxx>
Date: Thu, 12 Dec 2002 22:04:36 +0000
flat tree
All,

I am working on a grouping problem that I have been placed in charge of.
From the list I've gathered that I more than likely need to use Steve
Muench's algorithm to quickly and effectively sort my somewhat complex list. However, I'm at a loss as to how to procede.

I've included the DTD and a sample XML for the problem at hand, however I feel that I should explain why this is more complex than a simple sort. In addition to sorting each of the 'proc' elements by alphabetizing, I would also like to sort by creating a collapsable tree. In addition, I am expecting my xml tree to be scattered across several files.

The 'proc' element includes two additional elements: 'exec' and 'dpnd'.

The 'dpnd' implies that there is an additional dependency on the 'proc' element. In other words, when I group the list, I need to include those items within the 'dpnd' prior to the 'proc' element that includes it.

The 'exec' has a type attribute associated with it which implies that either the list may have ('a') any order or ('i') the order has been specified explicitly.

Finally, the 'proc' element has a type attribute that states that the items within the 'exec' list might be interleaved ('r') with any other list (i.e. a dependency) or must be listed within that order ('e').

A quick DTD:

<!ELEMENT list (proc)*>
<!ELEMENT proc (exec|dpnd)*>
<!ELEMENT exec (item)*>
<!ELEMENT dpnd (item)*>
<!ELEMENT item EMPTY>

<!ATTLIST list
   mode CDATA #IMPLIED


<!ATTLIST proc id ID #REQUIRED type (r|e) 'r'


<!ATTLIST exec type (i|a) 'i'


<!ATTLIST item idr IDREF #REQUIRED


And a small xml listing to clarify the complexities:


-- file 1 --
<list mode="normal">
   <proc id="a" />
</list>

-- file 2 --
<list mode="normal">
   <proc type="r" id="b">
       <exec type="a">
           <item idr="c" />
           <item idr="d" />
       </exec>
   </proc>

   <proc type="e" id="c">
       <dpnd>
           <item idr="a" />
       </dpnd>
       <exec type="a">
           <item idr="e" />
           <item idr="f" />
       </exec>
   </proc>
</list>

-- file 3 --
<list mode="normal">
   <proc id="d">
       <dpnd>
           <item idr="g" />
       </dpnd>
   </proc>
</list>

-- file 4 --
<list mode="normal">
   <proc id="e" />
   <proc id="f" />

   <proc id="g" />
</list>


So as an output, I might have: 1) an alphabetical listing: a b c d e f g

2) a hierarchical listing (simply creating an expandable tree):

a
b
d
c
 e
 f
g

3a) an execution listing (this can be an expandable tree - preferred):
b
g
d
a
c
 e
 f

3b) an execution listing (flat list - acceptable):
b
g
d
a
c
e
f

I honestly don't know where to begin, so if any of you have references or small samples of xsl I can hack up that would be great!

Thanks,
Bix

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus



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.