?simple position grouping problem

Subject: ?simple position grouping problem
From: "davidpbrown" <lists@xxxxxxxxxxxxxxxxx>
Date: Sat, 3 Jul 2004 08:51:34 +0100
I think must be simple, but I'm struggling..

<y id="1"/>
  <b id="1"/>
  <b id="2"/>
<y id="2"/>
  <b id="3"/>
<y id="3"/>
  <b id="4"/>
  <b id="5"/>
  <b id="6"/>

how do I select only <b>'s that follow particular <y>'s; to then create

<y id="1"><b id="1"/><b id="2"/></y>
<y id="2"><b id="3"/></y>
<y id="3"><b id="4"/><b id="5"/><b id="6"/></y>

There's no known relationship between the elements but for their position.
using XSLT 2.0.

Thanks and regards

Current Thread