[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Nested list, from flat to structure
Subject: Re: Nested list, from flat to structure
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 08 Feb 2011 15:49:24 +0100
|
Kjellaug Johansen wrote:
I have this input-XML:
<lnum1>list 1 A</lnum1>
<lp1>list 1 A paragraph</lp1>
<lnum1>list 1 B</lnum1>
<lnum2>list 2 A</lnum2>
<lnum2>list 2 B</lnum2>
<lp2>list 2 paragraph</lp2>
<lnum2>list 2 C</lnum2>
<lnum1>list 1 C</lnum1>
Is lnum1 and lnum2 all there can be or could there be an arbitrary depth
(e.g. lnum3, lnum4) you need to handle?
And I want this output:
<list
<point>
<p>list 1 A</p>
<p>list 1 A paragraph</p>
</point>
<point>
<p>list 1 B</p>
<list>
<point>
<p>list 2 A</p>
</point>
<point>
<p>list 2 B</p>
<p>list 2 paragraph</p>
</point>
<point>
<p>list 2 C</p>
</point>
</list>
</point>
<point>
<p>list 1 C</p>
</point>
</list>
I've tried many different approches. I did come up with a solution for
all the elements starting with 'lnum', it worked well, but the elements
with 'lp' did confuse me. Anyone with an advice or solution?
First question with stuff like that is whether you want to use XSLT 2.0
or 1.0?
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|