[xsl] To find out immediate following tag

Subject: [xsl] To find out immediate following tag
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Wed, 01 Oct 2008 14:14:59 +0530
Hi,
Anyone who can help me. I want to merge <a1> within <a> if it is immediate following it. "following::a1[1]" is not working properly.


Input
<a>first</a>
<a1>second</a1>
<a1>third</a1>
<a>fourth
<a1>fifth</a1>
<b1>sixth</b1>
</a>
<a1>seven</a1>
<a>eight</a>
<b1>nine</b1>
<a1>ten</a1>

OUTPUT
<a>first
second</a>
<a1>third</a1>
<a>fourth
<a1>fifth</a1>
<b1>sixth</b1>
seven</a>
<a>eight</a>
<b1>nine</b1>
<a1>ten</a1>

Current Thread