xsl-list
[Top] [All Lists]

[xsl] RE: Nested list, from flat to structure

2011-02-08 09:20:16
Additional info on this issue: I use XSL version 1.0 and the total
number of levels in the list is unknown. 

Kjellaug Johansen

-----Opprinnelig melding-----
Fra: Kjellaug Johansen 
Sendt: 8. februar 2011 15:39
Til: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Emne: Nested list, from flat to structure

Hi. 
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>
 
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? 

Kjellaug Johansen.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>