[xsl] Convert sequence of elements to nested structure

Subject: [xsl] Convert sequence of elements to nested structure
From: Rowan Bradley <rowan.bradley@xxxxxxxxxxxxxxxx>
Date: Fri, 24 Dec 2004 08:56:57 -0000
Hi,

This is no doubt an elementary question but I need to convert a sequence 
of elements of the same name like this:

<a>content1</a>
<note>content2</note>
<note>content3</note>
<note>content4</note>
<b>content5</b>

into a nested structure like this:

<a>content1</a>
<note>content2
     <cont>content3</cont>
     <cont>content4</cont>
</note>
<b>content5</b>

In other words, if there are consecutive <note> elements, they should be 
combined into one <note> element with the 2nd, 3rd and subsequent lines 
expressed as <cont> (continuation line) elements within the <note> element.

I can't quite see how to do this by recursion.

Thanks for your help

Rowan

Current Thread