Subject: [xsl] Merging nested/adjacent nodes From: chris <oneskiingfool@xxxxxxxxx> Date: Thu, 19 May 2005 14:42:56 -0600 |
Hello, I'm really stuck on this one. It's probably a little too offbeat for someone to just have the code handy ready to copy & paste.... but I I'll give it a shot as I've already spent way too much time spinning my wheels on it ;) I basically want to merge adjacent nodes on a given attribute. It originally seemed would be simple enough to do with using for-each-group and group-adjacent. But the fact that I have mixed nodes in there seems to screw that whole thing up. --------------------------------------------------------------- Here's an example of a source doc..... --------------------------------------------------------------- <employees> <supervisor name="jimmy"> <supervisor name="bob"> <employee name="grunt_1"/> </supervisor> </supervisor> <supervisor name="jimmy"> <supervisor name="bob"> <employee name="grunt_2"/> </supervisor> </supervisor> <supervisor name="jimmy"> <employee name="grunt_3"/> </supervisor> <employee name="grunt_4"/> <supervisor name="jimmy"> <supervisor name="bob"> <employee name="grunt_5"/> </supervisor> </supervisor> </employees> --------------------------------------------------------------- .... and here's what I would want to transform the source doc into..... --------------------------------------------------------------- <employees> <supervisor name="jimmy"> <supervisor name="bob"> <employee name="grunt_1"/> <employee name="grunt_2"/> </supervisor> <employee name="grunt_3"/> </supervisor> <employee name="grunt_4"/> <supervisor name="jimmy"> <supervisor name="bob"> <employee name="grunt_5"/> </supervisor> </supervisor> </employees> --------------------------------------------------------------- The order must be maintained and notice that the last 'supervisor' node is not merged with the others of the same name because they're not adjacent. I'm using XSLT 2.0. Any pointers would be MUCH appreciated. Thanks!
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How can I use relative re, Aron Bock | Thread | RE: [xsl] Merging nested/adjacent n, Aron Bock |
Re: [xsl] nested for-each to create, Rudolf P . Weinmann | Date | RE: [xsl] Merging nested/adjacent n, Aron Bock |
Month |