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

Convert sequence of elements to nested structure

Subject: Convert sequence of elements to nested structure
From: Rowan Bradley <rowan.bradley@xxxxxxxxxxxxxxxx>
Date: Fri, 24 Dec 2004 08:56:57 -0000
convert sequence
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

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

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-2007 All Rights Reserved.