FrozenGrapes
Programmer
I have an XML file that looks like this:
I am trying to come up with a way to format it like this using XSLT:
I have tried a number of things like using for-each loops that compare the current name to the following-sibling and proceeding with that, however i run into problems when there are multiple, multiple instances. Ex. It works fine if there are multiple instances of ONLY C, but if there are multiples of C AND D, then my code will print out something like this:
This is because of the for-each loop going through ALL the elements even after its done what I want.
IMPORTANT:
For this I CANNOT specify C or D specifically. The paths have to be relative axes and generic enough to use for any multiples because these documents have as many as 30-50 multiples and uniquely specifying each one is not what I want.
If anyone can offer up ideas to help me with this it would be much appreciated.
Thanks.
Code:
<A>
<B.../>
<C.../>
<C.../>
<C.../>
<D.../>
<D.../>
</A>
I am trying to come up with a way to format it like this using XSLT:
Code:
<A>
<B.../>
<C.../>
<D.../>
</A>
I have tried a number of things like using for-each loops that compare the current name to the following-sibling and proceeding with that, however i run into problems when there are multiple, multiple instances. Ex. It works fine if there are multiple instances of ONLY C, but if there are multiples of C AND D, then my code will print out something like this:
Code:
<A>
<B.../>
<C...><D...></C></D>
</A>
This is because of the for-each loop going through ALL the elements even after its done what I want.
IMPORTANT:
For this I CANNOT specify C or D specifically. The paths have to be relative axes and generic enough to use for any multiples because these documents have as many as 30-50 multiples and uniquely specifying each one is not what I want.
If anyone can offer up ideas to help me with this it would be much appreciated.
Thanks.