This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

XSLT for unflattening a tree?


Hi all,

I've been working with a series of XML documents that effectively represent
"flattened" trees. Instead of using nested elements for each level of the tree,
they use empty header elements that indicate the tree level:

        <h1/>
            <h2/>
                <content .../>
                <h3/>
                    <content .../>
                <h3/>
                    <content .../>
            <h2/>
                  ...
         <h1/>
                 ...

My question is what would be involved in using XSLT to convert that
structure to a nested element structure:

           <h1>
               <h2>
                   <content .../>
                   <h3>
                        <content .../>
                   </h3>
                    <h3>
                          ...
                    </h3>
                ...
               </h2>
            </h1>

In one sense I'd like to maintain a stack of levels, but that's not necessarily
the XSLT "way".  Am I barking up the wrong tree to do this kind of thing
in XSLT?

Cheers,

Stu


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]