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

regroup/collate like nodes

Subject: regroup/collate like nodes
From: Ramon Buckland <ramon@xxxxxxxxxxxxxxx>
Date: Mon, 25 Oct 2004 01:43:15 +1000
xslt collate
Hi, 

I've been tackling this for a bit now but I seem
to be going in circles 

Examples are always best 

Given a document
<root>
  <a>
     <b>
        <c>
           <node1>hello</node1>
        </c>
        <d1>foo</d1>
     </b>
  </a>
  <a>
     <b>
        <c>
           <node2>world</node2>
        </c>
        <d2>bar</d2>
     </b>
  </a>
</root>

I need to group/collate the name like nodes such as

<root>
  <a>
     <b>
        <c>
           <node1>hello</node1>
           <node2>world</node2>
        </c>
        <d1>foo</d1>
        <d2>bar</d2>
     </b>
  </a>
</root>

notes...
The node names are not known so it needs to be generic.
The deepest child node is guaranteed to be unique for it's full
path .. ie, there will only be one
a/b/c/node1
but there could just easily be 
a/b/x/node1

I can see I need to walk the tree recursivley and
for each node, select/copy all other nodes that match the same
parent path and copy them in, but, also have a check that
stops it walking down a path, matched by name, that it has already done.

:-) just can't translate that to XSL..

any help would be appreciated
cheers
ramon

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.