[xsl] Grouping question

Subject: [xsl] Grouping question
From: M Balaji <msbalaji82@xxxxxxxxx>
Date: Wed, 13 May 2009 18:58:16 +0530
Hi All,

I have an input HTML file of this style:

<h2>testing</h2>
<p>data recovery, and application testing. </p>
<h4>Support for file system</h4>
<p>Objects for replication:</p>
<h3>Session</h3>
<p>Before creating sessions... </p>
<h3>Wizard</h3>
<p>In Manager, you can . </p>
<h4>Support for file system</h4>
<p>Objects for replication:</p>
<h2>testing1</h2>

I want to group the above html file like this

<h2>testing
<p>data recovery, and application testing. </p>
<h4>Support for file system
<p>Objects for replication:</p>
</h4>
<h3>Session
<p>Before creating sessions... </p>
</h3>
<h3>Wizard
<p>In Manager, you can . </p>
<h4>Support for file system
<p>Objects for replication:</p></h4>
</h3>
</h2>
<h2>testing1</h2>

If "h4" appears after "h3", then that  "h4" group should be captured
inside the "h3" group. If "h4" appears  before "h3" and if it is a
child of "h2", then that "h4" should be captured in "h2" child group.

How do I need to write the for-each-group element for the above condition?

Thanks in Advance,
Balaji. M

Current Thread