[xsl] nesting non-nested nodes

Subject: [xsl] nesting non-nested nodes
From: Andrew Borsz <andrew@xxxxxxxxxxxxxxx>
Date: Tue, 7 Jun 2005 10:48:49 -0400
Hello all,
I searched the archives for an answer to this, but I'm not sure how best to describe what I'm looking for. Sorry if this question has been asked previously. I'm trying to take non-nested nodes and get them nested. I'm using XSL version 1.0 and my processor is Libxslt.


SOURCE:

<head head-level="1">
head title
</head>
<p>
paragraph(s)
</p>
<head head-level="2">
sub-head title
</head>
<p>
paragraph(s)
</p>
<head head-level="2">
sub-head title
</head>
<p>
paragraph(s)
</p>
<head head-level="3">
sub-sub-head title
</head>
<p>
paragraph(s)
</p>
<head head-level="1">
head title
</head>
<p>
For simplicity, I've reduced any amount of content in between head's to a single p.
</p>



DESIRED RESULT:


<level>
<title>
head title
</title>
<p>
paragraph(s)
</p>
<level>
<title>
sub-head title
</title>
<p>
paragraph(s)
</p>
</level>
<level>
<title>
sub-head title
</title>
<p>
paragraph(s)
</p>
<level>
<title>
sub-sub-head title
</title>
<p>
paragraph(s)
</p>
</level>
</level>
</level>
<level>
<title>
head title
</title>
<p>
For simplicity, I've reduced any amount of content in between head's to a single p.
</p>
</level>



Thank you all. This list is such a valuable resource.


-Andrew

Current Thread